org.apache.ignite.internal.mem.unsafe

## Class UnsafeMemoryProvider

- java.lang.Object
- - org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider

All Implemented Interfaces:
  DirectMemoryProvider

    public class UnsafeMemoryProvider
    extends Object
    implements DirectMemoryProvider

Memory provider implementation based on unsafe memory access.

Supports memory reuse semantics.

### Constructor Summary

Constructors
Constructor and Description
`UnsafeMemoryProvider(@Nullable IgniteLogger log)`
`UnsafeMemoryProvider(@Nullable IgniteLogger log, @Nullable MemoryAllocator allocator)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `initialize(long[] sizes)`
`DirectMemoryRegion` `nextRegion()` Attempts to allocate next memory region.
`void` `shutdown(boolean deallocate)` Shuts down the provider.

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

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

### Constructor Detail

#### UnsafeMemoryProvider

    public UnsafeMemoryProvider(@Nullable
                                @Nullable IgniteLogger log)

Parameters:
  `log` - Ignite logger to use.

#### UnsafeMemoryProvider

    public UnsafeMemoryProvider(@Nullable
                                @Nullable IgniteLogger log,
                                @Nullable
                                @Nullable MemoryAllocator allocator)

Parameters:
  `log` - Ignite logger to use.
  `allocator` - Memory allocator. If `null`, default `UnsafeMemoryAllocator` will be used.

### Method Detail

#### initialize

    public void initialize(long[] sizes)

Specified by:
  `initialize` in interface `DirectMemoryProvider`
Parameters:
  `sizes` - Initializes provider with the chunk sizes.

#### shutdown

    public void shutdown(boolean deallocate)

Shuts down the provider.

Specified by:
  `shutdown` in interface `DirectMemoryProvider`
Parameters:
  `deallocate` - `True` to deallocate memory, `false` to allow memory reuse.

#### nextRegion

    public DirectMemoryRegion nextRegion()

Attempts to allocate next memory region. Will return `null` if no more regions are available.

Specified by:
  `nextRegion` in interface `DirectMemoryProvider`
Returns:
  Next memory region.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023