[ROOT] TPad memory problems in GUI

From: Robert Michaels (rom@jlab.org)
Date: Tue Sep 18 2001 - 02:53:53 MEST


I have two systems, both running root 3.01-06 (compiled on each system).

System I:  RedHat 6.2 kernel  2.2.19-6.2.7 
System II:  RedHat 7.1  kernel 2.4.8 

I have a complicated GUI.  I suppose I should show a simple example of
my problem, but let's see if I can get a hint from this description.

My GUI makes creates a "new TCanvas" in which it makes other new TPad's
and then uses TH1F::DrawCopy to draw histograms so that the TPad's own
the THistPainter and whatever else is created by DrawCopy. 

At first I observed memory leaks, but on "System I" this was solved
by deleting the TPad's and TCanvas's I "new'd" before trying to "new" 
again.   Also by usinig TH1F::DrawCopy.  The method gObjectTable::Print()
and "top" verified a stable total heap size.

Then I had a problem when deletion occurred by pressing "X" in the
top right side of the window to delete the TCanvas "by hand" (or if one
used the TCanvas's File->Delete in top left of canvas to delete).  
I tried to use the TPad::IsRetained()  method to see if a TPad had
been deleted.  If it IsRetained was kFALSE, I didn't try to delete again,
and the code was stable on System I.   Perhaps this was an accident
since the IsRetained method belonged to a TPad that "X" presumably
deleted.  Nevertheless it seemed to work.  However, on System II, I get
segmentation faults, and IsRetained always returns kTRUE. 

My question is :  How can I tell if a TPad object was deleted ?
(This is probably very basic C++ ...)

Thanks !
------------------------------------------------------
Robert W. Michaels      
www.jlab.org/~rom
phone (757) 269 7410   pager (757) 881 7897
Thomas Jefferson National Accelerator Facility
12000 Jefferson Ave, Newport News, VA 23606 USA



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:00 MET