Microsoft SDK for Java

getPinnedHandle

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.

Syntax

public static int getPinnedHandle(Object obj);

Return Value

Returns a handle to the pinned object.

Parameters

obj The object to be pinned.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.