[ROOT] Deletion of TGraph

From: cstrato (cstrato@aon.at)
Date: Sat Nov 30 2002 - 23:15:57 MET


Dear Rooters

In the following code, no graph is drawn if I delete graph:
    TGraph *graph = 0;
    for (Int_t i=0; i<m; i++) {
       graph = new TGraph(n, x, y);
       graph->Draw(opt);
       SafeDelete(graph);  //<== not possible
    }

However, in this code I can delete graph because DrawGraph
creates a new graph "newgraph":
    TGraph *graph = 0;
    for (Int_t i=0; i<m; i++) {
       graph = new TGraph(n, index, x);
       graph->DrawGraph(n, x, y, opt); //newgraph=new TGraph()
       SafeDelete(graph);
    }

I understand that root takes care of deleting TGraph objects,
but is this also the case when I create a standalone program
or does there exist a memory leak?


Thank you in advance for your help.

Best regards
Christian
_._._._._._._._._._._._._._._._
C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
V.i.e.n.n.a       A.u.s.t.r.i.a
_._._._._._._._._._._._._._._._



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:22 MET