Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58509 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55606 invoked from network); 2 Mar 2012 18:44:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Mar 2012 18:44:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.113 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.113 smtp113.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.113] ([67.192.241.113:58112] helo=smtp113.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FE/96-22821-F15115F4 for ; Fri, 02 Mar 2012 13:44:48 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp11.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 7A212D0F3B; Fri, 2 Mar 2012 13:44:45 -0500 (EST) X-Virus-Scanned: OK Received: by smtp11.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 41305D0F53; Fri, 2 Mar 2012 13:44:45 -0500 (EST) Message-ID: <4F51151C.5030305@sugarcrm.com> Date: Fri, 02 Mar 2012 10:44:44 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.1) Gecko/20120208 Thunderbird/10.0.1 MIME-Version: 1.0 To: Adi Mutu CC: "internals@lists.php.net" References: <1330692703.90971.YahooMailNeo@web43509.mail.sp1.yahoo.com> In-Reply-To: <1330692703.90971.YahooMailNeo@web43509.mail.sp1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET From: smalyshev@sugarcrm.com (Stas Malyshev) 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