GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Bugs, Fixes, Releases » [FIXED] Memory leak in PndSttHitProducerRealFull / PndFtsHitProducerRealFull?
[FIXED] Memory leak in PndSttHitProducerRealFull / PndFtsHitProducerRealFull? [message #17671] Thu, 18 December 2014 15:27 Go to next message
MartinJGaluska is currently offline  MartinJGaluska
Messages: 203
Registered: March 2010
Location: Germany
first-grade participant
From: *physik.uni-giessen.de
Hello all,

while looking for memory leaks in my own code, I have possibly found memory leaks in the above two classes (actually in some more):

From PndSttHitProducerRealFull.cxx ( https://subversion.gsi.de/trac/fairroot/browser/pandaroot/trunk/stt/PndS ttHitProducerRealFull.cxx) lines 86-87:
  PndSttMapCreator *mapper = new PndSttMapCreator(fSttParameters);
  fTubeArray = mapper->FillTubeArray();

I have not found any
delete mapper;

and I am wondering if this is done intentionally in that way for some reason which I don't know about or whether this is a bug.

Would that also be correct?
  PndSttMapCreator mapper(fSttParameters);
  fTubeArray = mapper.FillTubeArray();


Kind regards,
Martin

[Updated on: Fri, 19 December 2014 21:53] by Moderator

Report message to a moderator

Re: Memory leak in PndSttHitProducerRealFull / PndFtsHitProducerRealFull? [message #17675 is a reply to message #17671] Thu, 18 December 2014 17:26 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *to.infn.it
Has valgrind reported about such line?
Re: Memory leak in PndSttHitProducerRealFull / PndFtsHitProducerRealFull? [message #17676 is a reply to message #17671] Thu, 18 December 2014 18:34 Go to previous messageGo to next message
Lia Lavezzi
Messages: 291
Registered: May 2007
Location: Torino
first-grade participant

From: *to.infn.it
Hi Martin,
I probably forgot the delete, but the mapper is created with the new in the Init() so only once per run. I will fix it tomorrow.
Ciao,
Lia.


On 19 dec: Done, changed *mapper to mapper everywhere (I hope!).

[Updated on: Fri, 19 December 2014 09:37]

Report message to a moderator

Re: Memory leak in PndSttHitProducerRealFull / PndFtsHitProducerRealFull? [message #17677 is a reply to message #17676] Thu, 18 December 2014 19:17 Go to previous messageGo to next message
MartinJGaluska is currently offline  MartinJGaluska
Messages: 203
Registered: March 2010
Location: Germany
first-grade participant
From: *physik.uni-giessen.de
Thank you, I was not sure if it was by intention or not.
Re: Memory leak in PndSttHitProducerRealFull / PndFtsHitProducerRealFull? [message #17678 is a reply to message #17675] Thu, 18 December 2014 19:19 Go to previous messageGo to next message
MartinJGaluska is currently offline  MartinJGaluska
Messages: 203
Registered: March 2010
Location: Germany
first-grade participant
From: *physik.uni-giessen.de
StefanoSpataro wrote on Thu, 18 December 2014 17:26
Has valgrind reported about such line?


No, I know that I have a memory leak in my code, so I was going through my code line by line. I found a line that looked like a bug to me and compared it to how others have implemented similar pieces of code. That is how I found the above line. I don't yet know how to use valgrind, but will look into how to use it.
Re: Memory leak in PndSttHitProducerRealFull / PndFtsHitProducerRealFull? [message #17680 is a reply to message #17678] Thu, 18 December 2014 21:26 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *ip70.fastwebnet.it
valgrind --leak-check=full --suppressions=/home/spataro/apr13/tools/root/etc/valgrind-root.supp root.exe -q -l reco_complete.C


where /home/spataro/apr13/ is where you have the source code of your external packages, and reco_complete.C is your macro. Run few events, you don't need many to see all the leaks.
Re: Memory leak in PndSttHitProducerRealFull / PndFtsHitProducerRealFull? [message #17686 is a reply to message #17680] Fri, 19 December 2014 14:52 Go to previous message
MartinJGaluska is currently offline  MartinJGaluska
Messages: 203
Registered: March 2010
Location: Germany
first-grade participant
From: *physik.uni-giessen.de
Thank you. After having removed one crash connected to TClonesArrays, I have tested with 10 events writing debugging output and 200 events without debugging info. Both tests passed fine.
Previous Topic: Question about using pointers to fill TClonesArray
Next Topic: please update the tracking directory
Goto Forum:
  


Current Time: Sat Jun 22 05:50:30 CEST 2024

Total time taken to generate the page: 0.00839 seconds