public final class HeapBufferAllocator extends BufferAllocator
BufferAllocator.STORE_DATA_FRAME_OUTPUT| Modifier and Type | Method and Description |
|---|---|
ByteBuffer |
allocate(int size,
String owner)
Allocate a new ByteBuffer of given size.
|
ByteBuffer |
allocateForStorage(int size)
Allocate a new ByteBuffer of given size for storage in a Region.
|
Object |
baseObject(ByteBuffer buffer)
Get the base object of the ByteBuffer for raw reads/writes by Unsafe API.
|
long |
baseOffset(ByteBuffer buffer)
Get the base offset of the ByteBuffer for raw reads/writes by Unsafe API.
|
void |
clearPostAllocate(ByteBuffer buffer)
Clears the memory to be zeros immediately after allocation.
|
void |
close()
Any cleanup required at system close.
|
ByteBuffer |
expand(ByteBuffer buffer,
int required,
String owner)
Expand given ByteBuffer to new capacity.
|
ByteBuffer |
fromBytesToStorage(byte[] bytes,
int offset,
int length)
Return a ByteBuffer either copying from, or sharing the given heap bytes.
|
static HeapBufferAllocator |
instance() |
boolean |
isDirect()
Indicates if this allocator will produce direct ByteBuffers.
|
void |
release(ByteBuffer buffer)
For direct ByteBuffers the release method is preferred to eagerly release
the memory instead of depending on heap GC which can be delayed.
|
byte[] |
toBytes(ByteBuffer buffer)
Return the data as a heap byte array.
|
ByteBuffer |
transfer(ByteBuffer buffer,
String owner)
Return a ByteBuffer either sharing data of given ByteBuffer
if its type matches, or else copying from the given ByteBuffer.
|
clearBuffer, expandedSizepublic static HeapBufferAllocator instance()
public ByteBuffer allocate(int size, String owner)
BufferAllocatorallocate in class BufferAllocatorpublic ByteBuffer allocateForStorage(int size)
BufferAllocatorallocateForStorage in class BufferAllocatorpublic void clearPostAllocate(ByteBuffer buffer)
BufferAllocatorclearPostAllocate in class BufferAllocatorpublic Object baseObject(ByteBuffer buffer)
BufferAllocatorbaseObject in class BufferAllocatorpublic long baseOffset(ByteBuffer buffer)
BufferAllocatorbaseOffset in class BufferAllocatorpublic ByteBuffer expand(ByteBuffer buffer, int required, String owner)
BufferAllocatorexpand in class BufferAllocatorpublic byte[] toBytes(ByteBuffer buffer)
BufferAllocatortoBytes in class BufferAllocatorpublic ByteBuffer fromBytesToStorage(byte[] bytes, int offset, int length)
BufferAllocatorfromBytesToStorage in class BufferAllocatorpublic ByteBuffer transfer(ByteBuffer buffer, String owner)
BufferAllocatortransfer in class BufferAllocatorpublic void release(ByteBuffer buffer)
BufferAllocatorrelease in class BufferAllocatorpublic boolean isDirect()
BufferAllocatorisDirect in class BufferAllocatorpublic void close()
BufferAllocatorclose in interface Closeableclose in interface AutoCloseableclose in class BufferAllocatorCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.