memory leak when instance is created inside a function.
See original GitHub issueHi, I just noticed that when you create debug instance in a function, it is starting to leak the memory without freeing. Here’s how you can reproduce it:
const debug = require('debug');
const loop = () => {
const d = debug('namespace:that:i:want:for:this:function');
d('hello world');
setImmediate(loop);
};
loop();
If you run this and look at memory, it is leaking a lot without freeing them. also does not matter if I set environment to DEBUG=* or not, it still leaks. Any thoughts?
EDIT: tested on 3.1.1 and 4.1.1 as well (had 3.1.1 version and then I upgraded to latest one to check if it was fixed).
EDIT2: using node version 10.13 and Windows 10 x64.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:22 (13 by maintainers)
Top Results From Across the Web
memory leak when instance is created inside a function. #678
Hi, I just noticed that when you create debug instance in a function, it is starting to leak the memory without freeing.
Read more >Does calling a function that creates object cause memory leak?
Yes, it will create 10 new objects if called 10 times. No, this doesn't cause a memory leak1. One of the main points...
Read more >Causes of Memory Leaks in JavaScript and How to Avoid Them
In this article, we will explore programming patterns that cause memory leaks in JavaScript and explain how to improve memory management.
Read more >How to escape from memory leaks in JavaScript
In simple words, a memory leak is an allocated piece of memory that the JavaScript engine is unable to reclaim. The JavaScript engine...
Read more >Understanding Memory Leaks in Nodejs | by Chidume Nnamdi
In our effort to understand what a memory leak… ... These make them to be created inside the function's or object's scope, so...
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
Hi @brandonros, I’m currently dealing with moving into my new apartment across the planet, a full time job, a new full time job on the way, and some heavy family issues.
Nobody is paying me to do any of this.
I have been primarily mobile for the last 3 weeks. I have little problem responding to issues on GH, but am relatively incapable of doing much coding.
I’m not sorry my schedule doesn’t revolve around you, sir.
@Qix- The open source community amazes me. The time it took you to tell me to open a PR, you could have opened the PR…