NativeAllocator (apache-cassandra API)
Date: 2018-02-12

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.DataReclaimer, MemtableAllocator.SubAllocator`

  - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.utils.memory.MemtableAllocator

      `NO_OP`

  - ### 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)`
    `Cell` | `clone(Cell cell, CFMetaData cfm, OpOrder.Group writeOp)`
    `CounterCell` | `clone(CounterCell cell, CFMetaData cfm, OpOrder.Group writeOp)`
    `DecoratedKey` | `clone(DecoratedKey key, OpOrder.Group writeOp)`
    `DeletedCell` | `clone(DeletedCell cell, CFMetaData cfm, OpOrder.Group writeOp)`
    `ExpiringCell` | `clone(ExpiringCell cell, CFMetaData cfm, OpOrder.Group writeOp)`
    `MemtableAllocator.DataReclaimer` | `reclaimer()`
    `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

    - #### clone

          public Cell clone(Cell cell,
                            CFMetaData cfm,
                            OpOrder.Group writeOp)

      Specified by:
        `clone` in class `MemtableAllocator`

    - #### clone

          public CounterCell clone(CounterCell cell,
                                   CFMetaData cfm,
                                   OpOrder.Group writeOp)

      Specified by:
        `clone` in class `MemtableAllocator`

    - #### clone

          public DeletedCell clone(DeletedCell cell,
                                   CFMetaData cfm,
                                   OpOrder.Group writeOp)

      Specified by:
        `clone` in class `MemtableAllocator`

    - #### clone

          public ExpiringCell clone(ExpiringCell cell,
                                    CFMetaData cfm,
                                    OpOrder.Group writeOp)

      Specified by:
        `clone` in class `MemtableAllocator`

    - #### clone

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

      Specified by:
        `clone` in class `MemtableAllocator`

    - #### reclaimer

          public MemtableAllocator.DataReclaimer reclaimer()

      Specified by:
        `reclaimer` 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