Problem 1583 - Memory leak in G4Step
Summary: Memory leak in G4Step
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: track (show other problems)
Version: 10.0
Hardware: All All
: P5 normal
Assignee: kurasige
URL:
Depends on:
Blocks:
 
Reported: 2014-03-06 12:01 CET by Alberto.Ribon
Modified: 2014-03-07 07:25 CET (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Alberto.Ribon 2014-03-06 12:01:38 CET
Federico Carminati has found a memory leak in G4Step.icc.
He found the problem in G4 9.6.p02, but it should be there also for G4 10.0.

The problem can be fixed as follows:

1) In the method: void G4Step::SetPreStepPoint(G4StepPoint* value)
   add the line:
      delete fpPreStepPoint;
   just before the line:
      fpPreStepPoint = value;

2) In the method: void G4Step::SetPostStepPoint(G4StepPoint* value)
   add the line:
      delete fpPostStepPoint;
   just before the line:
      fpPostStepPoint = value;
Comment 1 kurasige 2014-03-07 07:25:46 CET
Hi, Alberto

  Thank you for reporting problem.
  I've made bug-fixed tag of track-V10-00-01.

  By the way, could you explain the use case of SetPre/PostStepPoint. These methods have been provided from the alpha-release because these methods were added by RougeWave code generation. As far as I know, these methods have not been used in Geant4, because It is difficult to create a new step point because of handling touchable. Now I'm thinking to delete (or hide) these methods to avoid problems at the creation of step points by users.

Cheers,
   Hisaya