hi,
unfortunately, in the g4 documentation i was unable to find any relevant references about the general philosophy on object memory ownership model. we namely have a large legacy code base written in many years by many authors with very different levels of c++ comprehension so that the code is full of "new"s but very scarsely populated with "delete"s. unlike a typical example of running setup once, firing the particles, and then basically exiting the program, we have to be able to run the whole cycle repeatedly, in a loop if necessary. this crates a lot of memory-leak warnings from address sanitizer and valgrind, but simply remembering all the created pointers and deleting them at the end also does not work.
is there some specific documentation about the general principles of ownership in g4? which functions/classes/methods take over the ownership and which do not? one would have thought this kind of information should be readily available with every function/method documented, but i could not find any trace of it. i am very surprised this is (a) not asked more frequently by users who want to avoid memory leaks and (b) that for such an important toolkit this is not some kind of a urgent priority.
i am sorry if this questions arise just because of my ignorance and this information is clearly available somewhere else. thanks in advance for pointing out the hidden place of information treasure.
best,
darko.