Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
Laruence and I wrote articles about ZendMM internals. You would find them at http://www.laruence.com/2011/11/09/2277.html and http://julien-pauli.developpez.com/tutoriels/php/internals/zend-memory-manager/ . You can use any translator to get them in English For basic use, see the readme at http://lxr.php.net/xref/PHP_5_4/Zend/README.ZEND_MM Hope this helps :) Julien.P On Fri, Mar 2, 2012 at 1:51 PM, Adi Mutu adi_mut...@yahoo.com wrote: Hello, Can somebody shed some light on these 2 defines? Thanks. #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))
Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
Thanks Julien, but i've already read your article using translator and did not found an answer to that (i've also sent you an email about Zend mm a few days ago) laurence site looks down to me. Perhaps the link is wrong? Thanks, A. From: jpauli jpa...@php.net To: Adi Mutu adi_mut...@yahoo.com Cc: internals@lists.php.net internals@lists.php.net Sent: Friday, March 2, 2012 3:43 PM Subject: Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET Laruence and I wrote articles about ZendMM internals. You would find them at http://www.laruence.com/2011/11/09/2277.html and http://julien-pauli.developpez.com/tutoriels/php/internals/zend-memory-manager/ . You can use any translator to get them in English For basic use, see the readme at http://lxr.php.net/xref/PHP_5_4/Zend/README.ZEND_MM Hope this helps :) Julien.P On Fri, Mar 2, 2012 at 1:51 PM, Adi Mutu adi_mut...@yahoo.com wrote: Hello, Can somebody shed some light on these 2 defines? Thanks. #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))
Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
On Fri, Mar 2, 2012 at 2:57 PM, Adi Mutu adi_mut...@yahoo.com wrote: Thanks Julien, but i've already read your article using translator and did not found an answer to that (i've also sent you an email about Zend mm a few days ago) laurence site looks down to me. Perhaps the link is wrong? Thanks, A. I blame the Great Firewall of China could you try that the following link works for you: http://translate.google.com/translate?sl=zh-CNtl=enjs=nprev=_thl=huie=UTF-8layout=2eotf=1u=http%3A%2F%2Fwww.laruence.com%2F2011%2F11%2F09%2F2277.html -- Ferenc Kovács @Tyr43l - http://tyrael.hu
Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
Now that's really awesome.:) I have to do something so i can access and subscribe to that blog. Are you serious about that firewall? That would be my first time i actually encounter a problem because of this. From: Ferenc Kovacs tyr...@gmail.com To: Adi Mutu adi_mut...@yahoo.com Cc: jpauli jpa...@php.net; internals@lists.php.net internals@lists.php.net Sent: Friday, March 2, 2012 4:00 PM Subject: Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET On Fri, Mar 2, 2012 at 2:57 PM, Adi Mutu adi_mut...@yahoo.com wrote: Thanks Julien, but i've already read your article using translator and did not found an answer to that (i've also sent you an email about Zend mm a few days ago) laurence site looks down to me. Perhaps the link is wrong? Thanks, A. I blame the Great Firewall of China could you try that the following link works for you: http://translate.google.com/translate?sl=zh-CNtl=enjs=nprev=_thl=huie=UTF-8layout=2eotf=1u=http%3A%2F%2Fwww.laruence.com%2F2011%2F11%2F09%2F2277.html -- Ferenc Kovács @Tyr43l - http://tyrael.hu
Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
On Fri, Mar 2, 2012 at 2:57 PM, Adi Mutu adi_mut...@yahoo.com wrote: Thanks Julien, but i've already read your article using translator and did not found an answer to that (i've also sent you an email about Zend mm a few days ago) Not seen that. Anyway, I dont master all ZendMM stuff, I couldn't explain every line of code. It's been mainly designed back in 2005, I wasn't here yet :) It's not very hard to guess what it does, if you know how a memory manager works. Basically, it does stuff that malloc() does internally, stuff explained here, for example ( http://www.phrack.org/issues.html?issue=57id=9#article) ; but for PHP needs, and with multi-platform in mind. Julien.P laurence site looks down to me. Perhaps the link is wrong? Thanks, A. From: jpauli jpa...@php.net To: Adi Mutu adi_mut...@yahoo.com Cc: internals@lists.php.net internals@lists.php.net Sent: Friday, March 2, 2012 3:43 PM Subject: Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET Laruence and I wrote articles about ZendMM internals. You would find them at http://www.laruence.com/2011/11/09/2277.html and http://julien-pauli.developpez.com/tutoriels/php/internals/zend-memory-manager/ . You can use any translator to get them in English For basic use, see the readme at http://lxr.php.net/xref/PHP_5_4/Zend/README.ZEND_MM Hope this helps :) Julien.P On Fri, Mar 2, 2012 at 1:51 PM, Adi Mutu adi_mut...@yahoo.com wrote: Hello, Can somebody shed some light on these 2 defines? Thanks. #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))
Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
On Fri, Mar 2, 2012 at 8:51 PM, Adi Mutu adi_mut...@yahoo.com wrote: Hello, Can somebody shed some light on these 2 defines? Thanks. #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)) Hi: the first MACRO is a tricky way to put a number of ZEND_NUM_BUCKETS zend_mm_buckects into a fixed length array. and yes, my site might be blocked by chinese GFW, but you can try this: https://wiki.php.net/internals/zend_mm plz see the red part of the first picture.. thanks -- Laruence Xinchen Hui http://www.laruence.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
On Fri, Mar 2, 2012 at 10:12 PM, Adi Mutu adi_mut...@yahoo.com wrote: Now that's really awesome.:) I have to do something so i can access and subscribe to that blog. Hi: Google reader is a good choice~ :) I am so glad you like it. thanks . Are you serious about that firewall? That would be my first time i actually encounter a problem because of this. From: Ferenc Kovacs tyr...@gmail.com To: Adi Mutu adi_mut...@yahoo.com Cc: jpauli jpa...@php.net; internals@lists.php.net internals@lists.php.net Sent: Friday, March 2, 2012 4:00 PM Subject: Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET On Fri, Mar 2, 2012 at 2:57 PM, Adi Mutu adi_mut...@yahoo.com wrote: Thanks Julien, but i've already read your article using translator and did not found an answer to that (i've also sent you an email about Zend mm a few days ago) laurence site looks down to me. Perhaps the link is wrong? Thanks, A. I blame the Great Firewall of China could you try that the following link works for you: http://translate.google.com/translate?sl=zh-CNtl=enjs=nprev=_thl=huie=UTF-8layout=2eotf=1u=http%3A%2F%2Fwww.laruence.com%2F2011%2F11%2F09%2F2277.html -- Ferenc Kovács @Tyr43l - http://tyrael.hu -- Laruence Xinchen Hui http://www.laruence.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
Already added in google reader..now i see the site is accesible also, strange. I've looked at the picture, read your explanation, but i still didn't get it.i'll think some more about this and perhaps i'll suggest you a better translation at the end. Thanks! From: Laruence larue...@php.net To: Adi Mutu adi_mut...@yahoo.com Cc: Ferenc Kovacs tyr...@gmail.com; jpauli jpa...@php.net; internals@lists.php.net internals@lists.php.net Sent: Friday, March 2, 2012 4:52 PM Subject: Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET On Fri, Mar 2, 2012 at 10:12 PM, Adi Mutu adi_mut...@yahoo.com wrote: Now that's really awesome.:) I have to do something so i can access and subscribe to that blog. Hi: Google reader is a good choice~ :) I am so glad you like it. thanks . Are you serious about that firewall? That would be my first time i actually encounter a problem because of this. From: Ferenc Kovacs tyr...@gmail.com To: Adi Mutu adi_mut...@yahoo.com Cc: jpauli jpa...@php.net; internals@lists.php.net internals@lists.php.net Sent: Friday, March 2, 2012 4:00 PM Subject: Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET On Fri, Mar 2, 2012 at 2:57 PM, Adi Mutu adi_mut...@yahoo.com wrote: Thanks Julien, but i've already read your article using translator and did not found an answer to that (i've also sent you an email about Zend mm a few days ago) laurence site looks down to me. Perhaps the link is wrong? Thanks, A. I blame the Great Firewall of China could you try that the following link works for you: http://translate.google.com/translate?sl=zh-CNtl=enjs=nprev=_thl=huie=UTF-8layout=2eotf=1u=http%3A%2F%2Fwww.laruence.com%2F2011%2F11%2F09%2F2277.html -- Ferenc Kovács @Tyr43l - http://tyrael.hu -- Laruence Xinchen Hui http://www.laruence.com/
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
Re: [PHP-DEV] ZEND_MM_SMALL_FREE_BUCKET and ZEND_MM_REST_BUCKET
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