This method of the DllLib class pins an object. After pinning an object, you can legally call addrOfPinnedObject to obtain the address of the object's data. While an object is pinned, it will not be reclaimed by the garbage collector and will not move in memory.
You must specifically free this handle via freePinnedHandle. For performance reasons, objects should not be pinned for long periods of time. Generally, you will pin an array during some native I/O operation, and then unpin it.
Note Only single-dimension arrays of primitive types can be pinned.
public static int getPinnedHandle(Object obj);
Returns a handle to the pinned object.
obj | The object to be pinned. |