final class CachingNativeMemoryAllocator
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
CachingNativeMemoryAllocator.AllocatedMemoryIO |
private static class |
CachingNativeMemoryAllocator.AllocationGroup |
private static class |
CachingNativeMemoryAllocator.Allocator |
private static class |
CachingNativeMemoryAllocator.Bucket |
private static class |
CachingNativeMemoryAllocator.Magazine |
private static class |
CachingNativeMemoryAllocator.MemoryAllocation |
| Modifier and Type | Field and Description |
|---|---|
private static CachingNativeMemoryAllocator.Bucket[] |
buckets
Keeps strong references to the memory bucket until cleanup
|
private static java.lang.ThreadLocal<java.lang.ref.Reference<CachingNativeMemoryAllocator.Allocator>> |
currentAllocator |
protected static com.kenai.jffi.MemoryIO |
IO |
private static java.util.Map<CachingNativeMemoryAllocator.AllocationGroup,java.lang.Boolean> |
referenceSet |
| Constructor and Description |
|---|
CachingNativeMemoryAllocator() |
| Modifier and Type | Method and Description |
|---|---|
private static long |
align(long offset,
long align) |
(package private) static MemoryIO |
allocateAligned(Ruby runtime,
int size,
int align,
boolean clear)
Allocates native memory, aligned to a minimum boundary.
|
(package private) static int |
bucketIndex(int size) |
(package private) static void |
clearMemory(long address,
int size) |
(package private) static int |
roundUpToPowerOf2(int n) |
protected static final com.kenai.jffi.MemoryIO IO
private static final CachingNativeMemoryAllocator.Bucket[] buckets
private static final java.util.Map<CachingNativeMemoryAllocator.AllocationGroup,java.lang.Boolean> referenceSet
private static final java.lang.ThreadLocal<java.lang.ref.Reference<CachingNativeMemoryAllocator.Allocator>> currentAllocator
static int bucketIndex(int size)
static MemoryIO allocateAligned(Ruby runtime, int size, int align, boolean clear)
runtime - The Ruby runtimesize - The number of bytes to allocatealign - The minimum alignment of the memoryclear - Whether the memory should be cleared (zeroed)AllocatedDirectMemoryIOprivate static long align(long offset,
long align)
static int roundUpToPowerOf2(int n)
static void clearMemory(long address,
int size)