Class SlabAllocator


  • public class SlabAllocator
    extends MemtableBufferAllocator
    + * The SlabAllocator is a bump-the-pointer allocator that allocates + * large (1MiB) global regions and then doles them out to threads that + * request smaller sized (up to 128KiB) slices into the array.

    The purpose of this class is to combat heap fragmentation in long lived objects: by ensuring that all allocations with similar lifetimes only to large regions of contiguous memory, we ensure that large blocks get freed up at the same time.

    Otherwise, variable length byte arrays allocated end up interleaved throughout the heap, and the old generation gets progressively more fragmented until a stop-the-world compacting collection occurs.