GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Bugs, Fixes, Releases » [FIXED] FairWriteoutBuffer::FillNewData and object ownership (memory leak)
Re: FairWriteoutBuffer::FillNewData and object ownership (memory leak) [message #14415 is a reply to message #14414] Thu, 31 January 2013 14:24 Go to previous messageGo to previous message
Oliver Merle is currently offline  Oliver Merle
Messages: 13
Registered: December 2010
occasional visitor
From: *wlan.uni-giessen.de
Thank you, Tobias.

Just as an opinion: the most elegant way - from the beginning - would have been to design FairWriteoutBuffer as a template FairWriteoutBuffer<t_digit, t_modify_functor > which is derived from base FairWriteoutBufferBase (<=> your current FairWriteoutBuffer). This way the compiler would autogenerate the boilerplate code which users currently have to implement. The only class the user would have to add is a custom modify functor in case he needs one.

The digit at the user side would be allocated on the stack and passed as const t_digit & (-> no new, no leak). This would decouple user and framework code so that you never run into these ownership problems.

Nevertheless, it doesn't hurt much to add the classes by hand. I mean ... you don't want to sell this package and scientists aren't too picky when it comes to copy and paste Wink

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [FIXED] magnet geometry simulation problem
Next Topic: [WONTFIX] sep12 external package crash during installation on fedora 18
Goto Forum:
  


Current Time: Sun Apr 28 06:47:06 CEST 2024

Total time taken to generate the page: 0.02096 seconds