Problem 1503 - lost block of memory
Summary: lost block of memory
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: visualization/management (show other problems)
Version: 9.6
Hardware: All All
: P5 trivial
Assignee: John.Allison
URL:
Depends on:
Blocks:
 
Reported: 2013-07-26 20:08 CEST by Spencer
Modified: 2013-07-29 14:15 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Spencer 2013-07-26 20:08:50 CEST
I ran valgrind on my program to find a memory leak and stumbled upon this message warning of a a lost block in G4VisManager.cc 

==19658== 362 (192 direct, 170 indirect) bytes in 1 blocks are definitely lost in loss record 28,528 of 28,838
==19658==    at 0x4C2C7A7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19658==    by 0x604FB3F: G4VisManager::RegisterMessengers() (G4VisManager.cc:437)
==19658==    by 0x604EEA0: G4VisManager::Initialise() (G4VisManager.cc:310)
==19658==    by 0x43978B: G4VisManager::Initialize() (G4VisManager.icc:33)
==19658==    by 0x438789: main (K37.cc:162)

Looking at the relevant piece of code in G4VisManager.cc with some context 

 436   
 437   directory = new G4UIdirectory ("/vis/touchable/");               
 438   directory -> SetGuidance ("Operations on touchables.");          
 439   directory = new G4UIdirectory ("/vis/touchable/set/");
 440   directory -> SetGuidance ("Set vis attributes of current touchable.");
 441   fDirectoryList.push_back (directory);
 442   RegisterMessenger(new G4VisCommandsTouchableSet);                
 443   
 444   directory = new G4UIdirectory ("/vis/viewer/");
 445   directory -> SetGuidance ("Operations on Geant4 viewers.");      
 446   fDirectoryList.push_back (directory);

It looks like there should be a call to fDirectoryList.push_back (directory); added between the current lines 438 and 439 because the fDirectoryList is what is responsible for calling the delete operator in the destructor.
Comment 1 John.Allison 2013-07-29 14:15:30 CEST
Thanks for this.  An oversight.  mea culpa.  It will be fixed in the next release.