public class MappedMemory extends NativeMemory
This is a special memory descriptor that handles management of MappedByteBuffer based memory. The
mapped memory descriptor simply points to the memory address of the underlying byte buffer. When memory is reallocated,
the parent MappedMemoryAllocator is used to create a new MappedByteBuffer
and free the existing buffer.
Memory.Util| Modifier and Type | Field and Description |
|---|---|
static long |
MAX_SIZE |
| Constructor and Description |
|---|
MappedMemory(MappedByteBuffer buffer,
MappedMemoryAllocator allocator) |
| Modifier and Type | Method and Description |
|---|---|
static MappedMemory |
allocate(File file,
FileChannel.MapMode mode,
long size)
Allocates memory mapped to a file on disk.
|
static MappedMemory |
allocate(File file,
long size)
Allocates memory mapped to a file on disk.
|
void |
flush()
Flushes the mapped buffer to disk.
|
void |
free()
Frees the memory.
|
public static final long MAX_SIZE
public MappedMemory(MappedByteBuffer buffer, MappedMemoryAllocator allocator)
public static MappedMemory allocate(File file, long size)
file - The file to which to map memory.size - The count of the memory to map.IllegalArgumentException - If count is greater than Integer.MAX_VALUEpublic static MappedMemory allocate(File file, FileChannel.MapMode mode, long size)
file - The file to which to map memory.mode - The mode with which to map memory.size - The count of the memory to map.IllegalArgumentException - If count is greater than Integer.MAX_VALUEpublic void flush()
public void free()
Memoryfree in interface Memoryfree in class NativeMemoryCopyright © 2013–2015. All rights reserved.