On Tue, Feb 6, 2018 at 8:43 PM, <[email protected]> wrote: > Hi v8 devs, > I'm working on VSCode and looking into on large file (Gigabyte files) > improvement. As VSCode is Electron based and currently we load the whole > file into memory (we can do mmap), we easily run into heap size limit. Based > on what I learnt from > http://erikcorry.blogspot.ru/2012/11/memory-management-flags-in-v8.html, we > can set `js-flags=--max_old_space_size=` to increase the limit and users can > do so themselves as Electron will pass the flags to v8. > In order to provide better experience of opening large files (larger than > the v8 default limit), I'm thinking about setting `max_old_space_size ` to a > large one (for example 16GB, which a limit for our current text buffer > implementation) but I'm wondering whether it will lead to any potential side > effect, for instance > > Does v8 prefer to use more memory eagerly once we set max_old_space_size to > a high value, even when the objects in heap is relatively small? Or maybe we > don't need to worry about this until the memory usage is near the size > limit? > Does this flag affect GC in a noticeable way? > > Most of the time our users are working on small files (KBs, MB files are > rare) so we don't want to downshift their experience so I'd like to know the > best practice of using `max_old_space_size`. Do you have any idea on this? > Thanks in advance! > > Thanks, > Peng
The garbage collector uses many input signals but as a rule of thumb: over time the heap size will tend to grow towards the limit. V8 likes to grow the heap if it would otherwise have to scan it frequently; it leaves more CPU time for useful work. You can supply hints (e.g. Isolate::SetRAILMode()) or coax it into being more aggressive (e.g. Isolate::AdjustAmountOfExternalAllocatedMemory() with a high value) but ultimately you should assume that V8 will use what it is allotted. -- -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev --- You received this message because you are subscribed to the Google Groups "v8-dev" 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/d/optout.
