Interpreting xhprof results - why yield negative values of MemUse?

739 Views Asked by At

Why does it show negative number of MemUse?

xhprof output

1

There are 1 best solutions below

1
On

Functions can release more memory than they allocate. (Note: a function can release memory allocated else where.)

For example, consider a function a() which calls b(). Say, b() allocates a string or array and returns it to a() which then uses it locally and then a() completes. In this case, b()'s memory allocation will be +ve, whereas a()'s net memory allocation will be -ve() (because it was responsible for free'ing memory allocated in b()).