Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I programmatically know when I’m about to exceed the javascript heap size? [duplicate]

Tags:

javascript

I’m writing an application that instantiates many large array buffers, some of which are 5MB. I would like to know when I’m about to fill up the javascript heap, so I could activate a condition in my javascript that halts allocating the buffers. I’ve found that if I do exceed the heap size, the browser crashes for Chrome and Firefox.

Does W3C expose an interface for gauging javascript heap usage?

like image 774
John Hoffman Avatar asked Nov 12 '14 18:11

John Hoffman


1 Answers

Nope.

The JavaScript (ECMA-262 5.1 Edition) language specifies no such functionality.

like image 63
maerics Avatar answered Oct 04 '22 14:10

maerics