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.

JS_NewRuntime

Initializes the JavaScript runtime.

Syntax

JSRuntime * JS_NewRuntime(uint32 maxbytes);
Name Type Description
maxbytes uint32 Maximum number of allocated bytes after which garbage collection is run.

Description

JS_NewRuntime initializes the JavaScript runtime environment. Call JS_NewRuntime before making any other API calls. JS_NewRuntime allocates memory for the JSRuntime and initializes certain internal runtime structures. maxbytes specifies the number of allocated bytes after which garbage collection is run.

Generally speaking, most applications need only one JSRuntime. In a JS_THREADSAFE build, each runtime is capable of handling multiple execution threads, using one JSContext per thread, sharing the same JSRuntime. You only need multiple runtimes if your application requires completely separate JS engines that cannot share values, objects, and functions.

On success, JS_NewRuntime returns a pointer to the newly created runtime, which the caller must later destroy using JS_DestroyRuntime. Otherwise it returns NULL.

Notes

Ordinarily, JS_NewRuntime should be the first JSAPI call in an application, and JS_DestroyRuntime and JS_ShutDown should be the last ones.

MXR ID Search for JS_NewRuntime

文档标签和贡献者

 此页面的贡献者: ziyunfei, Andyyard
 最后编辑者: ziyunfei,