Package org.jruby.ext.ffi.jffi
Class TransientNativeMemoryIO
java.lang.Object
org.jruby.ext.ffi.MemoryIO
org.jruby.ext.ffi.jffi.BoundedNativeMemoryIO
org.jruby.ext.ffi.jffi.TransientNativeMemoryIO
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classHolder for a group of memory allocations. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ThreadLocal<Reference<TransientNativeMemoryIO.Magazine>>private static final intprivate static final Map<TransientNativeMemoryIO.Magazine,Boolean> Keeps strong references to the memory bucket until cleanupprivate final ObjectFields inherited from class org.jruby.ext.ffi.jffi.BoundedNativeMemoryIO
ADDRESS_SIZE, IO, LONG_SIZE, parent, size -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTransientNativeMemoryIO(Ruby runtime, Object sentinel, long address, int size) -
Method Summary
Modifier and TypeMethodDescriptionprivate static longalign(long offset, long align) (package private) static MemoryIOallocateAligned(Ruby runtime, int size, int align, boolean clear) Allocates native memory, aligned to a minimum boundary.Methods inherited from class org.jruby.ext.ffi.jffi.BoundedNativeMemoryIO
array, arrayLength, arrayOffset, asByteBuffer, dup, equals, get, get, get, get, get, get, getAddress, getByte, getDouble, getFloat, getInt, getLong, getMemoryIO, getNativeLong, getRuntime, getShort, getZeroTerminatedByteArray, getZeroTerminatedByteArray, hashCode, indexOf, indexOf, order, put, put, put, put, put, put, putAddress, putByte, putDouble, putFloat, putInt, putLong, putMemoryIO, putNativeLong, putShort, putZeroTerminatedByteArray, setMemory, slice, slice
-
Field Details
-
referenceSet
Keeps strong references to the memory bucket until cleanup -
currentMagazine
-
PAGES_PER_MAGAZINE
private static final int PAGES_PER_MAGAZINE- See Also:
-
sentinel
-
-
Constructor Details
-
TransientNativeMemoryIO
-
-
Method Details
-
allocateAligned
Allocates native memory, aligned to a minimum boundary.- Parameters:
runtime- The Ruby runtimesize- The number of bytes to allocatealign- The minimum alignment of the memoryclear- Whether the memory should be cleared (zeroed)- Returns:
- A new
AllocatedDirectMemoryIO
-
align
private static long align(long offset, long align)
-