| IJVMWrapperDirectNewDirectBufferT(T, Boolean, Boolean, Int32) Method |
Namespace: MASES.JCOBridge.C2JBridge.JVMInteropAssembly: C2JBridge (in C2JBridge.dll) Version: 2.5.21.241219-a6a144ea07c497c3a9a1be842408e852afb458be
Syntax JCOBridgeDirectBuffer<T> NewDirectBuffer<T>(
T[] data,
bool useMemoryControlBlock = true,
bool arrangeCapacity = true,
int timeToLive = -1
)
Function NewDirectBuffer(Of T) (
data As T(),
Optional useMemoryControlBlock As Boolean = true,
Optional arrangeCapacity As Boolean = true,
Optional timeToLive As Integer = -1
) As JCOBridgeDirectBuffer(Of T)
Parameters
- data T
- The T array elements
- useMemoryControlBlock Boolean (Optional)
- Appends to the end of the data a memory block will be used to controls and arbitrates memory between CLR and JVM
- arrangeCapacity Boolean (Optional)
- If the T array in data will be resized to the next power of 2,
so capacity will be memory aligned and the limit of https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html will be current size of data.
However if the T array in data needs a resize, the memory will be copied during the capacity arrangement, if arrangeCapacity is
a good approach is to allocate an array which is a power 2 at origin. If useMemoryControlBlock is and there is no space left, between capacity and limit,
an extra resize is executed without consider the value of arrangeCapacity
- timeToLive Int32 (Optional)
- The time to live, expressed in milliseconds, the underlying memory shall remain available;
if the time to live expires the pinned memory is retired leaving potentially the JVM under the possibility of an access violation.
Type Parameters
- T
- The native type of the resulting JCOBridgeDirectBufferT
Return Value
JCOBridgeDirectBufferTA new instance of
JCOBridgeDirectBufferT holding the memory of
data shared with the
https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.htmlRemarks See Also