Consider the following two programs:
// works.js var buffer = new ArrayBuffer(16777216); var HEAP8 = new Int8Array(buffer);
and
// fails.js var HEAP8; var buffer = new ArrayBuffer(16777216); HEAP8 = new Int8Array(buffer);
Run node , then type .load works.js . Everything seems happy. Now exit node .
Launch node and enter .load fails.js .
On my machine boot, fails.js interactively leads to the node process to consume more than 1 GB of RAM and 100% CPU, and the final statement blocks the interpreter forever. works.js just starts and returns as expected.
Is there a good reason for the difference? Or should I write a bug report?
Curiously, running the script directly from the command line is fine:
node works.js # exits normally node fails.js # exits normally
UPDATE . I am using node 0.12.0 for OS X 10.9.5
source share