Problem 756

Summary: possible memory leak in G4Navigator on Mac OS 10.3
Product: Geant4 Reporter: ldi00a
Component: eventAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 7.0   
Hardware: All   
OS: Other   

Description ldi00a 2005-06-23 11:13:46 CEST
I have noticed that there appears to be a memory leak in my simulations. So I
used apple's malloc debug program and it reports a leak with
G4Navigator::LocateGlobalPointAndUpdateTouchableHandle
this is the last function before G4AllocatorPool::Grow() is called. This shows
up in both my simulation and several of the examples I have tested. For my
simulation the program grows at about 10.7 KB per event.

I have compiled geant 4.7.0.p01 on Mac OS 10.3 running on a dual 1.8 GHz G5
using apple's version of gcc 3.3, which is the one included with xcode.
Comment 1 Gabriele Cosmo 2005-07-08 05:33:59 CEST
The call to LocateGlobalPointAndUpdateTouchableHandle() from G4Navigator is
supposed to create a handle and leave the responsibility to the caller for its
deletion. The user should check in his simulation code what use he is doing of
touchable-handles, a possible side-effect can be for example the attempt to keep
an handle in one of the generated objects (hits for example), therefore
unnecessarily creating new ones at each generation of a hit....