[webkit-dev] Questions regarding memory debugging
darin at apple.com
Wed Mar 10 11:50:28 PST 2010
On Mar 10, 2010, at 11:48 AM, Zoltan Herczeg wrote:
> I have a technique to capture ref/deref problems with gdb. When the object is created (inside the object constructor), I just put a write break point
> to the address of m_refCount: "watch this->m_refCount" in gdb. The backtrace can be inspected every time when this watch point is hit. Ref /
> derefs must be in pairs, usually easy to find which ref has no deref pair. Gdb also supports executing scripts when a breakpoint is hit, this could
> be useful to perform some tasks (see the COMMAND command).
I do something similar, putting a breakpoint on both ref and deref with the commands "p m_refCount", "bt", and "continue". Then I paste the output into a text file and find the unbalanced call with searching in the text editor. Usually by deleting ref/deref pairs that I decide are balanced. Until one is left.
More information about the webkit-dev