Re: PHP4: php_module holds memory to long !

From: Date: Wed, 10 Jan 2001 19:44:41 +0000
Subject: Re: PHP4: php_module holds memory to long !
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-43719@lists.php.net to get a copy of this message
On Wed, Jan 10, 2001 at 09:23:43PM +0200, Stanislav Malyshev wrote: > SS>> Thanks for the correction! I have never seen that in action > SS>> though. Usually, the C library will keep freed memory in > SS>> free lists and does not decrease the size of the data > SS>> segment using sbrk. > > Actually, from glibc source there's a hook that is supposed to do this in > some circumstances. Never could actually make it work in real life. Also, > IIRC glibc on Linux allocates really large (8k+? 16k+?) blocks as mmap's > of /dev/zero and those are really given back to system, since on free they > are just munmap'ed. Checked the glibc 2.2 sources, looks like 128k+ blocks are mmap'ed and given back to the system. How does Zend allocate memory then? I guess I could try to figure it out myself, but it's a bit complex. Are there many small chunks? Seems like emalloc() is called a lot creating small chunks, but each emalloc() doesn't result in a corresponding malloc() perhaps? I guess with glibc on Linux it would be nice if malloc() allocated say 128k chunks, and emalloc() used memory inside those. Stig

« previous php.dev (#43719) next »