Closed
Description
- Version: v11.15.0
- Platform: Linux
Run the following script with node --inspect script.js
, connect a debugger with Google Chrome and instruct it to do a heap snapshot.
Edit: See my comment below for a better snippet.
function memoryLeak() {
return new Promise(() => {});
}
function loop() {
for (let i = 0; i < 10000; i++) {
memoryLeak();
}
setTimeout(loop, 0);
}
loop();
Roughly half of the time node will crash with "pure virtual method called".
That code actually causes a memory leak, but it will likely be annoying to debug if this isn't fixed first.