I have a problem with memory leaks (about 3-4MB each even cycle of this code) on node.js + opencv. I think readImage() method causes that memory issue.
How to free unused memory? I've tried release() function, but it causes segmentation error.
Is anyone already encountered this problem?
Please help. I'm stucked.
download = wget.download(src, path + filename, options);
download.on('end', function(output) {
cv.readImage(path + filename, function(err, im) {
if (err) throw err;
if (im.width() < 1 || im.height() < 1) throw new Error('Image has no size');
im.detectObject('data/cascade.xml', {}, function(err, cars) {
if (err) throw err;
for (var i = 0; i < cars.length; i++) {
car = cars[i];
im.rectangle([car.x, car.y], [car.width, car.height], [0, 255, 0], 2);
}
im.save(path + '_' + filename);
});
});
});
↧