Garbage collector sometimes fails on objects with Object.defineProperty (memleak?) #3092

nicokaiser opened this Issue Apr 12, 2012 · 6 comments


None yet

4 participants


When I use Object.defineProperty in an Object's constructor, the object is sometimes never garbage collected.

This script creates 1,000 objects that emit close after 2 seconds. Using node-weak I track how many of them are garbage collected (you can comment out the gc() call and wait if you don't want to --expose_gc).

When all objects have emitted close there are still some of them in the memory, not collected by the GC (the count varies between 8 and 15, so it's not predictable).

This works perfectly on Node 0.4, but fails on 0.6 and 0.7.

indutny commented Apr 12, 2012

This is very interesting, but from the first sight looks like a v8 bug. Can you please report your issue there: and repost link to it this github issue (so we will be able to track it)?


This one does seem like a genuine V8 bug. Even with a "cleaned up" version of your test gist, I get the same behavior.

indutny commented Apr 14, 2012

@TooTallNate indeed, it's accepted by v8 team. Just keep this issue open, because we'll need to ensure that that patch will be merged back to node.


@indutny I understand, I was basically just confirming that it's not misuse of node-weak like #3097 was.


going to assume this was fixed by now, and seemed not to be a node bug specifically anyways.

@trevnorris trevnorris closed this Jul 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment