On Fri, Nov 22, 2013 at 11:00 PM, Steve Freegard
<[email protected]> wrote:
> On 22/11/13 21:14, Timothy J Fontaine wrote:
>>
>> so you're creating a bunch of stat watchers, those require gc to be
>> cleaned up, but they're still too young by the time you run gc outside
>> the loop, if instead you move the gc into the loop or call it multiple
>> times after the loop is done it can effectively clean them up.
>>
>>
>
> Ok - I tried that and moved the gc() call to the end of the loop and for
> good measure added a couple outside the loop before outputting the
> memory usage.   I had to reduce the number of loops to 10,000 so that it
> didn't take forever to complete; but it still shows a leak:
>
> [root@mta41 ~]# node --expose_gc watchfile_leak.js
> { rss: 8478720, heapTotal: 6163968, heapUsed: 1919048 }
> { rss: 17838080, heapTotal: 20844032, heapUsed: 1928208 }
>
>
> I also switched from fs.watchFile to fs.watch and I see a leak with that
> too:
>
> [root@mta41 ~]# node --expose_gc watchfile_leak.js
> { rss: 8478720, heapTotal: 6163968, heapUsed: 1918824 }
> { rss: 18067456, heapTotal: 18647040, heapUsed: 8692304 }
>
> Code for this:
>
> var fs = require('fs');
> gc();
> console.log(process.memoryUsage());
> var name = '/etc/passwd';
> for (var i=0; i<10000; i++) {
>     var foo = fs.watch(name, function () {});
>     foo.close();
>     gc();
> }
> gc();
> console.log(process.memoryUsage());
>
> This is on Linux 2.6.18 x86_64 running Node 0.10.22.
>
> Kind regards,
> Steve.

That doesn't necessarily imply a memory leak, the garbage collector
may just be growing the heap.  What happens when you set
--max_old_space_size=128?

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to