Hello.
The current low-level memory management code in zend_mm.c places the
free blocks as first on the bucket. This increases the fragmentation
of newly allocated free blocks. I think it is a good idea to place the
freed or newly allocated blocks as last on the bucket. Thus when a new
block is allocated the allocation scheme will give preference to old
and already fragmented memory segments. The new segments will be used
only when a request for a big block is made. This will significantly
decrease the memory fragmentation.

The current scheme uses the newly allocated segments as soon as
possible because they are placed first on the list. This combined with
the bad (IMHO) scheme of the high-level memory caching creates enormous
memory fragmentation. A script that needs about 2MB of memory when run
several times in a row may cause PHP to allocate about 10 MB of memory.

vesselin


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to