manoj
1
Hi,
I am trying to create two TGraph2D and I got error:
TGraph2D *gr1 = new TGraph2D(2);
TGraph2D *gr2 = new TGraph2D(3);
error:
Warning in <TROOT::Append>: Replacing existing TGraph2D: Graph2D (Potential memory leak).
I have checked it with root 5_25 and 5_26.
Thanks.
ganis
2
Dear Manoj,
The objects are created with the same default name “TGraph2D”.
You should change the name after creation
TGraph2D *gr1 = new TGraph2D(2);
gr1->SetName("gr1_name");
TGraph2D *gr2 = new TGraph2D(3);
gr2->SetName("gr2_name");
If you already have the vectors for the graphs, you can specify the names at constructor level:
TGraph2D *gr1 = new TGraph2D("gr1_name","",2,x2,y2,z2);
TGraph2D *gr2 = new TGraph2D("gr2_name","",3,x3,y3,z3);
G. Ganis
manoj
3
Dear ganis,
Thanks. I forgot other arguments in TGraph2D.
Manoj.