This repository has been archived by the owner. It is now read-only.

timers: recursive setImmediate causes constant memory growth #6487

Closed
trevnorris opened this Issue Nov 8, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@trevnorris

trevnorris commented Nov 8, 2013

Run the following script:

// Run with --expose-gc

(function runTest() {
  setImmediate(runTest);
}());


setInterval(function() {
  gc();
}, 100);

This will cause memory to grow rapidly. The heap stays pretty flat, but rss continues to grow. The longest I've allowed the script to run was up to 3GB memory usage.

Also got from running the test for a smaller segment of time:

$ sudo perf stat -e kmem:* ./node --expose_gc run.js

 Performance counter stats for './node --expose_gc run.js':

               113 kmem:kmalloc
               368 kmem:kmem_cache_alloc
                 0 kmem:kmalloc_node
                 5 kmem:kmem_cache_alloc_node
                39 kmem:kfree
               321 kmem:kmem_cache_free
            52,112 kmem:mm_page_free
            52,077 kmem:mm_page_free_batched
            52,102 kmem:mm_page_alloc
            51,527 kmem:mm_page_alloc_zone_locked
            51,553 kmem:mm_page_pcpu_drain
                 0 kmem:mm_page_alloc_extfrag

      27.075711167 seconds time elapsed
@trevnorris

This comment has been minimized.

Show comment
Hide comment
@trevnorris

trevnorris commented Nov 8, 2013

@tjfontaine

This comment has been minimized.

Show comment
Hide comment
@tjfontaine

tjfontaine Nov 10, 2013

This is representing the leak in question, the problem for master at the moment is that CheckImmediate is missing a HandleScope before calling MakeCallback

I'm considering extending my libclang code to lint the code base to verify all MakeCallbacks are predicated by HandleScope's

tjfontaine commented Nov 10, 2013

This is representing the leak in question, the problem for master at the moment is that CheckImmediate is missing a HandleScope before calling MakeCallback

I'm considering extending my libclang code to lint the code base to verify all MakeCallbacks are predicated by HandleScope's

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.