From: Arnaud Le Blanc Date: Sat, 30 May 2009 16:42:01 +0000 (+0000) Subject: Take small blocks cache into account in memory_get_usage() X-Git-Tag: php-5.4.0alpha1~191^2~3443 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b80d1404e66918d95f58f59bce6485b2257f8056;p=php Take small blocks cache into account in memory_get_usage() --- diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 81bcbc7380..7c37fee005 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2724,7 +2724,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; } } /* }}} */