Open
Bug 1477997
Opened 7 years ago
Updated 3 years ago
Add a button to trigger a full GC/CC
Categories
(DevTools :: Memory, enhancement, P2)
DevTools
Memory
Tracking
(Not tracked)
NEW
People
(Reporter: julienw, Unassigned, Mentored)
Details
When debugging short term memory leaks, it's very common that we need to do a full GC before capturing a snapshot. Currently this is very cumbersome as we need to go to about:memory to do it. This would be very useful to have such a button directly in the memory tool UI.
| Reporter | ||
Updated•7 years ago
|
Mentor: felash
Priority: -- → P2
| Reporter | ||
Comment 1•7 years ago
|
||
I'm not very used to the code of this tool yet, but here is where I believe the change will be:
* https://searchfox.org/mozilla-central/source/devtools/client/memory/components/Toolbar.js => this is where the new button will be
* https://searchfox.org/mozilla-central/source/devtools/client/memory/app.js => this is where the code for the GC/CC will be
* https://searchfox.org/mozilla-central/source/toolkit/components/aboutmemory/content/aboutMemory.js#437 => This is how "Minimize memory usage" is implemented. I don't know if it's easy/possible to dispatch this message from the devtools panel though. Also I don't know if that's what we want, or if we'd rather want a GC+CC. I think "Minimize memory usage" additionally clears some cache (eg: decoded images).
Comment 2•7 years ago
|
||
The GC has to be done in the actor, not in the frontend, otherwise it will be buggy when debugging remotely.
It is interesting to see that memory actor already contains GC and GC methods:
https://searchfox.org/mozilla-central/source/devtools/server/actors/memory.js#63-65,69
But they are used only in tests.
The actual implementation is here:
https://searchfox.org/mozilla-central/source/devtools/server/performance/memory.js#331-347
You may want to tweak it to do what about:memory is doing.
Comment 3•7 years ago
|
||
I recall a conversation back a few years ago that the memory tool actually does a full GC before taking the snapshot. You could ask fitzgen or jimb and they would know for sure.
Comment 5•7 years ago
|
||
I think what you want are these:
https://searchfox.org/mozilla-central/rev/3fa761ade83ed0b8ab463acb057c2cf0b104689e/js/xpconnect/idl/xpccomponents.idl#285-297
I don't see anything in the heap snapshot code that would request a GC. Here's the call that takes a heap snapshot:
https://searchfox.org/mozilla-central/rev/3fa761ade83ed0b8ab463acb057c2cf0b104689e/devtools/server/performance/memory.js#152
It calls this C++ function:
https://searchfox.org/mozilla-central/rev/3fa761ade83ed0b8ab463acb057c2cf0b104689e/devtools/shared/heapsnapshot/HeapSnapshot.cpp#1638
Nothing there jumps out at me.
Flags: needinfo?(jimb)
Comment 6•7 years ago
|
||
The memory tool doesn't do a GC before a snapshot https://bugzilla.mozilla.org/show_bug.cgi?id=1520597
| Reporter | ||
Comment 7•7 years ago
|
||
Zac, I think you're mentioning about:memory in that bug, while this bug is about the memory panel in devtools.
That said I'm pretty sure none of them is doing a GC :)
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•