summaryrefslogtreecommitdiff
path: root/test/pummel/test-vm-memleak.js
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-01-10 18:06:34 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2015-01-10 23:45:49 +0100
commit7e648da834faa7b837806cd5e214582b0359a03a (patch)
tree94f53860decc4bf85bfc32c6087e7c9784111e39 /test/pummel/test-vm-memleak.js
parentb57e9a99739c634053daa04667674090c07e1938 (diff)
downloadandroid-node-v8-7e648da834faa7b837806cd5e214582b0359a03a.tar.gz
android-node-v8-7e648da834faa7b837806cd5e214582b0359a03a.tar.bz2
android-node-v8-7e648da834faa7b837806cd5e214582b0359a03a.zip
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/pummel/test-vm-memleak.js')
-rw-r--r--test/pummel/test-vm-memleak.js11
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);
});