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.

Destroy a JSContext.

Syntax

void
JS_DestroyContext(JSContext *cx);

void
JS_DestroyContextNoGC(JSContext *cx);

void
JS_DestroyContextMaybeGC(JSContext *cx); // Obsolete since JSAPI 14
Name Type Description
cx JSContext * The context to destroy.

Description

These functions destroy a context, cx. JS_DestroyContext additionally performs garbage collection to reclaim any memory that was being used by cx's global object. JS_DestroyContextNoGC does not perform garbage collection. JS_DestroyContextMaybeGC may or may not perform garbage collection; the engine makes an educated guess as to whether enough memory would be reclaimed to justify the work.

In a JS_THREADSAFE build, it does not matter whether the calling thread is in a request on cx. However, there must not be any suspended requests on cx.

If JS_SetContextCallback has been called, this calls the callback.

See Also

Document Tags and Contributors

 Contributors to this page: arai, fscholz, tschneidereit, Jorend, Mgjbot, Wesgarland, Amohr, Dria, MMondor
 Last updated by: arai,