-
Notifications
You must be signed in to change notification settings - Fork 24
napi #70
Conversation
Seems like there is a memory leak somewhere. I was Hoping Node 10.2.0 would fix it as it fixes a memory leak with napi according to its changelog, but that does not seem to be the case. |
51c2cb7
to
347f05e
Compare
@addaleax @gabrielschulhof Perf and memory looks good, but it does look like there might be a small memory leak somewhere. It does look like we make the right calls to I run a benchmark using a tiny server + wrk: const fs = require('fs');
const http = require('http');
const iltorb = require('.');
const filename = 'lorem_ipsum.txt';
function onRequest(req, res) {
res.setHeader('Content-Encoding', 'br');
fs.createReadStream(filename).pipe(iltorb.compressStream()).pipe(res);
}
http.createServer(onRequest).listen(3000);
|
@MayhemYDG can you list the steps need to recreate, starting from nothing? ie what all needs to be installed etc. |
@mhdawson I think I fixed the remaining issue, I needed to manually delete the object I was wrapping in the destructor. If you want to try and see for yourself if there are any remaining memory leaks:
const fs = require('fs');
const http = require('http');
const iltorb = require('.');
const buf = fs.readFileSync('test/fixtures/data.txt');
function onRequest(req, res) {
res.setHeader('Content-Encoding', 'br');
const stream = iltorb.compressStream();
stream.pipe(res);
stream.end(buf);
}
http.createServer(onRequest).listen(3000);
On my machine the process typically stabilizes around 40-45MB when idle. |
If you believe its good, then I'm ok. We have looks of work to do on the N-API/node-addon-api front so unless there is an issue I'll concentrate on that other work. |
Still needs more work on error handling and memory management.