V8 employs a technique we call pretenuring. If it detects that objects allocated at a certain allocation site is always promoted to old space, we optimize the code to automatically allocate to old space. Of course, there are some heuristics at play and there is a chance this does not kick in. If you got a good test case where you think it should pretenure, please file a bug.
Yang On Thursday, January 29, 2015 at 7:53:22 PM UTC+1, Mathias Nater wrote: > > Hi > > Short question: > Is it possible to directly allocate memory in old space to prevent > scavenge in new space? > > Longer explanation: > I'm working on Hyphenator.js <https://code.google.com/p/hyphenator/> a > Javascript polyfill that hyphenates text. > The script loads so called language patterns (each language has its own > patterns). > These patterns are transmitted in a compact form an then converted and > stored in a Trie <http://en.wikipedia.org/wiki/Trie>. This trie data must > not be GCed. It is implemented as a tree of objects. > > Some languages have quite large patterns (e.g. hungarian). Inspection of > the converter-function with --trace-gc reveals that too many allocation > failures triggering a scavenge occur. This slows down the converter > (convert() takes ~70ms, GC ~140ms). > > I read a lot about memory allocation and GC but I'm not an expert at all. > So my suggestion is that the converter-function allocates new trie-branches > in new space which is filled up very fast and triggers the Scavenger. > > Now, since I *know* that those objects will survive an will be promoted > to old space it would be great to be able to directly allocate them in old > space and thus prevent the allocation failures and scavenges. > > Regards, > Mathias > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" 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.
