2015-05-19 19:00:06 +08:00
|
|
|
'use strict';
|
2016-07-19 04:33:42 +08:00
|
|
|
const common = require('../common');
|
2014-01-10 05:33:51 +08:00
|
|
|
var assert = require('assert');
|
|
|
|
|
2015-07-29 19:48:04 +08:00
|
|
|
if (common.isWindows) {
|
2016-05-12 03:34:52 +08:00
|
|
|
common.skip('no RLIMIT_NOFILE on Windows');
|
2015-07-07 23:25:55 +08:00
|
|
|
return;
|
2014-01-10 05:33:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
var exec = require('child_process').exec;
|
|
|
|
|
|
|
|
var cmdline = 'ulimit -c 0; ' + process.execPath;
|
2014-10-08 18:34:51 +08:00
|
|
|
cmdline += ' --max-old-space-size=4 --max-semi-space-size=1';
|
2014-01-14 06:56:12 +08:00
|
|
|
cmdline += ' -e "a = []; for (i = 0; i < 1e9; i++) { a.push({}) }"';
|
2014-01-10 05:33:51 +08:00
|
|
|
|
|
|
|
exec(cmdline, function(err, stdout, stderr) {
|
2014-01-28 10:05:39 +08:00
|
|
|
if (!err) {
|
|
|
|
console.log(stdout);
|
|
|
|
console.log(stderr);
|
|
|
|
assert(false, 'this test should fail');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-01-28 10:27:10 +08:00
|
|
|
if (err.code !== 134 && err.signal !== 'SIGABRT') {
|
2014-01-28 10:05:39 +08:00
|
|
|
console.log(stdout);
|
|
|
|
console.log(stderr);
|
|
|
|
console.log(err);
|
|
|
|
assert(false, err);
|
|
|
|
}
|
2014-01-10 05:33:51 +08:00
|
|
|
});
|