`free` operator

Shawn Steele Shawn.Steele at microsoft.com
Thu Oct 25 19:14:24 PDT 2012

> On the contrary, "TypeError: Cannot read property 'prop' of undefined", with a stack trace, is WAY easier to track down than "The RSS on my server gradually rises, until the operating system kills it, which happens about every 4 hours."

I'm not so sure.  Now you know where you're using it that you didn't think you were, but you've now got something freeing it that's not supposed to.  So you might have to check each of those "free"s to see where they weren't supposed to free, possibly without much context at the other end.  You've traded one problem for a different one.  

Sure, in simple cases you might be more easily able to fix both ends, but I'm not sure that it's wise to build a debugging workaround into the standard, even maybe making it's way into best practice.  You're trying to fix the garbage collection by working around where the real bug is.  At some point you defeat the purpose of the garbage collection.

Seems to me like something for a debugger.  I could also see a developer trying the "delete-every-property" thing as a temporary debugging technique.


More information about the es-discuss mailing list