blob: be77b35a40ded9165609726f3ca85620bb6f959c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
---
title: JS DestroyContext
slug: Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_DestroyContext
tags:
- JSAPI Reference
- SpiderMonkey
translation_of: Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_DestroyContext
---
<p>
</p><div class="breadcrumbs"><a href="/ja" title="ja">メインページ</a> » <a href="/ja/docs/SpiderMonkey" title="SpiderMonkey">SpiderMonkey</a> »
<a href="/ja/docs/SpiderMonkey/JSAPI_Reference" title="JSAPI_Reference">JSAPI リファレンス</a> »
<code>JS_DestroyContext</code></div>
<p></p>
<p><code>JSContext</code>を解放します。</p>
<h2 id=".E6.A7.8B.E6.96.87" name=".E6.A7.8B.E6.96.87">構文</h2>
<pre class="eval">void <strong>JS_DestroyContext</strong>(<a href="/ja/JSRuntime" title="ja/JSRuntime">JSContext</a> *cx);
void <strong>JS_DestroyContextNoGC</strong>(<a href="/ja/JSRuntime" title="ja/JSRuntime">JSContext</a> *cx);
void <strong>JS_DestroyContextMaybeGC</strong>(<a href="/ja/JSRuntime" title="ja/JSRuntime">JSContext</a> *cx);
</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="/ja/JSRuntime" title="ja/JSRuntime">JSContext</a> *</code></td>
<td>解放するコンテキスト</td>
</tr>
</tbody>
</table>
<h2 id=".E8.A7.A3.E8.AA.AC" name=".E8.A7.A3.E8.AA.AC">解説</h2>
<p>これらの関数はコンテキスト<code>cx</code>を解放します。それに加え、<code>JS_DestroyContext</code>は実行し、<code>cx</code>の<a href="/ja/JS_GetGlobalObject" title="ja/JS_GetGlobalObject">グローバルオブジェクト</a>が利用したメモリを回収するためにガベージコレクションを実行します。<code>JS_DestroyContextNoGC</code>はガベージコレクションを実行しません。<code>JS_DestroyContextMaybeGC</code>では、JavaScriptエンジンが十分なメモリ領域を解放できる可能性を判断し、ガベージコレクションを実行するか否かを判断します。 <span class="comment">These functions destroy a context, <code>cx</code>. <code>JS_DestroyContext</code> additionally performs garbage collection to reclaim any memory that was being used by <code>cx</code>'s <a href="/ja/JS_GetGlobalObject">global object</a>. <code>JS_DestroyContextNoGC</code> does not perform garbage collection. <code>JS_DestroyContextMaybeGC</code> 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.</span></p>
<p><code><a href="/ja/JS_THREADSAFE" title="ja/JS_THREADSAFE">JS_THREADSAFE</a></code>を有効にしたビルドでは、<code>cx</code>のrequest内でこの関数を呼ばないでください。</p>
<p><code><a href="/ja/JS_SetContextCallback" title="ja/JS_SetContextCallback">JS_SetContextCallback</a></code>が以前に実行された場合は、そこで設定したコールバック関数が実行されます。 <span class="comment">In a <code><a href="/ja/JS_THREADSAFE">JS_THREADSAFE</a></code> build, the caller must '''not''' be in a request on <code>cx</code>. If <code><a href="/ja/JS_SetContextCallback">JS_SetContextCallback</a></code> has been called, this calls the callback.</span></p>
<p>{{ LXRSearch("ident", "i", "JS_DestroyContext") }}</p>
<p>{{ languages( { "en": "en/JS_DestroyContext" } ) }}</p>
|