-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples of analyzing heap_dump #10
Comments
I usually do analysing via grep and small scripts around it |
I have a memory leak and i have successfully dumped the heap but now i really am having a hard time knowing where to begin. |
Do you have a way to replicate the leak? Then trace these objects references to some root-objects (globals, class variables etc.), also look for symbol#to_proc (usually used in constructs like |
Regarding HeapDump.count_objects, i dont have a namespace i use for all of my objects. When i do HeapDump.count_objects, i just get something like:
Re: tracing these object references, I am having a hard time understanding how to trace references. I think the problem is i dont fully understand the meaning of all of the fields within the json. How to know if one object references another? Thanks for your help! |
By namespace i mean с++ term, you can think of it as of root module/class module ThisIsNamespace
class SomeClass
...
end
class SomeAnotherClass
...
end
end classes will be named One object references another if (simplified) it has another object's id stored in it. Most long numbers in dump are ids. Each line contains one object so you can simply grep for target id, this will give the object itself and all objects that reference it. |
In regards to count_objects, i i have no idea what classes are leaking so my first instinct is to just count them all. How do i know where to start? Why not just have a way to count all objects? RE: tracing object references. I think the format of the json should allow for generic scripts to make sense of the heap dump without understanding the developer's object model. Imagine how much more usage heap_dump would get if it came with some reusable logic that could analyse your heap for you. Memprof doesn't work with ruby 1.9+ but have you seen this presentation? http://www.scribd.com/doc/30739474/Debugging-Ruby-with-MongoDB. I think the nice thing about memprof is that it produces json that allows for reusable introspection of the data. The example mongo queries within the presentation should work for anyone's heap. thx! |
Unfortunately there's no silver bullet. No one can tell if the object is actually leaked without understanding object model and what the program does in general. The idea is to separate basic types and that of libraries from yours so that you have less noise. And compare what you observe with what you expect. |
Are there any example scripts that analyze this heap dump and perhaps produce some type of visualization with a tool like graphviz? The heap_dump looks incredibly useful but I am having a difficult time figuring out how to use it to trace a memory leak.
thx!
-karl
The text was updated successfully, but these errors were encountered: