On Sat, Nov 23, 2013 at 1:54 AM, Steve Freegard <[email protected]> wrote:
> Hi Ben,
>
> On 23/11/13 00:40, Ben Noordhuis wrote:
>> 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?
>
> Same result (this is with fs.watch):
>
> [root@mta41 ~]# node --expose_gc --max_old_space_size=128 watchfile_leak.js
> { rss: 8499200, heapTotal: 6163968, heapUsed: 1918832 }
> { rss: 18079744, heapTotal: 18647040, heapUsed: 8688392 }
>
> I tried it again with an 8M old space size with the same result:
>
> [root@mta41 ~]# node --expose_gc --max_old_space_size=8 watchfile_leak.js
> { rss: 8491008, heapTotal: 6163968, heapUsed: 1918832 }
> { rss: 18071552, heapTotal: 18647040, heapUsed: 8688392 }
>
> Regards,
> Steve.

Right.  I see that your test case creates 1M file watchers in a loop.
Those won't be released right away and calling gc() won't change that.
 Disposing a file watcher takes two event loop ticks or more but in
your test case, everything is done in a single tick.

If you smear out the loop iterations with setImmediate(), you should
see more consistent memory usage.

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