From: Arnaud Le Blanc Date: Sat, 30 May 2009 16:42:24 +0000 (+0000) Subject: MFH: Take small blocks cache into account in memory_get_usage() X-Git-Tag: php-5.2.10RC2~54 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=82655fb85639dafd3e396d4476c3d9c130642af5;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 2efd15efcf..ee0834acc7 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2477,7 +2477,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; } }