public static final class HeapMemorySegment.HeapMemorySegmentFactory extends Object
Modifier and Type | Method and Description |
---|---|
HeapMemorySegment |
allocateUnpooledSegment(int size,
Object owner)
Allocates some unpooled memory and creates a new memory segment that represents
that memory.
|
HeapMemorySegment |
wrap(byte[] memory)
Creates a new memory segment that targets the given heap memory region.
|
HeapMemorySegment |
wrapPooledHeapMemory(byte[] memory,
Object owner)
Creates a memory segment that wraps the given byte array.
|
public HeapMemorySegment wrap(byte[] memory)
memory
- The heap memory region.public HeapMemorySegment allocateUnpooledSegment(int size, Object owner)
size
- The size of the memory segment to allocate.owner
- The owner to associate with the memory segment.public HeapMemorySegment wrapPooledHeapMemory(byte[] memory, Object owner)
This method is intended to be used for components which pool memory and create memory segments around long-lived memory regions.
memory
- The heap memory to be represented by the memory segment.owner
- The owner to associate with the memory segment.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.