arnaud-lb / php-memory-profiler

Memory profiler for PHP. Helps finding memory leaks in PHP scripts.
MIT License
858 stars 51 forks source link

Add units to Callgrind label for memory size and update `BlockCount` to `Call_Count` #95

Closed samlitowitz closed 9 months ago

samlitowitz commented 1 year ago

Addresses #94

arnaud-lb commented 1 year ago

Thank you!

Memory_Size_(bytes) is a better name :+1:

However, BlocksCount is really the number of blocks allocated by the function. Note that both MemorySize and BlocksCount only take into account the blocks that are live when you dump the profile, so memory that has been freed does not appear here.

For example, if you profile this program:

<?php

function eat(&$a, &$b)
{
    $a = rand() . rand();
    $b = rand() . rand();
}

eat($a, $b);
eat($c, $d);

memprof_dump_callgrind(STDOUT);

memprof will report that eat() allocated 192 bytes, in 4 blocks, and was called two times:

MemorySize metric:

image

BlocksCount metric:

image

samlitowitz commented 9 months ago

@arnaud-lb Apologies for the delay, I have updated the second column to use the correct (and original) header of BlocksCount.

arnaud-lb commented 9 months ago

Thank you @samlitowitz. Could you update the failing tests? I will merge once the checks pass.

samlitowitz commented 9 months ago

@arnaud-lb Done!

arnaud-lb commented 9 months ago

Thank you!