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 enter .load works.js
. Everything seems happy. Now exit node
.
Run node
again and enter .load fails.js
.
On my machine loading fails.js
interactively leads the node
process to consume over 1GB of RAM and 100% CPU, and the final statement blocks the interpreter forever. works.js
just runs and returns as expected.
Is there some good reason for the difference? Or should I be writing a bug report?
Curiously enough, running either script directly from the command line works fine:
node works.js # exits normally
node fails.js # exits normally
UPDATE: I'm using node 0.12.0 on OS X 10.9.5
Is there some good reason for the difference? Or should I be writing a bug report?
I doubt there is a good reason for this, you should file a bug.