-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hint about memory usage in README #17
Comments
In fact we keep a history to get more accurate data on linux. To clean up this you have to use the |
It is. I spent more than 5 hours in tracking down that problem yesterday. var fs=require('fs'), noop=function() {};
(function readFile() {
for (var i=0; i<500; i++) {
fs.readFile(__filename, noop);
}
//gc();
setTimeout(readFile, 50);
})(); Result: 60MB RSS within a few seconds - if you uncomment |
50ms is very low. I can improve that and will do, thanks. |
I started to inspect the problem, when my script calling |
So, I tried to keep the fd cursor in memory to avoid (re)opening the file every time but it does not make any difference and fs.read() still uses memory and the May I ask what node version do you use? I launched my last test on |
I used v0.12, v4.2.6 and v5.5 in my tests and saw no real difference between these versions. |
Thanks, I guess I'll just add a warning to the readme as I can't find any fix :|. Do you think the memory consumption is worth opening an issue on nodejs/node? Taking the fact that using |
Someone did report the bug, but they closed it since |
This comment is confusing since it uses "leaking". As @anatolsommer stated above, this is not a memory leak, which wouldn't be corrected by calling gc(). |
Is this a leak? Is the disclaimer necessary? Won't Node.js automatically run the gc when it needs to? Running the |
"leak" is a bit strong indeed, changed. |
It would be great if there was a hint that constantly calling pusage.stat (or fs.readFile/createReadStream in general) is filling up memory pretty fast if you don't call gc manually every few seconds. This might save a lot of people a lot of time.
The text was updated successfully, but these errors were encountered: