Skip to content

Socket.io memory doesn't drop of after clients disconnect #2427

@94cstyles

Description

@94cstyles

I 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?

@nuclearace

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions