## org.apache.cassandra.utils
Class SlabAllocator

    java.lang.Object
      org.apache.cassandra.utils.Allocator
          org.apache.cassandra.utils.SlabAllocator

    public class SlabAllocator

extends Allocator

The SlabAllocator is a bump-the-pointer allocator that allocates large (2MB by default) regions and then doles them out to threads that request 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.

Constructor Summary
`SlabAllocator()`

Method Summary
`java.nio.ByteBuffer` `allocate(int size)`

Methods inherited from class org.apache.cassandra.utils.Allocator
`clone`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SlabAllocator

    public SlabAllocator()

Method Detail

### allocate

    public java.nio.ByteBuffer allocate(int size)

  Specified by:
    `allocate` in class `Allocator`

Copyright © 2012 The Apache Software Foundation