JS_DestroyScript

  • Revision slug: SpiderMonkey/JSAPI_Reference/JS_DestroyScript
  • Revision title: JS_DestroyScript
  • Revision id: 106867
  • Created:
  • Creator: Jorend
  • Is current revision? No
  • Comment no wording changes; page display name changed to 'JS_DestroyScript'

Revision Content

{{ Jsapi_ref_header("JS_DestroyScript") }}

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. {{ Jsapi-requires-request() }}
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.

Do not use JS_DestroyScript on a script if JS_NewScriptObject was successfully called on it.

{{ LXRSearch("ident", "i", "JS_DestroyScript") }}

Revision Source

<p>{{ Jsapi_ref_header("JS_DestroyScript") }}
</p><p>Free a compiled script that is no longer needed.
</p>
<h2 name="Syntax"> Syntax </h2>
<pre class="eval">void <strong>JS_DestroyScript</strong>(<a href="/en/JSRuntime" title="en/JSRuntime">JSContext</a> *cx, <a href="/en/JSScript" title="en/JSScript">JSScript</a> *script);
</pre>
<table class="fullwidth-table">
<tbody><tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><code>cx</code></td>
<td><code><a href="/en/JSRuntime" title="en/JSRuntime">JSContext</a> *</code></td>
<td>The context in which to destroy the script.
{{ Jsapi-requires-request() }}</td>
</tr>
<tr>
<td><code>script</code></td>
<td><code><a href="/en/JSScript" title="en/JSScript">JSScript</a> *</code></td>
<td>The script to destroy.</td>
</tr>
</tbody></table>
<h2 name="Description"> Description </h2>
<p><code>JS_DestroyScript</code> destroys the given compiled <code>script</code>, 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.
</p><p>Do not use <code>JS_DestroyScript</code> on a script if <code><a href="/en/JS_NewScriptObject" title="en/JS_NewScriptObject">JS_NewScriptObject</a></code> was successfully called on it.
</p><p>{{ LXRSearch("ident", "i", "JS_DestroyScript") }}
</p>
Revert to this revision