Re: ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
| From: | Adi Mutu | Date: | Fri, 02 Mar 2012 19:10:07 +0000 |
| Subject: | Re: ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-58520@lists.php.net to get a copy of this message | ||
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 <smalyshev@sugarcrm.com>
To: Adi Mutu <adi_mutu06@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