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.
This is very interesting, but from the first sight looks like a v8 bug. Can you please report your issue there: http://code.google.com/p/v8/issues/entry and repost link to it this github issue (so we will be able to track it)?
Ok thanks @indutny. I filed an issue for V8:
This one does seem like a genuine V8 bug. Even with a "cleaned up" version of your test gist, I get the same behavior.
@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.