V8 also tries to release a completely emoty memory pages back to the OS. Pages that have some little garbage on them or have a lot of small holes are subject to compaction.
So in theory amount of unused memory should not exceed roughly 20% in stable condition... Heap breathes: becomes larger when you actively allocate and smaller when you are idle. Memory management is full of heuristics which require careful tweaking... We have tweaked them a lot since new GC has been released to the wild to make sure that memory fragmentation stays on acceptable levels. -- Vyacheslav Egorov On Mon, Sep 17, 2012 at 4:14 PM, Ryan Schmidt <[email protected]> wrote: > On Sep 17, 2012, at 09:03, Ben Noordhuis wrote: >> On Mon, Sep 17, 2012 at 3:40 PM, Ryan Schmidt wrote: >>> So do I understand correctly: a node program could use up all the >>> computer's memory? >>> >>> If I then need to launch additional programs, will node notice this and >>> reduce its memory usage so that the new program doesn't incur virtual >>> memory penalties? >>> >>> Is there a memory size at which this becomes a performance problem—for >>> example what if I run a node app on a server with 128GB of RAM? >> >> If you manage to fill up 128 GB, you get a cookie. The 2 GB that was >> reported earlier in this thread is close to the maximum that V8 will >> allocate. >> >> If that's still too much, you can limit the heap size with >> --max-old-space-size=<x> where <x> is in megabytes. > > I like cookies. But let's change the example. Suppose I have a server with > 2GB free RAM and I launch a node app. Over time it will occupy all 2GB of > free RAM as a consequence of the garbage collection system, even though it's > not really using the memory. Now I need to launch another program that needs > 1GB of RAM. What will happen? > > > -- > 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 -- 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
