TGraph2D warnings

The following lines entered in the ROOT interpreter

TGraph2D *gr2d_mean_x = new TGraph2D();
TGraph2D *gr2d_mean_y = new TGraph2D();

generate the warning:
Warning in TGraph2D::Build: Replacing existing 2D graph: Graph2D (Potential memory leak).

Is this is a spurious warning, or is there something wrong with having more than one TGraph2D object?


It is just a warning. You should not worry about it. I will fix it for the next version. Graph2Ds behave like histograms (TH1, TH2 …), they are stored in the current directory is they have a name. And, as for histograms, unmaned Graph2D should not be store and therefore no warning should be printed.