Microsoft SDK for Java

IJavaHeapMonitor::
GetObjectAge

The GetObjectAge method of the IJavaHeapMonitor interface is called by a memory profiler to determine the number of garbage collections a Java object has survived.

Syntax

HRESULT GetObjectAge(ObjectID object_id, DWORD *pncollections_survived);

Return Value

A count of the number of garbage collections survived.

Parameters

[in] object_id The ObjectID of the object that the memory profiler is interested in.
[out] *pncollections_survived This returned parameter is a count of the number of garbage collections the object has survived.

Remarks

The ObjectID of a heap object is passed to the profiler's OnObjectAllocated method when individual objects are allocated. To maintain a persistent handle to an object across garbage collections, a profiler should call GetHandlesToObjects to obtain a persistent handle. At some later time, the profiler application can call GetObjectsFromHandles to convert this persistent handle to an ObjectID to be used in calling the GetObjectAge method.

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