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.
HRESULT GetObjectAge(ObjectID object_id, DWORD *pncollections_survived);
A count of the number of garbage collections survived.
[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. |
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.