I've been looking into some relatively large memory leaks in my applications recently, and a heap dump showed that I had a ton of events hanging around in EventEmitters.
It made sense once I thought about it -- I had been attaching to events cross window, expecting them to be cleaned up when the window closed. However, this certainly isn't the case. If a window hooks to an EventEmitter in another window and then closes -- the hooks remain, leaking memory from the dom of the closed window.
I was thinking that we should probably do one of two things:
1) Include a proxy class in node-webkit which overrides EventEmitter's on() function with an implementation that cleans up hooks when a window is closed (with an extra parameter to optionally leave the hooks in place).
or 2) Mention this in the documentation somewhere so people don't fall into the same trap.
Regards,
-- Michael