Memory leak of sorts
See original GitHub issueHello, infinitely recursing setTimeout
calls will increase the memory usage forever.
Reproduction code: (node 8.9.1)
require('trace');
const memwatch = require('memwatch-ng');
memwatch.on('leak', info => {
console.log('Memory leak detected.');
console.log(info);
});
function loop (func) {
const execute = () => {
func().then(() => {
setTimeout(execute, 0);
});
};
execute();
}
console.log(`Stack trace limit is: ${Error.stackTraceLimit}`);
loop(async () => {
await new Promise(resolve => setTimeout(resolve, 0));
});
I don’t suppose there’s a way for trace
to limit its memory usage? I understand that I’m essentially creating an infinitely long stack trace, but this code does work without trace enabled.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Memory leak - Wikipedia
In computer science, a memory leak is a type of resource leak that occurs when a computer program incorrectly manages memory allocations in...
Read more >Three kinds of memory leaks - Made of Bugs - Nelson Elhage
Made of Bugs · Three kinds of memory leaks · Type (1): Unreachable allocations ︎ · Type (2): Unexpectedly long-lived allocations ︎ ·...
Read more >4 Types of Memory Leaks in JavaScript and How to Get Rid Of ...
4 Types of Memory Leaks in JavaScript and How to Get Rid Of Them · 1. Accidental global variables · 2. Forgotten timers...
Read more >How to Detect Memory Leaks in Java: Causes, Types, & Tools
Common causes for these memory leaks are: Excessive session objects. Insertion without deletion into Collection objects.
Read more >The seventeen types of memory leak | Software Verify
Memory leaks fall into one of several categories. · #1 Leaked temporary workspace. · #2 Leaked data member · #3 Leaked class static...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@foray1010 I’ve fixed that memory leak in PR #40
Still leaking, because this PR wasn’t merged. This project seems to be dead.