Hi everyone!
Friendly PSA: sometimes you're debugging a "leak" where the GC considers
something reachable and therefore won't collect it, and this happens at an
inopportune time for using the devtools memory panel (eg right before a
DESTROY_RUNTIME collection), so you can't use the nice GUI for visualizing
the GC's retaining paths.
Fear not! You can use `JS::ubi::dumpPaths` to log retaining paths of any GC
thing from within GDB, or you can compile it in as you might do with a
tactically placed printf.
The signature is `void JS::ubi::dumpPaths(JSRuntime* rt, JS::ubi::Node
node, maxRetainingPaths = 10)`. The `rt` should be the runtime that the
thing belongs to, `node` is the thing (JS::ubi::Node constructs from raw GC
pointers as well as Rooted and Handle), and `maxRetainingPaths` is the
number of retaining paths to dump.
Include the "js/UbiNodeShortestPaths.h" header to get `JS::ubi::dumpPaths`.
Happy bug hunting!
Example output:
Path 0:
0x7fff5fbfec10 JS::ubi::RootList
|
|
'<no edge name>'
|
V
0x115c49d80 JSObject
|
|
'shape'
|
V
0x12ac4db50 js::Shape
|
|
'base'
|
V
0x116244e70 js::BaseShape
|
|
'ShapeTable shape'
|
V
0x116289120 js::Shape
|
|
'getter'
|
V
0x11627b3a0 JSObject
|
|
'private'
|
V
0x11855d940 JSObject
|
|
'script'
|
V
0x113290bf0 JSScript
|
|
'sourceObject'
|
V
0x1132763c0 JSObject
Full output: https://pastebin.mozilla.org/8868795
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals