Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

JS_TracerInit

Obsolete since JSAPI 31
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

This article covers features introduced in SpiderMonkey 1.8

Note: in JSAPI 12, the macro JS_TRACER_INIT has been replaced by the function JS_TracerInit

Initialize a JSTracer for object graph tracing.

Syntax

void
JS_TracerInit(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback);
Name Type Description
trc JSTracer * The tracer to be initialized.
cx JSContext * The context in which to perform tracing.
callback JSTraceCallback A callback, described below, which the tracing APIs will call each time a pointer is found from one GC thing to another.

Callback syntax

typedef void
(*JSTraceCallback)(JSTracer *trc, void *thing, uint32 kind);
Name Type Description
trc JSTracer * The tracer visiting obj.
thing void * A GC thing.
kind uint32 One of the constants JSTRACE_OBJECT, JSTRACE_DOUBLE, JSTRACE_STRING; or a tag denoting an internal implementation-specific traversal kind. In the latter case, the only operations the callback may perform on thing are to call JS_TraceChildren or the DEBUG-only JS_PrintTraceThingInfo function.

Description

JS_TraceChildren and other tracing APIs call the tracer callback for each traceable thing directly referenced by a particular object or runtime structure. It is the callback's responsibility to ensure the traversal of the full object graph, if desired, by eventually calling JS_TraceChildren on the passed thing. In this case the callback must be prepared to deal with cycles in the traversal graph.

See Also

Document Tags and Contributors

 Contributors to this page: arai, fscholz, tschneidereit, Jorend
 Last updated by: arai,