Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Dec 2008 17:43:12 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Yuri <yuri@rawbw.com>
Cc:        Giorgos Keramidas <keramida@ceid.upatras.gr>, freebsd-questions@freebsd.org
Subject:   Re: Why process memory starts so high up in virtual space with FreeBSD malloc?
Message-ID:  <20081201234311.GE53570@dan.emsphone.com>
In-Reply-To: <20081201233758.GD53570@dan.emsphone.com>
References:  <49345710.9070403@rawbw.com> <874p1njz3l.fsf@kobe.laptop> <49346BD3.5080506@rawbw.com> <20081201233758.GD53570@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Dec 01), Dan Nelson said: 
> Here's what I get with a simple test program on a month-old 7.1-PRE

Gah. silly mailing-list attachment stripper.

#include <stdlib.h>
#include <stdio.h>

int main(void)
{
  size_t malloced = 0;
  size_t chunksize = 1024*1024;
  void *first = NULL;
  void *last = NULL;
  void *ptr;
  
  while ((ptr = malloc(chunksize)) != NULL) {
    if (first == NULL)
      first = ptr;
    last = ptr;
    malloced += chunksize;
  }
  printf("Malloced %zu bytes. First: %p, Last: %p\n", malloced, first, last);
  exit(0);
}

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081201234311.GE53570>