Entry: JS_AddRoot (Function)
Summary: Adds a garbage collection hash table entry for a specified JS item to protect it from garbage collection.
Syntax:
JSBool JS_AddRoot(JSContext *cx, void *rp);
Argument Type Description
cx JSContext * Pointer to a JS context from which to derive runtime information.
rp void * Pointer to the item to protect.
Description:
JS_AddRoot protects the GC thing pointed at by a specified pointer, *rp, from garbage collection. rp is a pointer to a pointer to a JS double, string, or object. An entry for rp is added to the garbage collector's table for the JSRuntime of the specified JSContext, cx.
If the GC thing pointed to by *rp is an object, then any GC things reachable from it's properties are automatically protected from garbage collection, too.
See also:
|
|
|