Last Comment Bug 696174 - add way to grab JS heap dump at the same time as the CC dump
: add way to grab JS heap dump at the same time as the CC dump
Status: RESOLVED FIXED
[MemShrink:P2]
:
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla13
Assigned To: Andrew McCreight [:mccr8]
:
: Nathan Froyd [:froydnj]
Mentors:
Depends on: 680482
Blocks: 723783 ZombieHunter
  Show dependency treegraph
 
Reported: 2011-10-20 12:31 PDT by Andrew McCreight [:mccr8]
Modified: 2012-02-08 05:40 PST (History)
10 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
WIP that always dumps the GC heap when you CC (2.81 KB, patch)
2011-10-20 12:33 PDT, Andrew McCreight [:mccr8]
no flags Details | Diff | Splinter Review
Patch (6.16 KB, patch)
2011-11-23 08:02 PST, Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary)
continuation: feedback+
Details | Diff | Splinter Review
Patch (7.27 KB, patch)
2012-01-12 08:51 PST, Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary)
continuation: review-
Details | Diff | Splinter Review
add xpc::DumpJSHeap(), call it when doing a CC dump (4.54 KB, patch)
2012-02-02 16:37 PST, Andrew McCreight [:mccr8]
bobbyholley: review+
bugs: review+
Details | Diff | Splinter Review

Description Andrew McCreight [:mccr8] 2011-10-20 12:31:10 PDT
When the cycle collector decides an object is live due to a marked JS object, it is useful to be able to see why the GC decided the marked JS object is alive.  We can do this by taking a JS heap dump at the same time as the CC heap dump.
Comment 1 Andrew McCreight [:mccr8] 2011-10-20 12:33:37 PDT
Created attachment 568475 [details] [diff] [review]
WIP that always dumps the GC heap when you CC

There's something weird about this patch.  It works fine for normal CCs, but hangs the browser when you manually invoke a CC using the button in about:memory.

Another problem with this patch is that it dumps the GC heap every time there is a CC, where we really only want it when we do a CC dump at the same time.
Comment 2 Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2011-11-23 08:02:28 PST
Created attachment 576507 [details] [diff] [review]
Patch
Comment 3 Andrew McCreight [:mccr8] 2011-11-23 13:30:40 PST
Comment on attachment 576507 [details] [diff] [review]
Patch

Looks reasonable to me.  It would be kind of nice to have a way to dump the CC graph without dumping a GC graph, but I guess either way people are going to have tons of log files to delete, and any solutions I can think of would be annoying.  Thanks for picking this up!
Comment 4 Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2011-12-29 06:17:12 PST
Review ping
Comment 5 Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2012-01-12 08:51:09 PST
Created attachment 588053 [details] [diff] [review]
Patch

Unbitrotted.
Comment 6 Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2012-01-18 10:28:14 PST
Comment on attachment 588053 [details] [diff] [review]
Patch

Andrew, want to steal this review?
Comment 7 Andrew McCreight [:mccr8] 2012-01-18 10:32:26 PST
Sure I can look at it.

At a glance here, your inclusion of xpcprivate in the cycle collector seems sketchy.  Is that going to make Ms2ger sad?
Comment 8 Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2012-01-18 10:34:09 PST
Yes, it will make him sad.
Comment 9 :Ms2ger (⌚ UTC+1/+2) 2012-01-18 10:41:23 PST
Yes. Just add a xpc::DumpGCHeap to xpcpublic.h.

And use nsXPConnect::GetXPConnect instead of do_GetService("@mozilla.org/js/xpc/ContextStack;1"); inside xpconnect
Comment 10 Andrew McCreight [:mccr8] 2012-01-18 11:38:25 PST
Comment on attachment 588053 [details] [diff] [review]
Patch

Yeah, Ms2ger's idea sounds better.  I can look into this if you don't have the time, Kyle.  Or are on vacation. ;)
Comment 11 Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2012-01-18 11:40:21 PST
If you could pick this up and run with it it would be greatly appreciated.
Comment 12 Andrew McCreight [:mccr8] 2012-02-02 16:37:39 PST
Created attachment 594011 [details] [diff] [review]
add xpc::DumpJSHeap(), call it when doing a CC dump
Comment 13 Andrew McCreight [:mccr8] 2012-02-02 16:46:03 PST
Thanks for the suggestion, Ms2ger, it works a lot better than various hacky things I tried before to make this work!
Comment 14 Andrew McCreight [:mccr8] 2012-02-02 17:13:20 PST
Comment on attachment 594011 [details] [diff] [review]
add xpc::DumpJSHeap(), call it when doing a CC dump

bholley for the XPConnect changes, smaug for the cycle collector changes.

All of these things have to be wrapped in #ifdef DEBUG because js::DumpHeapComplete is likewise wrapped.

The ++gLogCounter had to be hoisted out of the sprintf to ensure it is always called with or without the DEBUG.

I pushed a build to try on Linux to see if it builds with opt.
Comment 15 Andrew McCreight [:mccr8] 2012-02-07 15:13:49 PST
https://hg.mozilla.org/integration/mozilla-inbound/rev/8084cedbba17
Comment 16 Andrew McCreight [:mccr8] 2012-02-08 05:40:38 PST
https://hg.mozilla.org/mozilla-central/rev/8084cedbba17

Note You need to log in before you can comment on or make changes to this bug.