Buffer instances that are using Unsafe to allocate and
access memory.
Memory managers are normally not used directly.
Instead, you likely want to use the DefaultBufferAllocators, or the static methods on
BufferAllocator.
| Modifier and Type | Field and Description |
|---|---|
| private static final boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Buffer | allocateConstChild(Buffer
The read-only parent buffer for which a const buffer should be created. The parent
buffer is allocated in the usual way, with
readOnlyConstParent)allocateShared(AllocatorControl, long, Function, AllocationType),
initialised with contents, and then made read-only.Implements io. |
| public Buffer | allocateShared(AllocatorControl
Call-back interface for controlling the allocator that
requested the allocation of this buffer. control, long The size of the buffer to allocate. This size is assumed to be valid for the implementation. size, Function<Drop<Buffer>, Drop<Buffer>> dropDecorator, AllocationType The type of allocation to perform.
Typically, one of the StandardAllocationTypes. allocationType)Implements io. |
| public void | clearMemory(Object
The memory that should be overwritten. memory)Implements io. |
| private static UnsafeBuffer | |
| public String | implementationName()
Implements io. lookupImplementation(String) method.
|
| public Buffer | recoverMemory(AllocatorControl
The allocator control to attach to the buffer. allocatorControl, Object The opaque memory to use for the buffer. recoverableMemory, Drop<Buffer> drop)Implements io. unwrapRecoverableMemory(Buffer) call, and wrap it in a Buffer
instance.
|
| public Object | sliceMemory(Object
The opaque memory to slice. memory, int The offset into the memory to slice from. offset, int The length of the slice. length)Implements io. |
| public Object | unwrapRecoverableMemory(Buffer
The buffer to unwrap. buf)Implements io. |
| FREE_IMMEDIATELY | back to summary |
|---|---|
| private static final boolean FREE_IMMEDIATELY | |
| UnsafeMemoryManager | back to summary |
|---|---|
| public UnsafeMemoryManager() | |
| allocateConstChild | back to summary |
|---|---|
| public Buffer allocateConstChild(Buffer readOnlyConstParent) Implements io. Doc from io. Allocates a constant buffer based on the given parent. A "constant" buffer is conceptually similar to a read-only
buffer, but the implementation may share the underlying memory across multiple buffer instance - something that
is normally not allowed by the API. This allows efficient implementation of the
Note The const-parent buffer must be allocated by this memory manager.
| |
| allocateShared | back to summary |
|---|---|
| public Buffer allocateShared(AllocatorControl control, long size, Function<Drop<Buffer>, Drop<Buffer>> dropDecorator, AllocationType allocationType) Implements io. Doc from io. Allocates a shared buffer. "Shared" is the normal type of buffer, and means the buffer permit concurrent access
from multiple threads, within the limited thread-safety guarantees of the
| |
| clearMemory | back to summary |
|---|---|
| public void clearMemory(Object memory) Implements io. Doc from io. Overwrite the given recoverable memory object with zeroes, erasing all data that it contains.
This is used by the | |
| createBuffer | back to summary |
|---|---|
| private static UnsafeBuffer createBuffer(UnsafeMemory memory, int size, AllocatorControl allocatorControl, Drop<Buffer> drop) | |
| implementationName | back to summary |
|---|---|
| public String implementationName() Implements io. Doc from io. Get the name for this implementation, which can be used for finding this particular implementation via the
| |
| recoverMemory | back to summary |
|---|---|
| public Buffer recoverMemory(AllocatorControl allocatorControl, Object recoverableMemory, Drop<Buffer> drop) Implements io. Doc from io. Recover the memory from a prior | |
| sliceMemory | back to summary |
|---|---|
| public Object sliceMemory(Object memory, int offset, int length) Implements io. Doc from io. Produces a slice of the given internal memory representation object. | |
| unwrapRecoverableMemory | back to summary |
|---|---|
| public Object unwrapRecoverableMemory(Buffer buf) Implements io. Doc from io. Create an object that represents the internal memory of the given buffer. | |