public static interface MemorySegmentFactory.Factory
Modifier and Type | Method and Description |
---|---|
MemorySegment |
allocateUnpooledSegment(int size,
Object owner)
Allocates some unpooled memory and creates a new memory segment that represents
that memory.
|
MemorySegment |
wrap(byte[] memory)
Creates a new memory segment that targets the given heap memory region.
|
MemorySegment |
wrapPooledHeapMemory(byte[] memory,
Object owner)
Creates a memory segment that wraps the given byte array.
|
MemorySegment |
wrapPooledOffHeapMemory(ByteBuffer memory,
Object owner)
Creates a memory segment that wraps the off-heap memory backing the given ByteBuffer.
|
MemorySegment wrap(byte[] memory)
memory
- The heap memory region.MemorySegment allocateUnpooledSegment(int size, Object owner)
size
- The size of the memory segment to allocate.owner
- The owner to associate with the memory segment.MemorySegment 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.MemorySegment wrapPooledOffHeapMemory(ByteBuffer 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 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.