# php-memprof php-memprof profiles memory usage of PHP scripts, and especially can tell which function has allocated every single byte of memory currently allocated. This is different from measuring the memory usage before and after a function call: ``` php 11578 [blocks_count] => 236 [memory_size_inclusive] => 10497691 [blocks_count_inclusive] => 244 [calls] => 1 [called_functions] => Array ( [main] => Array ( [memory_size] => 288 [blocks_count] => 3 [memory_size_inclusive] => 10486113 [blocks_count_inclusive] => 8 [calls] => 1 [called_functions] => Array ( [a] => Array ( [memory_size] => 4 [blocks_count] => 1 [memory_size_inclusive] => 10485825 [blocks_count_inclusive] => 5 [calls] => 1 [called_functions] => Array ( [b] => Array ( [memory_size] => 10485821 [blocks_count] => 4 [memory_size_inclusive] => 10485821 [blocks_count_inclusive] => 4 [calls] => 1 [called_functions] => Array ( [str_repeat] => Array ( [memory_size] => 0 [blocks_count] => 0 [memory_size_inclusive] => 0 [blocks_count_inclusive] => 0 [calls] => 1 [called_functions] => Array ( ) ) ) ) ) ) [memprof_dump_array] => Array ( [memory_size] => 0 [blocks_count] => 0 [memory_size_inclusive] => 0 [blocks_count_inclusive] => 0 [calls] => 1 [called_functions] => Array ( ) ) ) ) ) ) ## Todo * Support for tracking persistent (non-zend-alloc) allocations when libc doesn't have malloc hooks [1]: https://www.gnu.org/software/libc/manual/html_node/Hooks-for-Malloc.html#Hooks-for-Malloc [2]: http://kcachegrind.sourceforge.net/html/Home.html [3]: http://judy.sourceforge.net/index.html [4]: https://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html [5]: https://google-perftools.googlecode.com/ [6]: https://www.google.com/search?q=qcachegrind [7]: https://github.com/arnaud-lb/php-memory-profiler/blob/master/INTERNALS.md