Microsoft SDK for Java

GCGetPtr

Allocates a weak pointer for an object, and then updates it when garbage collection occurs.

Syntax

HObject** __cdecl GCGetPtr(HObject *phobj);

Return Value

Returns an address to a pointer to a Java object handle.

Parameters

*phobj The address of a Java object.

Remarks

Given a pointer to an object, this function allocates and returns the address of that object pointer, and then updates the contained pointer when garbage collection occurs. Note that if the object gets freed during garbage collection, the value of the contained pointer will be NULL. A weak pointer is different from a strong pointer (as allocated by GCNewHandle). A weak pointer will not block garbage collection (removal) of the referenced object, but a strong pointer will. (Strong pointers are scanned like any other object during garbage collection; weak pointers are updated after the garbage collection has been completed.)

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