Hi guys,
I have node application using
socket.io and motools server side,
problem is that I seem to be having memory leak and since is server
side I'm not really sure..
When a user connect a new instance of the class is created, see this
code bellow:
// initiate the server
require('./node_modules/mootools');
var io = require('./node_modules/
socket.io');
var Server = new Class({
Implements : [process.EventEmitter],
initialize: function(port)
{
this.serverPort = port;
this.server = null;
// let's connect
this.connect();
},
connect : function(){
// connect to socket io
this.server = io.listen(this.serverPort ,{ log: false });
client.on('disconnect', function() {
delete this.server;// doubt should i delete this object after user
has disconnected?
});
}
});
// initiate the server
var app = new Server(80);
My question is , is the class and it's object destroyed when user
disconnect or socket in this case, or we should manually destroy the
class and or objects.. (I am still in the process of learning more,
bear with me).
Should I delete this object on disconnect like so : delete
this.server;
How is the class and objects taking care in server side with motools?
Appreciate your help.