JS_GC 编辑
Performs garbage collection in the JS memory pool.
Syntax
void
JS_GC(JSContext *cx); // Added in SpiderMonkey 52
void
JS_GC(JSRuntime *rt); // Obsolete since JSAPI 50
void
JS_GC(JSContext *cx); // Obsolete since JSAPI 14
Name | Type | Description |
---|---|---|
cx | JSContext * | The context to for which to perform garbage collection. Added in SpiderMonkey 52 |
rt | JSRuntime * | The runtime to for which to perform garbage collection. Obsolete since JSAPI 50 |
Description
JS_GC
performs garbage collection of JS objects, strings and other internal data structures that are no longer reachable in the specified context or runtime. Garbage collection frees memory so that it can be reused by the system.
When your scripts create many objects, you may want to call JS_GC
directly in your code, particularly when a script terminates or when the application has idle time. To perform garbage collection only if needed, call JS_MaybeGC
instead.
Use JS_SetGCCallback
to add hooks that are called during garbage collection.
See Also
- MXR ID Search for
JS_GC
JS_MaybeGC
- bug 737364 -- Changed to
JSRuntime
- bug 1283855 -- Changed to
JSContext
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论