On Tue, May 14, 2013 at 8:23 AM, Nicholas O'Leary <[email protected]> wrote:
> Hi,
>
> I've just upgraded from 0.8.19 to 0.10.5 and my app that would previously
> run happily for days on a Raspberry Pi now dies overnight due to running out
> of memory. I see there were some changes to the GC handling in 0.10 that I
> wonder could be the cause of this.
>
> I've narrowed the problem code down to the use of
> script.runInNewContext(sandbox);
>
> Here is a simple test case that demonstrates the same symptoms, using a
> slightly modified version of the example code in the vm module docs.
>
> var util = require('util'),
>     vm = require('vm'),
>     sandbox = {
>       animal: 'cat',
>       count: 2
>     };
>
> var script = vm.createScript('count += 1; name = "kitty"', 'myfile.vm');
> setInterval(function() {
>   script.runInNewContext(sandbox);
>   console.log(util.inspect(sandbox));
> },50);
>
>
> Essentially, this code invokes script.runInNewContext repeatedly. I've used
> a very short time out so I can test quickly; in the real app runInNewContext
> is being run about once a second.
>
> I've run this on my laptop (Ubuntu 12.04), monitoring the memory usage over
> time.
>
> With 0.8.19, the memory usage peaks around 60Mb and then stabilises around
> 30Mb with fluctuations as the garbage collector does its thing.
>
> With 0.10.5 the memory usage continually increases - with very slight dips
> as, presumably, some garbage collecting is happening. But it does not
> stabilise. I've not run it all the way to a crash on the Pi, but in a 15
> minute run, the memory usage hits just under 700Mb.
>
> Any ideas what is happening, or perhaps what I'm missing here? It looks like
> either a leak in runInNewContext, or there is something about this code that
> the changes to gc don't favour.
>
> Regards,
> Nick

I can't reproduce what you're describing on x86_64.  Memory usage
peaks at a very reasonable 30-35 MB RSS.

When you say "hits 700MB", do you mean RSS or VSIZE?  The latter is
not really something to worry about.

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