You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const mustache = require("mustache");
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
async function run() {
await sleep(15000);
for (let i = 0; i < 20; i++) {
for (let j = 0; j < 15000; j++) {
// test line
mustache.render(`MemoryLeakMessage: ${i}:${j}`, null);
// this allows to interrupt the process and collect garbage
await sleep(0);
}
await sleep(5000);
}
}
void run();
Run code with inspector node --inspect index.js.
Open Chrome Inspector chrome://inspect/
Click on inspect link
Select Memory tab
Click on Take heap snapshot icon once a minute.
ACTUAL RESULT:
The memory heap linearly grows.
EXPECTED RESULT:
The memory heap should not grow.
The text was updated successfully, but these errors were encountered:
The issue was resolved by setting Mustache.templateCache = undefined;. Not sure what kind of caching mechanism is used, But it seems like it is not adequate. AS with this test the memory consumption can easily go over the memory limits of the application.
TEST STEPS:
npm init
npm install mustache@4.2.0
index.js
node --inspect index.js
.chrome://inspect/
inspect
linkMemory
tabTake heap snapshot
icon once a minute.ACTUAL RESULT:
The memory heap linearly grows.
EXPECTED RESULT:
The memory heap should not grow.
The text was updated successfully, but these errors were encountered: