setIntervall - memory permanently increasing
See original GitHub issueHello, I was trying to use your library for a game loop. Installation and including works like a charm but setIntervall seems to block GC. Even when I am just doing this:
var NanoTimer = require('nanotimer');
var timerA = new NanoTimer();
var task = function() {
console.log(Date.now());
};
timerA.setInterval(task, null, 1000/25+'m', function(err) {
if(err) {
//error
}
});
The memory used will increase slowly and it never drops to a lower value again. That’s why I am assuming GC won’t run. Am I missing sthg.?
P.S. I am on Ubuntu 14 with node 0.12.7
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Improvement: Is there a way to avoid memory leak in a ...
I have a setInterval function with no clearInterval , it is for an ... would this cause a memory leak? or is there...
Read more >The memory usage keeps growing with setInterval(). #2640
ElementUI version 1.1.6 OS/Browers version Chrome 55 Vue version 2.1.10 Reproduction Link http://codepen.io/lumicompell/pen/WRzNxP Steps to ...
Read more >Window setInterval() Method - W3Schools
Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant ......
Read more >Avoiding Memory Leaks in Node.js: Best Practices for ...
Timers & Events: The use of setTimeout, setInterval, Observers and event listeners can cause memory leaks when heavy object references are kept ...
Read more >How can Forgotten timers or callbacks cause memory leaks in ...
1.To avoid leakage provide references inside setInterval()/setTimeout() such that functions are needed to be executed before they can be garbage ...
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 Free
Top 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
My attention has been brought back to this. I’m running some memory leak tests now…
@Krb686 I did a review of a few other potential candidates for memory leaks in my project and the memory leak I was experiencing is not due to nanotimer but a separate library 😃.
It seems that the increases in memory usage that I noticed when swapping in nanotimer were being deallocated correctly, and I mistakenly identified nanotimer as being the cause of the issue. Sorry about that, and thanks for sharing your test results.