From 1b2e8733004268b9b0c0ec0c2fd9b0d56bdfb5d3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 9 Oct 2013 16:08:09 +0200 Subject: php-pecl-memprof: 1.0.0 - New package --- README.md | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..2d5a721 --- /dev/null +++ b/README.md @@ -0,0 +1,264 @@ +# 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 + -- cgit