public class HeapMemoryAllocator extends Object implements MemoryAllocator
ByteBuffer.allocate(int) to create chunks in the JVM heap.| Modifier and Type | Method and Description |
|---|---|
Optional<ResourceHolder<org.apache.datasketches.memory.WritableMemory>> |
allocate(long size)
Allocates a block of memory of capacity .
|
long |
available()
Returns the number of bytes available for allocations.
|
long |
capacity()
Returns the number of bytes managed by this allocator.
|
static HeapMemoryAllocator |
unlimited()
Create an allocator that is "unlimited", which, of course, means it is limited only by available JVM heap.
|
public static HeapMemoryAllocator unlimited()
public Optional<ResourceHolder<org.apache.datasketches.memory.WritableMemory>> allocate(long size)
MemoryAllocatorResourceHolder.
The returned WritableMemory object will use little-endian byte order.allocate in interface MemoryAllocatorpublic long available()
MemoryAllocatorLong.MAX_VALUE if there is no inherent limit. This generally does not mean you can actually
allocate 9 exabytes.available in interface MemoryAllocatorpublic long capacity()
MemoryAllocatorMemoryAllocator.available().
May return Long.MAX_VALUE if there is no inherent limit. This generally does not mean you can actually
allocate 9 exabytes.capacity in interface MemoryAllocatorCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.