JS_ShutDown 编辑

Free all resources used by the JS engine, not associated with specific runtimes.

Syntax

void
JS_ShutDown(void);

Description

Destroys all free-standing resources allocated by SpiderMonkey, not associated with any JSRuntime, JSContext, or other structure.

This method should be called after all other JSAPI data has been properly cleaned up: every JSRuntime created with JS_NewRuntime must have been destroyed with JS_DestroyRuntime, every JSContext created with JS_NewContext must have been destroyed with JS_DestroyContext, and so on. Calling this method before all other resources have been destroyed has undefined behavior.

Failure to call this method, at present, has no adverse effects other than leaking memory. This may not always be the case; it's recommended that all embedders call this method when all other JSAPI operations have completed, to be future-proof.

It is currently not possible to initialize SpiderMonkey multiple times (that is, calling JS_Init, then other JSAPI methods, then JS_ShutDown in that order, then doing so again). This restriction may eventually be lifted.

Implementation note: This method has been used to clean up memory allocated by jsdtoa.cpp, memory allocated to implement Date.now() on Windows, and when the Internationalization API is enabled, memory internally allocated by ICU. Exact details about what this method cleans up will vary depending upon the version of SpiderMonkey in use.

See Also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:120 次

字数:6385

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文