Problem 122

Summary: Error in initialization when larger number of materials is defined
Product: Examples/Basic and Novice Reporter: Ivana.Hrivnacova
Component: N04Assignee: Makoto.Asai
Status: RESOLVED WONTFIX    
Severity: critical CC: asai, Isidro.Gonzalez.Caballero, kurasige
Priority: P2    
Version: 2.0   
Hardware: HP   
OS: HP-UX   
URL: /afs/cern.ch/user/i/ivana/public/g4initialization

Description Ivana.Hrivnacova 2000-07-05 10:09:50 CEST
The problem can be reproduced with example N04, when 500 materials
are added.
After modifying ExN04DetectorConstruction.cc:
---
  G4Material* Scinti = new G4Material(name="Scintillator", density, nel=2);
  Scinti->AddElement(elC, 9);
  Scinti->AddElement(elH, 10);
--- changed to:
  G4Material* Scinti;
  for (G4int im=0; im < 500; im++) {
    density = 1.032*g/cm3;
    Scinti = new G4Material(name="Scintillator", density, nel=2);
    Scinti->AddElement(elC, 9);
    Scinti->AddElement(elH, 10);
  }
---
program breaks.
From debugger output there seems to be a problem with
G4RWTValOrderedVector::resize().

I've put the modified ExN04DetectorConstruction.cc
together with the error output into:
/afs/cern.ch/user/i/ivana/public/g4initialization
Comment 1 Gabriele Cosmo 2000-07-26 03:45:59 CEST
Cannot find anything wrong in vector handling for STLinterface.
The problem is originated when trying to build the physics table.
It may be induced by memory management problems in the materials module,
as already reported in bug #106 and not yet flagged as examined, where memory
may have been corrupted. A more deep investigation is required.
The application dies after that memory growed to 135MB, with the following
trace:

#0  0x7aff9130 in kill () from /usr/lib/libc.1
#1  0x7af5eb24 in raise () from /usr/lib/libc.1
#2  0x7af3ef38 in _sigaddset () from /usr/lib/libc.1
#3  0x7af39d64 in abort () from /usr/lib/libc.1
#4  0x7adb7fa8 in terminate () from /usr/lib/libCsup.1
#5  0x7adb868c in ThrowException () from /usr/lib/libCsup.1
#6  0x7adb8e38 in __throw__FPvT1 () from /usr/lib/libCsup.1
#7  0x7adbaaf0 in operator new () from /usr/lib/libCsup.1
#8  0x118744 in insert_aux__6vectorXTdT9allocator_FPdRCd ()
#9  0x4afc88 in resize__21G4RWTValOrderedVectorXTd_FUi ()
#10 0x4b09ac in __ct__18G4PhysicsLogVectorFdT1Ui_2 ()
#11 0x344668 in G4MultipleScattering::BuildPhysicsTable ()
#12 0x15f7e0 in G4VUserPhysicsList::BuildPhysicsTable ()
#13 0x15f0e0 in G4VUserPhysicsList::SetCutValueForOthers ()
#14 0x15edc4 in G4VUserPhysicsList::SetCutsWithDefault ()
#15 0xe4e60 in ExN04PhysicsList::SetCuts ()
#16 0x15be74 in G4RunManager::InitializeCutOff ()
#17 0x15bbf8 in G4RunManager::Initialize ()
#18 0xb430c in main ()
Comment 2 Gabriele Cosmo 2000-07-26 06:18:59 CEST
Other possibility: running out of memory ?
Tested on hpplus, where phys-memory is 512MB.
Application growed to 135MB.
If there's a memory limit per process/user...