next up previous contents index
Next: References Up: Finalization Previous: Weak Pointers

The Heap Walker

There is a simple class called GCVerify  that can be used to verify the integrity of a complex allocated data structure. This is frequently useful during the development of a new collector, or a complex class derive class of GCObject.

The interface of this class is shown below.

   class GCVerifier : protected GC {
   public:
      virtual bool is_valid_pointer          (GCObject *);
      virtual bool is_valid_interior_pointer (GCObject *);
      virtual bool is_valid_structure        (GCObject *);
      virtual bool is_valid_pointer          (GCObject *, GC *);
      virtual bool is_valid_interior_pointer (GCObject *, GC *);
      virtual bool is_valid_structure        (GCObject *, GC *);
      size_t number_of_nodes() const;
   };

Class GCVerify  is derived from class GC  so that the same object tracing protocol can be used. Briefly, three different methods are provided for verification:

There are alternative versions of the same methods that assumes the default collector is used. Furthermore



Allen Leung
Mon Apr 7 14:33:55 EDT 1997