From owner-freebsd-hackers Fri Mar 7 04:05:45 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id EAA05869 for hackers-outgoing; Fri, 7 Mar 1997 04:05:45 -0800 (PST) Received: from haldjas.folklore.ee (Haldjas.folklore.ee [193.40.6.121]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id EAA05854 for ; Fri, 7 Mar 1997 04:05:08 -0800 (PST) Received: from localhost (narvi@localhost) by haldjas.folklore.ee (8.8.4/8.8.4) with SMTP id OAA01418 for ; Fri, 7 Mar 1997 14:06:19 +0200 (EET) Date: Fri, 7 Mar 1997 14:06:19 +0200 (EET) From: Narvi To: hackers@freebsd.org Subject: realloc in 2.2 Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Well... I did a test on the memory use incurred by using realloc to grow a memory area. The area seems to grow a bit too large - or am I misinterpreting something? There is no /etc/malloc.conf and no malloc options are set in the environment or otherwise. The source of the quick hack is : #include #include main() { void *p; unsigned i; unsigned long j; p=malloc(1024); for (i=0; i<1024; ++i) { j=1024+(i+1)*1024; p=realloc(p, j); } printf ("%u\n", j); } The result of /usr/bin/time -l is: haldjas: {5} /usr/bin/time -l ./re 1049600 6.11 real 4.51 user 1.52 sys 2600 maximum resident set size 3 average shared memory size 1413 average unshared data size 125 average unshared stack size 16528 page reclaims 0 page faults 0 swaps 0 block input operations 0 block output operations 3 messages sent 3 messages received 0 signals received 3 voluntary context switches 98 involuntary context switches Sander