Socket.io memory does not stop after disconnecting clients

var server = require('socket.io').listen(1781); server.set('log level', 1); setInterval(function() { console.log(process.memoryUsage()); }, 60000); 

I have a memory leak in a Socket.io 0.9.16 application and Node 0.10.12 / 0.10.13. After connecting some clients, the RSS memory increases, but after it is disconnected, the memory does not drop. I disabled the application to the top code to rule out any of my errors. After connecting 1000 clients, the process takes 65 MB (initially it required ~ 15 MB), and after disconnecting all clients, the memory remains high. Any help?

All articles / answers read related to earlier versions of Node or socket.io. I desperately want to find a solution on this.

+4
source share
2 answers

I used nodetime to track memory usage, and it looks like it had a memory leak. After the timeout, memory consumption was stable.

0
source

I had similar problems with socket.io. It seems that when a client connects, it is never removed from socket.io.

You can debug the value of SocketIoServer.sockets.sockets. This is an array containing all connected (and disconnected sockets). Perhaps where there is a memory leak.

Also, I just saw that socket.io released version 1.0. You can try and see if it resolved this problem.

0
source

Source: https://habr.com/ru/post/1492352/


All Articles