Socket.io memory doesn't drop of after clients disconnect
See original GitHub issueI use the most simple example
var app = require('http').createServer(handler)
var io = require('socket.io')(app);
var fs = require('fs');
app.listen(1994);
function handler(req, res) {
res.end('socket.io start')
}
io.on('connection', function(socket) {});
I use socket.io-client
, create a 4k connections
Then I closed the client, find memory doesn’t drop.
socket.on('disconnect', funtion() {
delete io.sockets[socket.id];
delete io.sockets.sockets[socket.id];
});
heapUsed
decreased slightly
rss
and heapTotal
without any change
SOS
The memory is cleaned up by the garbage collectors periodically.
But I waited for half an hour, still no change.
Can I only use global.gc()
to forcibly reclaim memory it?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:19 (3 by maintainers)
Top Results From Across the Web
Socket.io memory doesn't drop of after clients disconnect
I have memory leaks in my Socket.io 0.9.16 and Node 0.10.12 / 0.10.13 application. After connecting some clients the RSS memory increases but ......
Read more >Troubleshooting connection issues | Socket.IO
You are trying to reach a plain WebSocket server; The server is not reachable; The client is not compatible with the version of...
Read more >Memory usage | Socket.IO
The memory usage of the Socket.IO server heavily depends on the memory usage of the underlying WebSocket server implementation. The chart below ...
Read more >Performance tuning - Socket.IO
Here are some tips to improve the performance of your Socket.IO server:
Read more >Server options - Socket.IO
The server and the client values must match (unless you are using a ... Default value: require("socket.io-adapter") (in-memory adapter, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
lol was this fixed? i’m scared to use sockets.io because i keep hearing about this issue
That issue was closed automatically. Please check if your issue is fixed with the latest release, and reopen if needed (with a fiddle reproducing the issue if possible).