From 0a97a08e1c6a8a21306408980a0521b89559d09a Mon Sep 17 00:00:00 2001 From: skowron Date: Thu, 19 Feb 2004 09:14:27 +0000 Subject: [PATCH] memory leaks removed; --- HBTAN/AliHBTEventBuffer.cxx | 18 ++++++++++++++++++ HBTAN/AliHBTEventBuffer.h | 12 +++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/HBTAN/AliHBTEventBuffer.cxx b/HBTAN/AliHBTEventBuffer.cxx index a97478e12bd..60141efc3d3 100644 --- a/HBTAN/AliHBTEventBuffer.cxx +++ b/HBTAN/AliHBTEventBuffer.cxx @@ -8,6 +8,10 @@ ClassImp(AliHBTEventBuffer) // class AliHBTEventBuffer // // FIFO type event buffer +// +// Piotr.Skowronski@cern.ch +// +//////////////////////////////////////////////////////// AliHBTEventBuffer::AliHBTEventBuffer(): fSize(-1),fEvents(),fIter(&fEvents) @@ -15,11 +19,25 @@ AliHBTEventBuffer::AliHBTEventBuffer(): //ctor } /***********************************************************/ + AliHBTEventBuffer::AliHBTEventBuffer(Int_t size): fSize(size),fEvents(),fIter(&fEvents) { //ctor } +/***********************************************************/ + +AliHBTEventBuffer::~AliHBTEventBuffer() +{ + //dtor -- TList::IsOwner(1) does not work - Valgrind says that there is mem leak + //take care owerseves + if (fEvents.IsOwner()) + { + AliHBTEvent* e=0x0; + while (( e=RemoveLast() )) delete e; + } +} +/***********************************************************/ AliHBTEvent* AliHBTEventBuffer::Push(AliHBTEvent* event) { diff --git a/HBTAN/AliHBTEventBuffer.h b/HBTAN/AliHBTEventBuffer.h index 0d25535c9ea..f3804e2f646 100644 --- a/HBTAN/AliHBTEventBuffer.h +++ b/HBTAN/AliHBTEventBuffer.h @@ -1,5 +1,15 @@ #ifndef ALIHBTEVENTBUFFER_H #define ALIHBTEVENTBUFFER_H +//______________________________________________________ +//////////////////////////////////////////////////////// +// +// class AliHBTEventBuffer +// +// FIFO type event buffer +// +// Piotr.Skowronski@cern.ch +// +//////////////////////////////////////////////////////// #include #include @@ -10,7 +20,7 @@ class AliHBTEventBuffer: public TObject public: AliHBTEventBuffer(); AliHBTEventBuffer(Int_t size); - virtual ~AliHBTEventBuffer(){} + virtual ~AliHBTEventBuffer(); AliHBTEvent* Push(AliHBTEvent* event);//adds a new event, and returns old of do not fit in size AliHBTEvent* RemoveLast(){return dynamic_cast(fEvents.Remove(fEvents.Last()));} -- 2.31.1