Skip to content

Commit b4d9c79

Browse files
committed
MFH: Take small blocks cache into account in memory_get_usage()
1 parent bed00e1 commit b4d9c79

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Zend/zend_alloc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,11 @@ ZEND_API size_t zend_memory_usage(int real_usage TSRMLS_DC)
24962496
if (real_usage) {
24972497
return AG(mm_heap)->real_size;
24982498
} else {
2499-
return AG(mm_heap)->size;
2499+
size_t usage = AG(mm_heap)->size;
2500+
#if ZEND_MM_CACHE
2501+
usage -= AG(mm_heap)->cached;
2502+
#endif
2503+
return usage;
25002504
}
25012505
}
25022506

0 commit comments

Comments
 (0)