We want to help developers like you. Tell us about how you work: http://qsurvey.mozilla.com/s3/Developer-Audience-Survey-V2/?s=mdn

Performs garbage collection in the JS memory pool.


JS_GC(JSRuntime *rt);
Name Type Description
rt JSRuntime * The runtime to for which to perform garbage collection.


JS_GC performs garbage collection of JS objects, strings and other internal data structures that are no longer reachable in the specified runtime. Garbage collection frees memory so that it can be reused by the system.

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_MaybeGC instead.

Use JS_SetGCCallback to add hooks that are called during garbage collection.

See Also

Document Tags and Contributors

 Contributors to this page: arai, JonCoppeard, fscholz, Jorend, Dria, MMondor, Nickolay, Tservo
 Last updated by: arai,