Class SlabAllocator
java.lang.Object
org.apache.cassandra.utils.memory.MemtableAllocator
org.apache.cassandra.utils.memory.MemtableBufferAllocator
org.apache.cassandra.utils.memory.SlabAllocator
+ * 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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.cassandra.utils.memory.MemtableAllocator
MemtableAllocator.SubAllocator -
Method Summary
Modifier and TypeMethodDescriptionallocate(int size) allocate(int size, OpOrder.Group opGroup) cloner(OpOrder.Group writeOp) voidIndicate the memory and resources owned by this allocator are no longer referenced, and can be reclaimed/reused.Methods inherited from class org.apache.cassandra.utils.memory.MemtableBufferAllocator
allocatorMethods inherited from class org.apache.cassandra.utils.memory.MemtableAllocator
isLive, offHeap, onHeap, setDiscarding
-
Method Details
-
ensureOnHeap
- Specified by:
ensureOnHeapin classMemtableAllocator
-
allocate
-
allocate
- Specified by:
allocatein classMemtableBufferAllocator
-
setDiscarded
public void setDiscarded()Description copied from class:MemtableAllocatorIndicate the memory and resources owned by this allocator are no longer referenced, and can be reclaimed/reused.- Overrides:
setDiscardedin classMemtableAllocator
-
cloner
- Specified by:
clonerin classMemtableAllocator
-