]> granicus.if.org Git - php/commitdiff
Take small blocks cache into account in memory_get_usage()
authorArnaud Le Blanc <lbarnaud@php.net>
Sat, 30 May 2009 16:42:01 +0000 (16:42 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Sat, 30 May 2009 16:42:01 +0000 (16:42 +0000)
Zend/zend_alloc.c

index 81bcbc73803e1b91bdbe0648e57b2a80d73cc332..7c37fee0056b98a964fd2147d2cf69b747bbe3f8 100644 (file)
@@ -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;
        }
 }
 /* }}} */