MDN’s new design is in Beta! A sneak peek:

Free all resources used by the JS engine, not associated with specific runtimes.




Destroys all free-standing resources allocated by SpiderMonkey, not associated with any JSRuntime, JSContext, or other structure.

This method should be called after all other JSAPI data has been properly cleaned up: every JSRuntime created with JS_NewRuntime must have been destroyed with JS_DestroyRuntime, every JSContext created with JS_NewContext must have been destroyed with JS_DestroyContext, and so on. Calling this method before all other resources have been destroyed has undefined behavior.

Failure to call this method, at present, has no adverse effects other than leaking memory. This may not always be the case; it's recommended that all embedders call this method when all other JSAPI operations have completed, to be future-proof.

It is currently not possible to initialize SpiderMonkey multiple times (that is, calling JS_Init, then other JSAPI methods, then JS_ShutDown in that order, then doing so again). This restriction may eventually be lifted.

Implementation note: This method has been used to clean up memory allocated by jsdtoa.cpp, memory allocated to implement on Windows, and when the Internationalization API is enabled, memory internally allocated by ICU. Exact details about what this method cleans up will vary depending upon the version of SpiderMonkey in use.

See Also

Document Tags and Contributors

 Contributors to this page: arai, fscholz, Waldo, Jorend, Mgjbot, Nickolay, Michelemostarda
 Last updated by: arai,