I think that caching part you're talking about is in function
zend_mm_alloc_int......i don't see what caching has to do with these macros...
but i maybe mistaking of course. What i don't understand is those additions and
substracting in those macros......but i'll read more tomorrow.
________________________________
From: Stas Malyshev <smalys...@sugarcrm.com>
To: Adi Mutu <adi_mut...@yahoo.com>
Cc: "internals@lists.php.net" <internals@lists.php.net>
Sent: Friday, March 2, 2012 8:44 PM
Subject: Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
Hi!
>
> #define ZEND_MM_SMALL_FREE_BUCKET(heap, index) \
> (zend_mm_free_block*) ((char*)&heap->free_buckets[index * 2] + \
> sizeof(zend_mm_free_block*) * 2 - \
> sizeof(zend_mm_small_free_block))
> #define
> ZEND_MM_REST_BUCKET(heap) \
> (zend_mm_free_block*)((char*)&heap->rest_buckets[0] + \
> sizeof(zend_mm_free_block*) * 2 - \
> sizeof(zend_mm_small_free_block))
IIRC the purpose of these defines is that the MM caches small free blocks so
that it could find them faster, so that for example allocating zvals (frequent
case) goes faster. So it has a small cache for such blocks, by size, so the
allocator can for example quickly find a free block of size of zval or of size
of Hashtable. These macros try to find such free block for given small size
(first one) or for the rest of blocks (i.e. bigger blocks which share one free
list).
-- Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227
-- PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php