[ROOT] Does this leak?

From: David Faden (dfaden@iastate.edu)
Date: Tue Nov 21 2000 - 23:53:06 MET


Hi,
   It's my understanding that when a dynamically allocated TCanvas is 
closed, it's memory is freed. Is this correct? Also, is it true that 
the memory of objects drawn into a TCanvas are deleted by the TCanvas's 
dtor? (I'm assuming that the objects have not been added to a global 
directory.)
   As it stands, does code like the following leak memory?

void displayGraph()
{
  Float_t x[100];
  Float_t y[100];
  TGraph *gr;
  TCanvas *c;
  
  for (Int_t i = 0; i < 100; i++) {
    x[i] = (Float_t) i;
    y[i] = 5.9 * x[i];
  }

  c = new TCanvas("c", "A canvas", 0, 0, 400, 400);
  gr = new TGraph(100, x, y);
  gr->Draw("PA");
  c->Modified();
  c->Update();
}

   Also, is there a method which will directly answer the question, "Is x 
a variable of this given TNtuple?" So far, the best method I've 
come up with is to first get a list of the branches of the TNtuple, then check 
each one to see if its name matches the name of the variable being 
checked for.
   Thank you very much. (Thanks too to everyone who has replied to my 
past queries.)

David



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:37 MET