Re: calloc

From: Andres Kroonmaa <andre@dont-contact.us>
Date: Tue, 30 Dec 1997 21:17:21 +0200 (EETDST)

--MimeMultipartBoundary
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT

> Henrik Nordstrom <hno@hem.passagen.se> wrote:
>
> > Can you guys explain me what happens when I ptr=calloc("1 chunk", "of say 16MB")
> > work on it, then free(). process SIZE does not drop after free().
>
> Yes, most malloc implementations never release memory back to the OS. It
> will however be reused by the application in later allocations (smaller
> or sometimes bigger allocations as well)
>
> A calloc is effectively the same as
> ptr=malloc(n*size);memset(ptr,0,n*size); so regardless how you balance
> the n ans size values the allocation is the same.

 Thanks to all who replied.
 Basically I got to know that I have used for pretty long time an antient gnu malloc
 from year 95. Last malloc from Doug Lea (http://g.oswego.edu/dl/html/malloc.html)
 does much better job. (this one i a basis in gnu libc)

 btw, what is latest suggested gnu malloc?

 I'd suggest to include a pointer to a source of gnu malloc in squid docs.
 All coders say gnumalloc is better, but noone ever mentions which one...
 I, for eg. as a mighty looser grabbed a malloc archive from gnu's ftp site,
 only for a second thought that '95 looks slightly odd...

 ----------------------------------------------------------------------
  Andres Kroonmaa mail: andre@online.ee
  Network Manager
  Organization: MicroLink Online Tel: 6308 909
  Tallinn, Sakala 19 Pho: +372 6308 909
  Estonia, EE0001 http://www.online.ee Fax: +372 6308 901
 ----------------------------------------------------------------------

--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:45 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:32 MST