elasticsearch/elasticsearch — pull request #4559 by jpountz (2013-12-27 17:15:21+00:00)
Title: Page-based cache recycling.

Here is an attempt to refactor cache recycling so that it only caches large
arrays (pages) that can later be used to build more complex data-structures
such as hash tables.

- QueueRecycler now takes a limit like other non-trivial recyclers.
- New PageCacheRecycler (inspired of CacheRecycler) has the ability to cache
byte[], int[], long[], double[] or Object[] arrays using a fixed amount of
memory (either globally or per-thread depending on the Recycler impl, eg.
queue is global while thread_local is per-thread).
- Paged arrays in o.e.common.util can now optionally take a PageCacheRecycler
to reuse existing pages.
- All aggregators' data-structures now use PageCacheRecycler:
- all arrays
- LongHash can now take a PageCacheRecycler
- there is a new BytesRefHash (inspired from Lucene but quite different,
still; for instance it cheats on BytesRef comparisons by using Unsafe)
that also takes a PageCacheRecycler

Close #4557