Linear Collider Forum



Home » Software Tools » LCIO » confusion about memory issues.
Re: confusion about memory issues. [message #1668 is a reply to message #1667] Fri, 19 December 2008 07:06 Go to previous messageGo to previous message
gaede
Messages: 233
Registered: January 2004
Location: DESY, Hamburg
Hi Yu,

the lcio manual explains the memory handling:
Quote:


LCIO Memory management in C++
The philosophy of memory management in LCIO is: " If you created the object (using new), you are responsible for deleting it when it is no longer needed !".
In order to make this easier the LCEvent will delete everything that has been attached to the event. If you are only reading, LCIO will create the objects and thus delete them (when reading the next object of the same type) - thus no need for deleting on your side.
If you are reading and adding sth. to the event it is LCIO that deletes the event (as it created it) and thus also everything attached to it - again no need for deleting on your side.
As a rule of thumb: Use delete evt/runhdr at the end of every event/run loop where you created the event/runHeader and don't use delete in all other cases.
Of course if you use your own implementation of the EVENT interface you are also responsible for the memory management.



it is really simple for the user - you can also have a look at the examples (simjob.cc, anajob.cc ,...) in $LCIO/src/cpp/src/EXAMPLE.
The LCReader/LCWriter objects should also be deleted at the end of the job (after calling close() ).

Frank.
 
Read Message
Read Message
Read Message
Previous Topic:Strange behaviour of LCEvent::takeCollection()
Next Topic:new release v01-11
Goto Forum:
  


Current Time: Wed Sep 19 13:36:30 Pacific Daylight Time 2018
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.1.
Copyright ©2001-2010 FUDforum Bulletin Board Software