Deprecated since JavaScript api8
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Free a compiled script that is no longer needed.

Syntax

void
JS_DestroyScript(JSContext *cx, JSScript *script);
Name Type Description
cx JSContext * The context in which to destroy the script. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
script JSScript * The script to destroy.

Description

JS_DestroyScript destroys the given compiled script, freeing the memory allocated to it. The script must not be currently executing (in any context, at any level of the stack) and must not be used again afterwards.

At present, this function has no effect; the JSScript lives for as long as its script object lives. See JS_NewScriptObject for details.

See Also