Package jnr.ffi.provider.jffi
Class TransientNativeMemory
- java.lang.Object
-
- jnr.ffi.Pointer
-
- jnr.ffi.provider.AbstractMemoryIO
-
- jnr.ffi.provider.jffi.DirectMemoryIO
-
- jnr.ffi.provider.jffi.TransientNativeMemory
-
public class TransientNativeMemory extends DirectMemoryIO
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classTransientNativeMemory.MagazineHolder for a group of memory allocations.private static classTransientNativeMemory.Sentinel
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.ThreadLocal<TransientNativeMemory.Magazine>currentMagazineprivate static intPAGES_PER_MAGAZINEprivate static java.util.Map<TransientNativeMemory.Magazine,java.lang.Boolean>referenceSetKeeps strong references to the magazine until cleanupprivate TransientNativeMemory.Sentinelsentinelprivate longsize-
Fields inherited from class jnr.ffi.provider.jffi.DirectMemoryIO
IO
-
-
Constructor Summary
Constructors Constructor Description TransientNativeMemory(Runtime runtime, TransientNativeMemory.Sentinel sentinel, long address, long size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static longalign(long offset, long align)static DirectMemoryIOallocate(Runtime runtime, int size, int align, boolean clear)static DirectMemoryIOallocate(Runtime runtime, long size, int align, boolean clear)voiddispose()booleanequals(java.lang.Object obj)inthashCode()longsize()Gets the size of this memory object in bytes (optional operation).-
Methods inherited from class jnr.ffi.provider.jffi.DirectMemoryIO
array, arrayLength, arrayOffset, get, get, get, get, get, get, getByte, getDouble, getFloat, getInt, getLongLong, getPointer, getPointer, getShort, getString, getString, hasArray, indexOf, put, put, put, put, put, put, putByte, putDouble, putFloat, putInt, putLongLong, putPointer, putShort, putString, putZeroTerminatedByteArray, setMemory, transferFrom, transferTo
-
Methods inherited from class jnr.ffi.provider.AbstractMemoryIO
checkBounds, checkBounds, getAddress, getInt, getLong, getNativeLong, indexOf, putAddress, putAddress, putInt, putLong, putNativeLong, slice, slice
-
Methods inherited from class jnr.ffi.Pointer
address, get, getNullTerminatedPointerArray, getNullTerminatedStringArray, getRuntime, isDirect, newIntPointer, put, toString, wrap, wrap, wrap
-
-
-
-
Field Detail
-
referenceSet
private static final java.util.Map<TransientNativeMemory.Magazine,java.lang.Boolean> referenceSet
Keeps strong references to the magazine until cleanup
-
currentMagazine
private static final java.lang.ThreadLocal<TransientNativeMemory.Magazine> currentMagazine
-
PAGES_PER_MAGAZINE
private static final int PAGES_PER_MAGAZINE
- See Also:
- Constant Field Values
-
sentinel
private final TransientNativeMemory.Sentinel sentinel
-
size
private final long size
-
-
Constructor Detail
-
TransientNativeMemory
TransientNativeMemory(Runtime runtime, TransientNativeMemory.Sentinel sentinel, long address, long size)
-
-
Method Detail
-
allocate
public static DirectMemoryIO allocate(Runtime runtime, int size, int align, boolean clear)
-
allocate
public static DirectMemoryIO allocate(Runtime runtime, long size, int align, boolean clear)
-
align
private static long align(long offset, long align)
-
size
public long size()
Description copied from class:PointerGets the size of this memory object in bytes (optional operation).- Overrides:
sizein classDirectMemoryIO- Returns:
- the size of the memory area this
Pointerpoints to. If the size is unknown,Long.MAX_VALUEis returned}.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classDirectMemoryIO
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classDirectMemoryIO
-
dispose
public final void dispose()
-
-