From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../jsapi_reference/js_newruntime/index.html | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 files/ja/mozilla/projects/spidermonkey/jsapi_reference/js_newruntime/index.html (limited to 'files/ja/mozilla/projects/spidermonkey/jsapi_reference/js_newruntime/index.html') diff --git a/files/ja/mozilla/projects/spidermonkey/jsapi_reference/js_newruntime/index.html b/files/ja/mozilla/projects/spidermonkey/jsapi_reference/js_newruntime/index.html new file mode 100644 index 0000000000..5db8397cb9 --- /dev/null +++ b/files/ja/mozilla/projects/spidermonkey/jsapi_reference/js_newruntime/index.html @@ -0,0 +1,52 @@ +--- +title: JS NewRuntime +slug: Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_NewRuntime +tags: + - JSAPI Reference + - SpiderMonkey +translation_of: Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_NewRuntime +--- +

+

+ +

JavaScript ランタイムの初期化を行います。 {{ 英語版章題("Syntax") }}

+ +

構文

+ +
JSRuntime * JS_NewRuntime(uint32 maxbytes);
+
+ + + + + + + + + + + + + + +
NameTypeDescription
maxbytesuint32ガベージコレクション動作後の最大メモリ使用量Maximum number of allocated bytes after which garbage collection is run.
+ +

{{ 英語版章題("Description") }}

+ +

説明

+ +

JS_NewRuntimeは、JavaScriptランタイム環境の初期化を行う関数です。他のJSAPI関数を使うには前もって必ずJS_NewRuntimeを呼ぶことになります。JS_NewRuntimeは、JSRuntimeに用いるメモリ領域を確保し、ランタイム内の初期化を行います。引数maxbytesで、ガベージコレクションが動作した後の最大メモリ使用量を指定します。 <code>JS_NewRuntime</code> initializes the JavaScript runtime environment. Call <code>JS_NewRuntime</code> before making any other API calls. <code>JS_NewRuntime</code> allocates memory for the <code>JSRuntime</code> and initializes certain internal runtime structures. <code>maxbytes</code> specifies the number of allocated bytes after which garbage collection is run.

+ +

一般的に、ほとんどのアプリケーションで必要とされるJSRuntimeは一つのみです。JS_THREADSAFEを有効にしたビルドでは、JSRuntimeを共有するJSContextを各スレッドごとに一つ用意することで、複数スレッドからランタイムにアクセスすることが可能です。複数のランタイムが必要になるのは、JavaScriptの値やオブジェクト、関数をスレッド間で完全に分離させたいときだけです。 Generally speaking, most applications need only one <code>JSRuntime</code>. In a <code>JS_THREADSAFE</code> build, each runtime is capable of handling multiple execution threads, using one <code>JSContext</code> per thread, sharing the same <code>JSRuntime</code>. You only need multiple runtimes if your application requires completely separate JS engines that cannot share values, objects, and functions.

+ +

JS_NewRuntimeが成功したときは、新たに生成されたランタイムへのポインタがその返り値となり、失敗した時はNULLを返します。JS_NewRuntimeの呼び出し元は、後で必ずそのランタイムをJS_DestroyRuntimeを用いて破棄しなければなりません。 On success, <code>JS_NewRuntime</code> returns a pointer to the newly created runtime, which the caller must later destroy using <code>JS_DestroyRuntime</code>. Otherwise it returns <code>NULL</code>. {{ 英語版章題("Notes") }}

+ +

注記

+ +

一般的には、JS_NewRuntimeはアプリケーション内でまず最初に実行し、JS_DestroyRuntimeJS_ShutDownを終了時に呼ぶことになります。 Ordinarily, <code>JS_NewRuntime</code> should be the first JSAPI call in an application, and <code>JS_DestroyRuntime</code> and <code>JS_ShutDown</code> should be the last ones.

+ +

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

+ +

{{ languages( { "en": "en/JS_NewRuntime" } ) }}

-- cgit v1.2.3-54-g00ecf