Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Feb 1996 23:25:22 +0100 (MET)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        swallace@ece.uci.edu (Steven Wallace)
Cc:        wollman@lcs.mit.edu, freebsd-bugs@freebsd.org
Subject:   Re: malloc() prob in 2.1R?
Message-ID:  <199602192225.XAA14879@labinfo.iet.unipi.it>
In-Reply-To: <199602162056.MAA12845@newport.ece.uci.edu> from "Steven Wallace" at Feb 16, 96 12:56:19 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > 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 <stdio.h>
    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/
====================================================================



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