Re: ideas for returning memory to the OS
Jean-Marc Desperrier <[email protected]> Sat, 15 Dec 2007 13:53:07 +0100
| Newsgroups | gmane.comp.mozilla.performance |
|---|---|
| Message-ID | <[email protected]> |
Jonas Sicking wrote: > [...] For example a lot of > objects are holding strings, we most likely will not want to pass > pointers to the arena into every call to the string classes and pass in > a pointer to what pool they should use. [...] But string typically are object on which it's typically worth spending time to enhance memory allocation. In that case, it might be worth it to over-allocate the string initially, so that often the string classes operation won't need to allocate more memory. I known Mozilla already has a lot of different string classes available for various optimizations (even if I don't know the details well), but I understand most developers don't use them very well. That's not very surprising because it seems really hard to master. The better solution might be to always use the generic class initially, and then have a dedicated team that hand-tunes the usage during review, or as benchmarks show the need for enhancements for specific modules. > Nor to every nsVoidArray call > and tell it which pool to use for its internal buffer. > [...] If that internal buffer is a throw away buffer, it should allocated in stack. That's another point on which there might be some very significant gain to have : Objects that have a "current function call" lifespan should be *fully* allocated on the stack. If the compiler won't cooperate enough to make that possible, maybe a "stack arena" is the way to do instead.