diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-01-10 18:06:34 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-01-10 23:45:49 +0100 |
commit | 7e648da834faa7b837806cd5e214582b0359a03a (patch) | |
tree | 94f53860decc4bf85bfc32c6087e7c9784111e39 /test | |
parent | b57e9a99739c634053daa04667674090c07e1938 (diff) | |
download | node-new-7e648da834faa7b837806cd5e214582b0359a03a.tar.gz |
test: fix bad assumption in pummel/test-vm-memleak
pummel/test-vm-memleak is an old test that assumes the fairly
aggressive heuristics that were common with the old collector.
The current garbage collector has a more laissez-faire attitude.
Put an upper limit on the size of the old space and update the
test's expectations.
PR-URL: https://github.com/iojs/io.js/pull/280
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/pummel/test-vm-memleak.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/pummel/test-vm-memleak.js b/test/pummel/test-vm-memleak.js index 2abedc297b..62ab6eb95a 100644 --- a/test/pummel/test-vm-memleak.js +++ b/test/pummel/test-vm-memleak.js @@ -19,12 +19,19 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. +// Flags: --max_old_space_size=32 + var assert = require('assert'); var common = require('../common'); var start = Date.now(); var maxMem = 0; +var ok = process.execArgv.some(function(arg) { + return arg === '--max_old_space_size=32'; +}); +assert(ok, 'Run this test with --max_old_space_size=32.'); + var interval = setInterval(function() { try { require('vm').runInNewContext('throw 1;'); @@ -34,7 +41,6 @@ var interval = setInterval(function() { var rss = process.memoryUsage().rss; maxMem = Math.max(rss, maxMem); - if (Date.now() - start > 5 * 1000) { // wait 10 seconds. clearInterval(interval); @@ -50,6 +56,5 @@ function testContextLeak() { process.on('exit', function() { console.error('max mem: %dmb', Math.round(maxMem / (1024 * 1024))); - // make sure we stay below 100mb - assert.ok(maxMem < 50 * 1024 * 1024); + assert.ok(maxMem < 64 * 1024 * 1024); }); |