-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.4.8
-
Component/s: None
-
Labels:
-
Environment:ubuntu
-
Empty show more show less
With this code I get a memory leak with the node-memwatch module, but I don't get the leak when I comment out the insert part
rl.on('line', function(line) {
line =line.toString();
var point = line.indexOf("type.object.type");
if(point>=0){
if (line.indexOf("common.topic",point+16)>=0) {
rl.pause();
mids++;
var pointmid = line.indexOf(">");
var mid = line.slice(line.lastIndexOf("/",pointmid)+1,pointmid)
client.set([mid,1], function redis_set(err, reply) {
if(err) console.log(err);
db.collection('objects').insert(
{"mid":mid},
{w:1},function(e, result)
{ //part that produces leak if(typeof e!= "undefined" && e!==null) logger("../logs/mongoerror",JSON.stringify(e)+"\n"); if(result===null) logger("../logs/notsaved",mid+"\n"); rl.resume(); });
});
}
}
})
memwatch output:
{ start: Sun Aug 10 2014 10:44:38 GMT+0000 (UTC), end: Sun Aug 10 2014 10:44:47 GMT+0000 (UTC), growth: 11385384, reason: 'heap growth over 5 consecutive GCs (9s) - -2147483648 bytes/hr' }