Warning in <TFile::Append>: Replacing existing TH1: Hi

My program is giving me the error [color=blue]Warning in TFile::Append: Replacing existing TH1: Histo_2D(Potential Memory leak)[/color]
How does one fix this?

I am using ROOT 5.20 under Fedora 9.

Warning in TFile::Append: Replacing existing TH1: Histo_2D(Potential Memory leak)

The program reads ESRF edf images from hard disk(2048x2048) pixel by pixel, processes them and then puts them into 2D histograms.

The out put is good up to line 224 in the program, that is [color=green]h2_small->Print();[/color]

This is the out put below:
Reading setup file

0.0001 : ang_step
-0.004 : ang_first
82 : steps
0.0045 : dispersion

found 4 input paramters

Will read the file xxxxx0041.edf

The size of the 2D histogram side is 2048

Making Root Objects
xlow = 574 ylow = 1035 nbins1 = 564
TH1.Print Name = h2_small, Entries= 318096, Total sum= 3.894e+08
Warning in TFile::Append: Replacing existing TH1: Histo_2Db (Potential memory leak).
Warning in TFile::Append: Replacing existing TH1: Histo_2Dc (Potential memory leak).
Warning in TFile::Append: Replacing existing TH1: Histo_2Dd (Potential memory leak).

*** Break *** segmentation violation
(no debugging symbols found)
Using host libthread_db library “/lib/libthread_db.so.1”.
Attaching to program: /proc/3374/exe, process 3374
(no debugging symbols found)…done.
(no debugging symbols found)
0x00110416 in __kernel_vsyscall ()
Missing separate debuginfos, use: debuginfo-install expat.i386 fontconfig.i386 freetype.i386 gcc.i386 giflib.i386 glibc.i686 libICE.i386 libSM.i386 libX11.i386 libXau.i386 libXcursor.i386 libXdmcp.i386 libXext.i386 libXfixes.i386 libXft.i386 libXpm.i386 libXrender.i386 libjpeg.i386 libpng.i386 libtiff.i386 libxcb.i386 zlib.i386
#1 0x01264953 in __waitpid_nocancel () from /lib/libc.so.6
#2 0x01208bab in do_system () from /lib/libc.so.6
#3 0x010a48dd in system () from /lib/libpthread.so.0
#4 0x00413cdd in TUnixSystem::Exec ()
from /home/dube/Physics/Analysis/root/lib/libCore.so.5.19
#5 0x00418fe7 in TUnixSystem::StackTrace ()
from /home/dube/Physics/Analysis/root/lib/libCore.so.5.19
#6 0x004174ee in TUnixSystem::DispatchSignals ()
from /home/dube/Physics/Analysis/root/lib/libCore.so.5.19
#7 0x004175bd in SigHandler ()
from /home/dube/Physics/Analysis/root/lib/libCore.so.5.19
#8 0x004112c4 in sighandler ()
from /home/dube/Physics/Analysis/root/lib/libCore.so.5.19
#10 0x0122ab05 in fgets () from /lib/libc.so.6
#11 0x0804a276 in edf2text ()
#12 0x0804bac7 in main ()
The program is running. Quit anyway (and detach it)? (y or n) [answered Y; input not from terminal]
Detaching from program: /proc/3374/exe, process 3374

analyse.cpp (14.6 KB)


This topic has been discussed extensively in the past, do a search on

“Replacing existing TH1”

and see for instance

root.cern.ch/phpBB2/viewtopic.ph … isting+th1


I have read posts with a seaming “similar” problem but it has not solved my issue. Now I just get a segmentation fault without the warning about potential memory leak.

Please help?



Your trace tells that the segv happens in the routine “edf2text” during
a gets . That routine seems to be an exercise in C io, not a ROOT
related statement in sight . So please go in the debugger and step
through the code and surely you will find the problem .


Problem solved!
Thanks Eddy, sorted out the problem … in edf2txt!