We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I tried to execute the following code, and observe the potential memory leak due to the decompress operation.
`
"use strict";
let path = require("path"); const decompress = require('decompress') let fs = require("fs");
const used = process.memoryUsage(); for (let key in used) { console.log(Memory: ${key} ${Math.round(used[key] / 1024 / 1024 * 100) / 100} MB); }
Memory: ${key} ${Math.round(used[key] / 1024 / 1024 * 100) / 100} MB
let source = path.join(__dirname + "/example.zip"); let output = path.join(__dirname,"output")
decompress("./example.zip", "dist").then((files) => { console.log("decompress completed") console.log("-------------------------------") const used = process.memoryUsage(); for (let key in used) { console.log(Memory: ${key} ${Math.round(used[key] / 1024 / 1024 * 100) / 100} MB); } global.gc(); console.log("after garbage collection") process.nextTick(function () { console.log("after tick") const used = process.memoryUsage(); for (let key in used) { console.log(Memory: ${key} ${Math.round(used[key] / 1024 / 1024 * 100) / 100} MB); } });
setTimeout(function () { console.log("after timeout") const used = process.memoryUsage(); for (let key in used) { console.log(`Memory: ${key} ${Math.round(used[key] / 1024 / 1024 * 100) / 100} MB`); } }, 5000);
}) `
Memory: rss 4275.02 MB Memory: heapTotal 12.23 MB Memory: heapUsed 5.39 MB Memory: external 3515.56 MB after garbage collection after tick Memory: rss 1764.59 MB Memory: heapTotal 12.23 MB Memory: heapUsed 5.38 MB Memory: external 1732.47 MB after timeout Memory: rss 1764.61 MB Memory: heapTotal 12.23 MB Memory: heapUsed 5.39 MB Memory: external 1732.47 MB
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I tried to execute the following code, and observe the potential memory leak due to the decompress operation.
`
"use strict";
let path = require("path");
const decompress = require('decompress')
let fs = require("fs");
const used = process.memoryUsage();
for (let key in used) {
console.log(
Memory: ${key} ${Math.round(used[key] / 1024 / 1024 * 100) / 100} MB
);}
let source = path.join(__dirname + "/example.zip");
let output = path.join(__dirname,"output")
decompress("./example.zip", "dist").then((files) => {
console.log("decompress completed")
console.log("-------------------------------")
const used = process.memoryUsage();
for (let key in used) {
console.log(
Memory: ${key} ${Math.round(used[key] / 1024 / 1024 * 100) / 100} MB
);}
global.gc();
console.log("after garbage collection")
process.nextTick(function () {
console.log("after tick")
const used = process.memoryUsage();
for (let key in used) {
console.log(
Memory: ${key} ${Math.round(used[key] / 1024 / 1024 * 100) / 100} MB
);}
});
})
`
node --expose-gc decompress.js
Memory: rss 25 MB
Memory: heapTotal 12.73 MB
Memory: heapUsed 6.64 MB
Memory: external 0.09 MB
decompress completed
Memory: rss 4275.02 MB
Memory: heapTotal 12.23 MB
Memory: heapUsed 5.39 MB
Memory: external 3515.56 MB
after garbage collection
after tick
Memory: rss 1764.59 MB
Memory: heapTotal 12.23 MB
Memory: heapUsed 5.38 MB
Memory: external 1732.47 MB
after timeout
Memory: rss 1764.61 MB
Memory: heapTotal 12.23 MB
Memory: heapUsed 5.39 MB
Memory: external 1732.47 MB
The text was updated successfully, but these errors were encountered: