summaryrefslogtreecommitdiff
path: root/test/pummel/test-vm-memleak.js
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2013-09-14 18:29:24 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2013-09-15 00:56:11 +0400
commit59a075e108c7ffcee87252255e60530cd15a8adb (patch)
tree9a6c9fc5387f3ba142f065d6cc81227bc62f9a11 /test/pummel/test-vm-memleak.js
parentf31037ddfefdc8fab94980cd16a525827ba19abf (diff)
downloadandroid-node-v8-59a075e108c7ffcee87252255e60530cd15a8adb.tar.gz
android-node-v8-59a075e108c7ffcee87252255e60530cd15a8adb.tar.bz2
android-node-v8-59a075e108c7ffcee87252255e60530cd15a8adb.zip
contextify: fix ContextifyContext leak
Apparently, context->Global() won't be destroyed if the context itself isn't marked as weak and independent. Also, the weakness flag should be cleared once the weak callback is executed, otherwise we'll get crashes in Debug builds. fix #6115 and #6201
Diffstat (limited to 'test/pummel/test-vm-memleak.js')
-rw-r--r--test/pummel/test-vm-memleak.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/pummel/test-vm-memleak.js b/test/pummel/test-vm-memleak.js
index e0b087d81b..2abedc297b 100644
--- a/test/pummel/test-vm-memleak.js
+++ b/test/pummel/test-vm-memleak.js
@@ -38,9 +38,16 @@ var interval = setInterval(function() {
if (Date.now() - start > 5 * 1000) {
// wait 10 seconds.
clearInterval(interval);
+
+ testContextLeak();
}
}, 1);
+function testContextLeak() {
+ for (var i = 0; i < 1000; i++)
+ require('vm').createContext({});
+}
+
process.on('exit', function() {
console.error('max mem: %dmb', Math.round(maxMem / (1024 * 1024)));
// make sure we stay below 100mb