Re: ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET

From: Date: Fri, 02 Mar 2012 18:44:44 +0000
Subject: Re: ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
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

Thread (12 messages)

« previous php.internals (#58509) next »