Visit Mozilla.org

JS DumpHeap

From MDC

This article covers features introduced in SpiderMonkey 1.8 (not yet released).


DEBUG only. Dump the object graph of heap-allocated things.

[edit] Syntax

JSBool JS_DumpHeap(JSContext *cx, FILE *fp, void *startThing, uint32 startKind,
                   void *thingToFind, size_t maxDepth, void *thingToIgnore);
Name Type Description
cx JSContext * Pointer to a JS context. Every JSContext is permanently associated with a JSRuntime; each JSRuntime contains a GC heap.
fp FILE * File for the dump output.
startThing void * NULL or a pointer to a GC thing (use JSVAL_TO_GCTHING to obtain a pointer to pass here). When null, dump all things reachable from the runtime roots. When non-null, dump only things reachable from the object indicated.
startKind uint32 Trace kind of startThing, if startThing is not null. Must be 0 when startThing is null.
thingToFind void * NULL or a pointer to a GC thing. If this is non-null, JS_DumpHeap only dumps paths in the object graph leading to the specified thing.
maxDepth size_t The upper bound on the number of edges to descend from the graph roots.
thingToIgnore void * NULL or a pointer to a GC thing that will be ignored during graph traversal.

[edit] Description

See bug 378261.