JS_ReportOutOfMemory 编辑
Reports a memory allocation error.
Syntax
void
JS_ReportOutOfMemory(JSContext *cx);
void
JS_ReportAllocationOverflow(JSContext *cx); // Added in SpiderMonkey 1.8
Name | Type | Description |
---|---|---|
cx | JSContext * | The context in which to report the error. |
Description
Call JS_ReportOutOfMemory
to report that an operation failed because the system is out of memory. When the JavaScript engine tries to allocate memory and allocation fails, it reports an error as though by calling this function.
Call JS_ReportAllocationOverflow
if an operation fails because it tries to use more memory (or more of some other resource) than the application is designed to handle. When a script tries to grow an array beyond 230-1 elements, for example, or concatenate strings such that the result is more than 229-1 characters long, the JavaScript engine reports an error as though by calling this function.
See JS_ReportError
and JS_SetErrorReporter
for more information about error handling in the JSAPI.
See Also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论