Top Inners Fields Constructors Methods
org.jruby.ext.ffi.jffi

pack-priv final Class TransientNativeMemoryIO

extends BoundedNativeMemoryIO
Class Inheritance
Imports
com.kenai.jffi.PageManager, org.jruby.Ruby, org.jruby.ext.ffi.MemoryIO, org.jruby.util.PhantomReferenceReaper, java.lang.ref.Reference, .SoftReference, .WeakReference, java.util.Map, java.util.concurrent.ConcurrentHashMap

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
TransientNativeMemoryIO.Magazine

Holder for a group of memory allocations.

Field Summary

Modifier and TypeField and Description
private static final ThreadLocal<Reference<TransientNativeMemoryIO.Magazine>>
private static final int
private static final Map<TransientNativeMemoryIO.Magazine, Boolean>
referenceSet

Keeps strong references to the memory bucket until cleanup

private final Object
Inherited from org.jruby.ext.ffi.jffi.BoundedNativeMemoryIO:
ADDRESS_SIZEIOLONG_SIZEparentsize

Constructor Summary

AccessConstructor and Description
private
TransientNativeMemoryIO(Ruby runtime, Object sentinel, long address, int size)

Method Summary

Modifier and TypeMethod and Description
private static long
align(long offset, long align)

pack-priv static MemoryIO
allocateAligned(Ruby
The Ruby runtime
runtime
,
int
The number of bytes to allocate
size
,
int
The minimum alignment of the memory
align
,
boolean
Whether the memory should be cleared (zeroed)
clear
)

Allocates native memory, aligned to a minimum boundary.

Inherited from org.jruby.ext.ffi.jffi.BoundedNativeMemoryIO:
arrayarrayLengtharrayOffsetasByteBufferdupequalsgetgetgetgetgetgetgetAddressgetBytegetDoublegetFloatgetIntgetLonggetMemoryIOgetNativeLonggetRuntimegetShortgetZeroTerminatedByteArraygetZeroTerminatedByteArrayhashCodeindexOfindexOforderputputputputputputputAddressputByteputDoubleputFloatputIntputLongputMemoryIOputNativeLongputShortputZeroTerminatedByteArraysetMemorysliceslice

Field Detail

currentMagazineback to summary
private static final ThreadLocal<Reference<TransientNativeMemoryIO.Magazine>> currentMagazine
PAGES_PER_MAGAZINEback to summary
private static final int PAGES_PER_MAGAZINE
referenceSetback to summary
private static final Map<TransientNativeMemoryIO.Magazine, Boolean> referenceSet

Keeps strong references to the memory bucket until cleanup

sentinelback to summary
private final Object sentinel

Constructor Detail

TransientNativeMemoryIOback to summary
private TransientNativeMemoryIO(Ruby runtime, Object sentinel, long address, int size)

Method Detail

alignback to summary
private static long align(long offset, long align)
allocateAlignedback to summary
pack-priv static MemoryIO allocateAligned(Ruby runtime, int size, int align, boolean clear)

Allocates native memory, aligned to a minimum boundary.

Parameters
runtime:Ruby

The Ruby runtime

size:int

The number of bytes to allocate

align:int

The minimum alignment of the memory

clear:boolean

Whether the memory should be cleared (zeroed)

Returns:MemoryIO

A new org.jruby.ext.ffi.AllocatedDirectMemoryIO

org.jruby.ext.ffi.jffi back to summary

private final Class TransientNativeMemoryIO.Magazine

extends PhantomReferenceReaper<Object>
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable

Holder for a group of memory allocations.

Field Summary

Modifier and TypeField and Description
private final long
private long
private final long
private final int
private final PageManager
private final WeakReference<Object>

Constructor Summary

AccessConstructor and Description
pack-priv
Magazine(Object sentinel, PageManager pm, long page, int pageCount)

Method Summary

Modifier and TypeMethod and Description
pack-priv long
allocate(int size, int align)

public final void
run()

Implements java.lang.Runnable.run.

Runs this operation.

pack-priv Object

Field Detail

endback to summary
private final long end
memoryback to summary
private long memory
pageback to summary
private final long page
pageCountback to summary
private final int pageCount
pmback to summary
private final PageManager pm
weakrefback to summary
private final WeakReference<Object> weakref

Constructor Detail

Magazineback to summary
pack-priv Magazine(Object sentinel, PageManager pm, long page, int pageCount)

Method Detail

allocateback to summary
pack-priv long allocate(int size, int align)
runback to summary
public final void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

sentinelback to summary
pack-priv Object sentinel()