Re: tracking memory leaks and suggestion

From: Alv Kjetil Holme (a.k.holme@fys.uio.no)
Date: Thu Jun 15 2000 - 09:05:12 EDT

  • Next message: Alv Kjetil Holme: "A new package and a few minor changes in BRAT"

    On Wed, 14 Jun 2000 hagel@comp.tamu.edu wrote:
    
    > Hello,
    > I should have been more clear.  The object statistics root keeps apply only to
    > root objects, that is objects that inherit from TObject.  For your objects that
    > don't inherit from anything, you are on your own as far as I know.  If you go
    > ahead and do what you suggest, you will be reinventing in a crude (perhaps elegant
    > if I am underestimating) way what the root guys do for the objects that inherit
    > from TObject.
    
      You can sort of keep track of other objects or at least the memory they
    allocate and free by using the ROOT Storage Manager (TStorage) and the
    custom ROOT new and delete operators (in libNew.so).
      You enable statistics gathering by the Root.MemStat resource (in
    .rootrc). TStorage::PrintStatistics() gives a list of block size, number
    of blocks allocated, number of blocks freed and the difference.
    
      You can get ROOT to trap and dump core when a block of a certain size
    (specified by Root.MemStat.size) is allocated. The resource
    Root.MemStat.cnt specifies after how many allocations the trap will
    occur. Afterwards you can use the debugger and the core dump to figure out
    where the allocation occured.
    
      -Alv Kjetil
    



    This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 09:09:29 EDT