You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
It appears as though passing a function to the close method of a wrapped handle will result in leaked memory. I noticed this as a regression introduced in fb3ec32 with a TCPWrap handle, but it looks like it will occur for any HandleWrap object. It does not require the function to perform any action or return anything, an empty "function(){}" will still cause the leak.
It appears as though commenting out line 133 in src/handle_wrap.cc (the MakeCallback call) will not trigger this leak, although obviously this isn't an acceptable solution.
I have a testcase at https://gist.github.com/aschmitz/5743935 that requires the heapdump npm package installed, and can identify the leak (although it requires a working ab, and therefore may have trouble on OS X). It's likely not a super-minimal testcase, as it was written to track down the TCPWrap leak. If I'm doing my heapdump parsing correctly, there is an extra reference created to a handle scope for each connection made and closed.
Note that I am able to reproduce this issue on multiple Ubuntu 13.04 machines with the chris-lea PPA, and on my Ubuntu desktop with node compiled from the latest source. I believe it also reproduces on OS X, but I didn't spend much time on it there. I also tried briefly to reproduce the issue on SmartOS and was unable to do so, but I'm not sure why.
Hopefully the information above helps track down the leak. I would be happy to provide any further information, but I haven't been able to track down the exact reason for the leak, so I'm unable to provide a patch at the moment.