scala-offheap
scala-offheap copied to clipboard
Consider adding support for off-heap vectors
Continuos arrays are not a perfect match for paged regions (due to maximum allocation size restriction.) To make it easier to work with collections of data in regions we can introduce a different collection (e.g. Vector) that stores data in linked (potentially tree-based) groups of small arrays that fit well in pages.
Another idea: Instead of making arrays more complicated we can just allocate larger arrays directly from system memory and free them once region ends. This would put them on slow path but won't require users to specially structure their code to fit into region page system.
Yet another idea: Use variable-size pages in memory pooling layer. This way region can just request for page as big as necessary to allocate large array.
allocate larger arrays directly from system memory and free them once region ends
By doing this you're just offloading the same problem to OS allocator. It's likely to be more capable of solving it, but the problem still persists.
Another use-case: efficient implementation of size-changing operations on arrays like filter
as discussed in https://github.com/densh/scala-offheap/issues/39#issuecomment-122563866