-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak #1093
Comments
Though looks like in 0.8.12/0.9.11 it does not. |
Today it does not leak even in 0.8.14/0.9.10 . What was that yesterday ?! Closing this |
In fact it leaks that way: var
io = require('socket.io').listen(3000,{
transports:[
'websocket',
'htmlfile',
'xhr-polling',
'jsonp-polling'
]
});
io.sockets.on('connection',function(socket){
socket.on('ping',function(data,cb){
socket.emit('pong',function(){ });
if(cb) cb();
});
}); Client <head>
<script src="http://localhost:3000/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost:3000');
function ping(data,cb){
socket.emit('ping',function(){
});
if(cb) cb();
}
socket.on('pong',ping);
ping();
</script> So with ack callbacks it leaks. And I can not find in source where |
Does your supplied fix in #1094 resolve this issue? |
No it does not. |
But with that variant it does: var
io = require('socket.io').listen(3000,{
transports:[
'websocket',
'htmlfile',
'xhr-polling',
'jsonp-polling'
]
});
io.sockets.on('connection',function(socket){
socket.on('ping',function(cb){
if(cb) cb();
socket.emit('pong',function(err){ });
});
}); client <head>
<script src="http://localhost:3000/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost:3000');
function ping(cb){
socket.emit('ping',function(){
});
if(cb) cb();
}
socket.on('pong',ping);
ping();
</script> the problem is in client if you pass callback with no arguments on server So somebody should decide: either and |
Very simple code. SIngle connection eats memory.
Node 0.8.14. Socket..io 0.9.10
Server:
Client:
Tested under Windows. Run server, run client - see in task manager how node.exe eats memory.
Comment transports in server. Websocket and jsonp-polling leak. xhr-polling - does not.
The text was updated successfully, but these errors were encountered: