From owner-freebsd-bugs Mon Feb 19 14:28:34 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id OAA29722 for bugs-outgoing; Mon, 19 Feb 1996 14:28:34 -0800 (PST) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id OAA29713 for ; Mon, 19 Feb 1996 14:28:20 -0800 (PST) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id XAA14879; Mon, 19 Feb 1996 23:25:22 +0100 From: Luigi Rizzo Message-Id: <199602192225.XAA14879@labinfo.iet.unipi.it> Subject: Re: malloc() prob in 2.1R? To: swallace@ece.uci.edu (Steven Wallace) Date: Mon, 19 Feb 1996 23:25:22 +0100 (MET) Cc: wollman@lcs.mit.edu, freebsd-bugs@freebsd.org In-Reply-To: <199602162056.MAA12845@newport.ece.uci.edu> from "Steven Wallace" at Feb 16, 96 12:56:19 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-bugs@freebsd.org Precedence: bulk > > Not at all surprising. The memory allocator in 2.1 allocates memory > > for the next power of two greater than or equal to (size + > > malloc_overhead). So, the next power of two greater than or equal to > > (4096 + a_small_amount) is 8192. -current uses a different allocator > > and doesn't over-allocate in this way. Actually it looks even worse than this. The following program seems to reserve 8192 bytes/block for sz >=2048 on 1.1.5, sz >=2045 on 2.1R. Is this reasonable, or I am doing something wrong ? Also, can someone test it on the latest snapshot and on -current ? -------------- #include main() { int i, j, sz=atoi(argv[1]); char *p; for (i=0;i<32; i++) { for (j=0;j<256;j++) p=malloc(sz); printf("Allocated %d kB\n",SZ*(i+1)/4); sleep(5); } } ---------------- Thanks Luigi ==================================================================== Luigi Rizzo Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it Universita' di Pisa tel: +39-50-568533 via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 http://www.iet.unipi.it/~luigi/ ====================================================================