Re: [PHP] Re: Memory investigation

2010-03-04 Thread dsiembab01
you could read this http://xdebug.org/docs/execution_trace and then parse trace files to get the memory usage create a global to store user functions, I think user function do not populate get_defined_functions(); until the function is called; $t = get_defined_functions(); $userFunctions = $t['u

Re: [PHP] Re: Memory investigation

2010-03-03 Thread la...@garfieldtech.com
Currently it's mostly procedural with some components that are OO. I suspect most of the memory sinks are large arrays (we have a lot of them), but I am not certain of that. Hence my interest in more accurate investigation tools. --Larry Garfield dsiemba...@gmail.com wrote: couple questions

Re: [PHP] Re: Memory investigation

2010-03-03 Thread dsiembab01
couple questions Larry is this application composed of classes or straight up no holes barred procedural code? la...@garfieldtech.com wrote: That's not really what I'm after. Let me try an example: function foo($id) { static $foos = array(); if (empty($foos[$id]) { $foos[$id] = load_

Re: [PHP] Re: Memory investigation

2010-03-03 Thread Rene Veerman
global $fooSize = 0; function foo($id) { global $fooSize; if (empty($foos($id)) { $b = get_memory_usage(true); $foos[$id] = load_foo($id); $fooSize+= $b - get_memory_usage(true); } ... } On Wed, Mar 3, 2010 at 8:16 PM, la...@garfieldtech.com wrote: > That's not really what I'm after.  

Re: [PHP] Re: Memory investigation

2010-03-03 Thread la...@garfieldtech.com
That's not really what I'm after. Let me try an example: function foo($id) { static $foos = array(); if (empty($foos[$id]) { $foos[$id] = load_foo($id); } return $foos[$id]; } When load_foo() is slow (e.g., lots of DB traffic or remote-server calls or whatever), such caching can h

Re: [PHP] Re: Memory investigation

2010-03-03 Thread dsiembab01
function check_memory_usage(&$memory) { $memory[] = memory_get_usage(); return $memory; } something like this? you can put it wherever you like and returns an array for further processing. You could optionally add a second argument to set the index to a name and check if the name exists

Re: [PHP] Re: Memory investigation

2010-03-03 Thread David Otton
On 3 March 2010 15:49, la...@garfieldtech.com wrote: > Yep, I'm familiar with XDebug and KCacheGrind.  As you say, though, it > doens't (as far as I am aware) offer the particular data that I'm after. >  We've already got cachegrind gurus working on the code who know how to use > it better than I

Re: [PHP] Re: Memory investigation

2010-03-03 Thread la...@garfieldtech.com
Yep, I'm familiar with XDebug and KCacheGrind. As you say, though, it doens't (as far as I am aware) offer the particular data that I'm after. We've already got cachegrind gurus working on the code who know how to use it better than I do. :-) What I'm looking for is "see this big cache objec

[PHP] Re: Memory investigation

2010-03-03 Thread user
ON Linux I have kcacheGrind setup with Xdebug and I find it is a nice little thing to have. It won't tell you the memory consumed but it will find cycles and display object maps. if you have Kcachegrind it is likely you have valgrind installed. http://www2.mandriva.com/ http://valgrind.org/ htt