Closed giggsey closed 10 years ago
Hi, How does your client look?
I can't remember exactly, but it's similar to:
socket = io.connect("http://" + monitorip + ":8081" );
socket.on('connect', function(){ $("#status").html('Connected'); $("#status").css('color','green'); })
socket.on('message', function(ev){
$.each(ev,function(i,e) {
console.log(e);
});
socket.on('disconnect', function(){ $("#status").html('Disconnected'); $("#status").css('color','red'); })
@giggsey: please, try io.sockets.json.send( { test: 0, testing: 1, payload: 'lenghtystiiiiiing-4096-random-octets-to-bite-caching' });
What is the amount of the leak then? TIA
@dvv: I've added a random() to a random variable in the json, and set it to take a heap snapshot every second. Not sure if my JavaScript function is good enough, but it is generating random crap.
When it was giving 4096 characters, memory was increasing by around 32kb/s. When I reduce it to 1 character, it increases by just under 500/s.
Both times, the count column, is increasing by +4, which sort of makes sense, as it's sending 4 messages per second.
setInterval(function() {
profiler.takeSnapshot('snappy');
},1000);
function random()
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < 4096; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
Thanks! So it do depend on the size of message being sent, i suppose. This makes me think we don't cleanup sent messages.
What transport do you use (websocket, flashsocket, xhr-polling, ...)? Couldn't you make the same tests for another transport?
@dvv: I'm using websocket (Chrome stable), but also tried it using xhr-polling + jsonp-polling, both of which leak by the same amount. I couldn't get the htmlfile working, so I don't know about that.
I think this issue is resolved with 7257e1ec3688287e752f (possibly before).
Edit: It still leaks memory in release 0.7.6.
7257e1e seems to still be leaking memory. I had my full version running for roughly 23 hours, and it had used 300-400MB RES.
Does it still leak memory ?
@giggsey still relevant in the latest version?
No longer using socket.io.
Using engine.io with another project in front.
This code seems to be leaking memory in String.Array (found via v8-profiler + node-inspector).
Forgot to mention:
Only seems to happen: