Performs garbage collection in the JS memory pool.
void JS_GC(JSContext *cx);
||The context to use.
JS_GC performs garbage collection, if necessary, of JS objects, numbers, and strings that are no longer reachable in the runtime of
cx. Garbage collection frees memory so that it can be reused by the JS engine.
When your scripts create many objects, you may want to call
JS_GC directly in your code, particularly when a script terminates or when the application has idle time. To perform garbage collection only if needed, call
JS_SetGCCallback to add hooks that are called during garbage collection.