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

index 2efd15efcfb1a35481f6e67bc224b76c9357f893..ee0834acc743ab04239311881870e7e1919eb0ab 100644 (file)
@@ -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;
        }
 }