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

timers: recursive setImmediate causes constant memory growth #6487

trevnorris opened this issue Nov 8, 2013 · 2 comments


Copy link

@trevnorris trevnorris commented Nov 8, 2013

Run the following script:

// Run with --expose-gc

(function runTest() {

setInterval(function() {
}, 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

This comment has been minimized.

Copy link

@trevnorris trevnorris commented Nov 8, 2013


This comment has been minimized.

Copy link

@tjfontaine 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.
None yet
2 participants
You can’t perform that action at this time.