Oracle Coherence for C++ API
Release 3.7.1.0

E22845-01

ClassBasedHeapAnalyzer Class Reference

#include <coherence/lang/ClassBasedHeapAnalyzer.hpp>

Inherits AbstractHeapAnalyzer.

List of all members.


Detailed Description

ClassBasedHeapAnalyzer provides heap analysis at the class level, that is it tracks the number of live instances of each class.

The memory consumption of this heap analyzer is relative to the number of classes used within the process. The CPU consumption is also very low, each registration consists of roughly four compare-and-set operations. It is well suited for development as well as many production environments.

See also:
ObjectCountHeapAnalyzer for a lower overhead analyzer
Author:
mf 2008.04.27
 

Public Types

typedef spec::Handle Handle
 ClassBasedHeapAnalyzer Handle definition.
typedef spec::View View
 ClassBasedHeapAnalyzer View definition.
typedef spec::Holder Holder
 ClassBasedHeapAnalyzer Holder definition.

Public Member Functions

virtual
HeapAnalyzer::Snapshot::View 
capture () const
 Capture a Snapshot of the current state of the heap.

Note, when performing captures in a loop, and assigning the captured snapshot to a handle referencing a snapshot, it is advisable to NULL out the handle first, so as to avoid the new snapshot including the "cost" of snapshot it is about to replace.

Returns:
a Snapshot of the current state of the heap.
virtual
HeapAnalyzer::Snapshot::View 
delta (HeapAnalyzer::Snapshot::View vSnap) const
 Compute the delta between the supplied Snapshot and the current heap state.

Parameters:
 vThat the snapshot to compare against.
Returns:
a snapshot containing the delta
virtual int64_t getObjectCount () const
 Return the number of registered objects.

Returns:
the number of registered objects

Protected Member Functions

 ClassBasedHeapAnalyzer (bool fShowAllocations=false)
 Create a new ClassBasedHeapAnalyzer.
virtual void safeRegisterObject (const Object &o)
 Registers an object with the heap analyzer.

Parameters:
 o the object to register
virtual void safeUnregisterObject (const Object &o)
 Unregisters an object with the heap analyzer.

Parameters:
 o the object to unregister
virtual void registerObject (const Object &o)
 Register a newly created Object with the system.

This method is called automatically by coherence::lang::Object once the Object has finished construction.

Parameters:
 o the newly created Object.

Parameters:
 o the object to register
If the calling thread is reentering this method return immediately otherwise delegates to safeRegisterObject.
virtual void unregisterObject (const Object &o)
 Unregister an Object with the system.

This method is called automatically by coherence::lang::Object just prior to the deletion of the Object. No new handles or views may be created to the object.

Parameters:
 o the Object to unregister

Parameters:
 o the object to unregister
If the calling thread is reentering this method return immediately otherwise delegates to safeUnregisterObject.

Protected Attributes

bool m_fShowAllocations
 True if allocations should be printed as part of analysis.

Classes

class  ClassStats
 Statistics relating to a class. More...
class  Snapshot
 Snapshot containing the object count. More...

Constructor & Destructor Documentation

ClassBasedHeapAnalyzer ( bool  fShowAllocations = false  )  [protected]

Create a new ClassBasedHeapAnalyzer.

Parameters:
 fShowAllocations true if allocations should also be shown


The documentation for this class was generated from the following file:
Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.