nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

Node Webkit 0.20.3 memory leak on windows 10/8

Open drown-zed opened this issue 9 years ago • 9 comments

Our application was updated from nw version v0.12.3 to v0.20.3. There seems to be a memory leakage when the application works in the background for about several days. Unfortunately this is a bit difficult to reproduce (not all windows computers produce the leakage), but the ones that do - make the ram consumption go up above 2gb until it crashes.

We tried to invoke the garbage collection manually, by exposing it and running it every hour, but it didn't help.

No memory leakage was detected when using v0.12.3.

The app basically uses webrtc, and websockets to communicate with a server and stream audio and video.

Older source code can be found here

Any ideas on how to fix it?

drown-zed avatar Mar 30 '17 10:03 drown-zed

Does the memory leak occur when there is no app? I'm facing a similar issue but mitigate it somewhat with changing my app code. But yes I think I can see a similar issue.

mscreenie avatar Mar 30 '17 18:03 mscreenie

With 0.21.3 I see sometimes that app hangs for about 5-7s. Actually, the whole system hangs. And this happens only when app in foreground. I will try to grab some logs next time I will get that. Also, a lot of our users report huge performance degradation with the new build, which is based on 0.21.* For me it feels more like upstream issue, but it needs some deeper investigation.

oaleynik avatar Mar 31 '17 01:03 oaleynik

It's better to check the JS heap first with devtools to make sure there is no leak in the application code.

rogerwang avatar Mar 31 '17 03:03 rogerwang

@mscreenie I'm not sure what you mean by no app. The problem for us is that when the application is launched and hidden in system tray, and remains so for a couple of days, on some computers it consumes huge ammounts of ram.

@rogerwang I can't reproduce the scenario on my computer, we'll need to build a version with devtools and ask our clients that encountered the issue to provide us with heap snapshot. I'll get back to you when we have something. Note that no users reported issues with memory leaks on v0.12.3, and only minor changes were made to the application when porting it to v0.20.3, therefore we don't think that it's a problem with the code

drown-zed avatar Mar 31 '17 10:03 drown-zed

We changed architecture in 0.13, so lots of internal things are different. It's hard to tell when compared with a 0.12 a

rogerwang avatar Mar 31 '17 10:03 rogerwang

@rogerwang Here's the heap snapshot provided by our client.

Heap-20170405T083417.heapsnapshot.zip

drown-zed avatar Apr 05 '17 08:04 drown-zed

Is this issue still reproduced on the latest nwjs build?

Christywl avatar Aug 18 '17 01:08 Christywl

We managed to pinpoint the memory leak to be a part of the script which was constantly checking if a certain server was reachable in browser context. However when exactly the same script was placed inside node context it was no longer leaking, which was odd.

drown-zed avatar Aug 26 '17 21:08 drown-zed

close this, please reopen if you meet this issue again.

Christywl avatar Nov 20 '17 01:11 Christywl