RE: Memory leak of TCanvas->SaveAs in a daemon process

From: Valeri Onuchin <Valeri.Onoutchine_at_cern.ch>
Date: Wed, 19 Sep 2007 06:55:29 +0200


Hi,
TImage::Open("tmp.png"); creates a new image, so you must add "delete img;" at the end of the loop.

Regards. Valeriy

++
 what is the ROOT version?

-----Original Message-----
From: owner-roottalk_at_root.cern.ch on behalf of OKUMURA, Akira Sent: Tue 9/18/2007 10:43 PM
To: roottalk (Mailing list discussing all aspects of the ROOT system) Subject: [ROOT] Memory leak of TCanvas->SaveAs in a daemon process  

Hello ROOTers,

The line
56: can->SaveAs("tmp.png");
in "test2.cxx" causes a memory leak if I run the program as a daemon process on SL 4.4. You can see that heap memories are deleted in the end of while loop in the code. But memory leaks happen.

$ cd /home/foo
$ ls

testd test2.cxx
$ g++ -c -o test2.o test2.cxx `root-config --cflags`
$ g++ -o test2 test2.o `root-config --glibss`
$ su

# mv testd /etc/init.d
# /sbin/service testd start

Starting test2:                        [  OK  ]
# exit
$ PID=`pgrep test2` top -p $PID

You will see the used memory increase. How can I eliminate this problem?

Sincerely

OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp
Institute for Cosmic Ray Research, University of Tokyo 5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan Phone/Fax : +81 4-7136-3153
Skype : okumura.akira Received on Wed Sep 19 2007 - 06:56:59 CEST

This archive was generated by hypermail 2.2.0 : Wed Sep 19 2007 - 11:50:02 CEST