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_setgczeal/index.html | 141 +++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 files/ja/mozilla/projects/spidermonkey/jsapi_reference/js_setgczeal/index.html (limited to 'files/ja/mozilla/projects/spidermonkey/jsapi_reference/js_setgczeal') diff --git a/files/ja/mozilla/projects/spidermonkey/jsapi_reference/js_setgczeal/index.html b/files/ja/mozilla/projects/spidermonkey/jsapi_reference/js_setgczeal/index.html new file mode 100644 index 0000000000..0be58ee8dc --- /dev/null +++ b/files/ja/mozilla/projects/spidermonkey/jsapi_reference/js_setgczeal/index.html @@ -0,0 +1,141 @@ +--- +title: JS_SetGCZeal +slug: Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_SetGCZeal +tags: + - JSAPI Reference + - SpiderMonkey +translation_of: Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_SetGCZeal +--- +
{{SpiderMonkeySidebar("JSAPI")}}
+ +
{{jsapi_minversion_header("1.8")}}
+ +
+

GC の活動量、JSAPI アプリケーションの GC 関連のバグを見つけるのに役立つテストおよびデバッグ機能を有効にします。

+
+ +

構文

+ +
void
+JS_SetGCZeal(JSContext *cx, uint8_t zeal, uint32_t frequency);
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
cx{{jsapixref("JSRuntime", "JSContext *")}}A context. The GC zeal level of the associated {{jsapixref("JSRuntime")}} is set.
zealuint8_tThe desired level of garbage collection.
frequencyuint32_tWith some zeal levels, a GC is triggered every frequency allocations.
+ +

説明

+ +

JS_SetGCZeal sets the level of additional garbage collection to perform for a runtime, for the purpose of finding or reproducing bugs.

+ +

There are several different levels which have different functions:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Zeal levelDescription
0Normal amount of collection.  The default: no additional collections are performed.
1Collect when roots are added or removed.
2Collect when every frequency allocations.
3Collect on window paints.
4Verify pre write barriers between instructions.
5Verify pre write barriers between window paints.
6Verify stack rooting.
7Collect the nursery every frequency nursery allocations.
8Incremental GC in two slices: 1) mark roots 2) finish collection.
9Incremental GC in two slices: 1) mark all 2) new marking and finish.
10Incremental GC in multiple slices.
11Verify post write barriers between instructions.
12Verify post write barriers between paints.
13Check internal hashtables on minor GC.
14Perform a shrinking collection every frequency allocations.
+ +

With GC zeal enabled, GC-related crashes are much easier to reproduce (they happen more reliably) and debug (they happen sooner, closer to the source of the bug). The drawback is that GC zeal can cause JavaScript code to run extremely slowly.

+ +

Regularly running your test suite with GC zeal enabled at level 2 is a good practice.

+ +

This function is available only in DEBUG builds. To enable this function in an optimized build, define the macro JS_GC_ZEAL building SpiderMonkey.

+ +

(In a debug build of Gecko, you can also set the current GC zeal level using the javascript.options.gczeal preference.)

+ +

あわせて参照

+ + -- cgit v1.2.3-54-g00ecf