public static final class HeapMemorySegment.HeapMemorySegmentFactory extends Object implements MemorySegmentFactory.Factory
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.
|
HeapMemorySegment |
wrapPooledOffHeapMemory(ByteBuffer memory,
Object owner)
Creates a memory segment that wraps the off-heap memory backing the given ByteBuffer.
|
public HeapMemorySegment wrap(byte[] memory)
MemorySegmentFactory.Factory
wrap
in interface MemorySegmentFactory.Factory
memory
- The heap memory region.public HeapMemorySegment allocateUnpooledSegment(int size, Object owner)
MemorySegmentFactory.Factory
allocateUnpooledSegment
in interface MemorySegmentFactory.Factory
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)
MemorySegmentFactory.Factory
This method is intended to be used for components which pool memory and create memory segments around long-lived memory regions.
wrapPooledHeapMemory
in interface MemorySegmentFactory.Factory
memory
- The heap memory to be represented by the memory segment.owner
- The owner to associate with the memory segment.public HeapMemorySegment wrapPooledOffHeapMemory(ByteBuffer memory, Object owner)
MemorySegmentFactory.Factory
This method is intended to be used for components which pool memory and create memory segments around long-lived memory regions.
wrapPooledOffHeapMemory
in interface MemorySegmentFactory.Factory
memory
- The byte buffer with the off-heap memory to be represented by the memory segment.owner
- The owner to associate with the memory segment.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.