Package org.jruby.ext.ffi.jffi
Class AllocatedNativeMemoryIO
java.lang.Object
org.jruby.ext.ffi.MemoryIO
org.jruby.ext.ffi.jffi.BoundedNativeMemoryIO
org.jruby.ext.ffi.jffi.AllocatedNativeMemoryIO
- All Implemented Interfaces:
AllocatedDirectMemoryIO
final class AllocatedNativeMemoryIO
extends BoundedNativeMemoryIO
implements AllocatedDirectMemoryIO
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classHolder for a group of memory allocations.private static final classRepresents a single native memory allocation -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AllocatedNativeMemoryIO.MemoryAllocationprivate static final ThreadLocal<Reference<AllocatedNativeMemoryIO.AllocationGroup>>private static final Map<AllocatedNativeMemoryIO.AllocationGroup,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
ConstructorsModifierConstructorDescriptionprivateAllocatedNativeMemoryIO(Ruby runtime, Object sentinel, long address, int size, int align) -
Method Summary
Modifier and TypeMethodDescription(package private) static final AllocatedNativeMemoryIOAllocates native memory(package private) static AllocatedNativeMemoryIOallocateAligned(Ruby runtime, int size, int align, boolean clear) Allocates native memory, aligned to a minimum boundary.voidfree()booleanvoidsetAutoRelease(boolean autorelease) 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 -
currentBucket
-
allocation
-
sentinel
-
-
Constructor Details
-
AllocatedNativeMemoryIO
-
-
Method Details
-
allocate
Allocates native memory- Parameters:
runtime- The Ruby runtimesize- The number of bytes to allocateclear- Whether the memory should be cleared (zeroed)- Returns:
- A new
AllocatedDirectMemoryIO
-
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
-
free
public void free()- Specified by:
freein interfaceAllocatedDirectMemoryIO
-
setAutoRelease
public void setAutoRelease(boolean autorelease) - Specified by:
setAutoReleasein interfaceAllocatedDirectMemoryIO
-
isAutoRelease
public boolean isAutoRelease()- Specified by:
isAutoReleasein interfaceAllocatedDirectMemoryIO
-