Message: Re: memory management of G4VUserTrackInformation Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: memory management of G4VUserTrackInformation 

Keywords: G4VUserTrackInformation
Forum: Event and Track Management
Re: None memory management of G4VUserTrackInformation
Date: 08 May, 2003
From: Tom Roberts <Tom Roberts>

> [in G4VUserTrackInformation.hh]
> // Concrete class derived from this class MUST use G4Allocator
> //     for memory management

Hmmm. I had not noticed this, and am about to use G4VUserTrackInformation, so I would like an answer to this, too.

The standard way to do something like this in C++ is to give G4VUserTrackInformation its own operator new and operator delete functions (presumably using G4Allocator), and to caution the user not to override them. The reason this is important is because ~G4Track() is supposed to delete the G4VUserTrackInformation of the track, and it needs to know how to do that.

Looking at the code, it appears to me that this comment is incorrect: ~G4Track() merely does delete fpUserInformation, and that is ultimately going to call G4VUserTrackInformation::operator delete. That delete operator is not defined, and will therefore be the default delete operator. So as long as you don't override operator delete you'll get the one from G4VUserTrackInformation, and that should be just fine.

Has anybody actually used G4VUserTrackInformation? What really happens?

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "Re: memory management of G4VUserTrackInformation"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]