JSRuntime * JS_NewRuntime(uint32_t maxbytes, uint32_t maxNurseryBytes = JS::DefaultNurseryBytes, JSRuntime *parentRuntime = nullptr); JS_NewRuntime(uint32_t maxbytes, JSUseHelperThreads useHelperThreads, JSRuntime *parentRuntime = nullptr); // Deprecate since JSAPI 32
||Maximum number of allocated bytes after which garbage collection is run.|
||Nursery size in bytes.
||The topmost parent or
JS_NewRuntime before making any other API calls except
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.
JS_NewRuntime returns a pointer to the newly created runtime, which the caller must later destroy using
JS_DestroyRuntime. Otherwise it returns