question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setIntervall - memory permanently increasing

See original GitHub issue

Hello, 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:closed
  • Created 8 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Krb686commented, Sep 7, 2016

My attention has been brought back to this. I’m running some memory leak tests now…

1reaction
3mcdcommented, Jun 19, 2017

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found