From: Arnaud Le Blanc Date: Sat, 30 May 2009 16:42:13 +0000 (+0000) Subject: MFH: Take small blocks cache into account in memory_get_usage() X-Git-Tag: php-5.3.0RC3~73 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b4d9c79162a59b12a3674695d5d5e3b2d8d70acc;p=php MFH: Take small blocks cache into account in memory_get_usage() --- diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index da64081c3a..22963d87b3 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2496,7 +2496,11 @@ ZEND_API size_t zend_memory_usage(int real_usage TSRMLS_DC) if (real_usage) { return AG(mm_heap)->real_size; } else { - return AG(mm_heap)->size; + size_t usage = AG(mm_heap)->size; +#if ZEND_MM_CACHE + usage -= AG(mm_heap)->cached; +#endif + return usage; } }