cvs: ZendEngine2 / zend_alloc.c

[email protected] ("Arnaud Le Blanc") Sat, 30 May 2009 16:42:01 -0000
Newsgroups php.zend-engine.cvs
Message-ID <cvslbarnaud1243701721@cvsserver>
lbarnaud		Sat May 30 16:42:01 2009 UTC

  Modified files:              
    /ZendEngine2	zend_alloc.c 
  Log:
  Take small blocks cache into account in memory_get_usage()
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_alloc.c?r1=1.225&r2=1.226&diff_format=u
Index: ZendEngine2/zend_alloc.c
diff -u ZendEngine2/zend_alloc.c:1.225 ZendEngine2/zend_alloc.c:1.226
--- ZendEngine2/zend_alloc.c:1.225	Fri May  1 00:29:49 2009
+++ ZendEngine2/zend_alloc.c	Sat May 30 16:42:01 2009
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_alloc.c,v 1.225 2009/05/01 00:29:49 lbarnaud Exp $ */
+/* $Id: zend_alloc.c,v 1.226 2009/05/30 16:42:01 lbarnaud Exp $ */
 
 #include "zend.h"
 #include "zend_alloc.h"
@@ -2724,7 +2724,11 @@
 	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;
 	}
 }
 /* }}} */