|The stupid question is the question not asked|
Profiling memoryby kyle (Abbot)
|on Aug 15, 2007 at 01:55 UTC||Need Help??|
kyle has asked for the
wisdom of the Perl Monks concerning the following question:
I am here to ask the same question asked two years ago in Memory Profiling. That question didn't get the kind of answer I'm looking for, but it's exactly the question I want to ask. Is there a tool that will tell me how a program uses the memory that it uses?
I know about Devel::Size, which is good for when you have a particular data structure that you want to watch. I also know about Memchmark, which will compare the memory used by different algorithms. I'm not asking about those, and I'm not asking how to find a memory leak.
What I want is something like Devel::DProf, but for memory. Imagine you receive a huge piece of code that's using too much memory. How do you tell what parts are using how much?
I'd like a tool that will list things that are using memory along with how much (max, mean, median). I want it to tell me how to find that structure in the code that I'm working on (by name, or by the line on which it's created).
If it's true that nothing like this exists, is it possible to create it? Could an XS module (or even a pure Perl module) somehow trap and track the creation and modification of every hash, array, or scalar?
Your wisdom will be greatly appreciated.