org.apache.cassandra.utils.memory

## Class NativeAllocator

- java.lang.Object
- - org.apache.cassandra.utils.memory.MemtableAllocator
  - - org.apache.cassandra.utils.memory.NativeAllocator

-     public class NativeAllocator
      extends MemtableAllocator

  This NativeAllocator uses global slab allocation strategy with slab size that scales exponentially from 8kb to 1Mb to serve allocation of up to 128kb.

  The slab allocation reduces heap fragmentation from small long-lived objects.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.cassandra.utils.memory.MemtableAllocator

      `MemtableAllocator.SubAllocator`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `NativeAllocator(NativePool pool)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `allocate(int size, OpOrder.Group opGroup)`
    `DecoratedKey` | `clone(DecoratedKey key, OpOrder.Group writeOp)`
    `EnsureOnHeap` | `ensureOnHeap()`
    `Row.Builder` | `rowBuilder(OpOrder.Group opGroup)`
    `void` | `setDiscarded()` Indicate 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.MemtableAllocator

      `isLive, offHeap, onHeap, setDiscarding`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NativeAllocator

          protected NativeAllocator(NativePool pool)

  - ### Method Detail

    - #### rowBuilder

          public Row.Builder rowBuilder(OpOrder.Group opGroup)

      Specified by:
        `rowBuilder` in class `MemtableAllocator`

    - #### clone

          public DecoratedKey clone(DecoratedKey key,
                                    OpOrder.Group writeOp)

      Specified by:
        `clone` in class `MemtableAllocator`

    - #### ensureOnHeap

          public EnsureOnHeap ensureOnHeap()

      Specified by:
        `ensureOnHeap` in class `MemtableAllocator`

    - #### allocate

          public long allocate(int size,
                               OpOrder.Group opGroup)

    - #### setDiscarded

          public void setDiscarded()

      Description copied from class: `MemtableAllocator`
      Indicate the memory and resources owned by this allocator are no longer referenced, and can be reclaimed/reused.
      Overrides:
        `setDiscarded` in class `MemtableAllocator`

Copyright © 2018 The Apache Software Foundation