Message: memory error when creating many Histogram1D's Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question memory error when creating many Histogram1D's 

Forum: Analysis
Date: 04 Jul, 2007
From: Victor_Makarov <Victor_Makarov>

Hi! I wanted to create 4 Histogram1D's for my analysis (before that I worked with 2 - it was ok) I have tested my example on 2 platforms: Windows+Cygwin+Jaida (AIDAJNI-3.2.3 and JAIDA-3.2.4) and Sc.Linux 4.4 + Jaida. Both times my program run crashes complaining about memory (Linux message - *** glibc detected *** malloc(): memory corruption (fast): 0x0913a518 ***)! I don't know. Maybe I have my RunAction not written in a proper way but I inherited it from one of the examples and just wanted to use some more histograms. Here are the parts of it responsible for histograms:

RunAction::RunAction()
:af(0), tree(0)
{
  histo[0] = 0;
  histo[1] = 0;
  histo[2] = 0;
  histo[3] = 0;

#ifdef G4ANALYSIS_USE 
 // Creating the analysis factory
 af = AIDA_createAnalysisFactory();

 if (af) {
   // Creating the tree factory
   AIDA::ITreeFactory* tf = af->createTreeFactory();

   // Creating a tree mapped to an hbook file.
   G4bool readOnly  = false;
   G4bool createNew = true;
   G4String options =  "--noErrors uncompress";
   tree = tf->create("testem4.XML" ,"XML" ,readOnly,createNew, options);
   delete tf;

   if (tree) {
     // Creating a histogram factory
     AIDA::IHistogramFactory* hf = af->createHistogramFactory(*tree);

     // Creating the histogram
     histo[0]=hf->createHistogram1D
                         ("1","Neutrons reaching detector with energies 0-1 keV",140,0.1,14.1);
     histo[1]=hf->createHistogram1D
                         ("2","Neutrons reaching detector with energies 1-100 keV",140,0.1,14.1);
     histo[2]=hf->createHistogram1D
                         ("3","Neutrons reaching detector with energies 100-1000 keV",140,0.1,14.1);
     histo[3]=hf->createHistogram1D
                         ("4","Neutrons reaching detector with energies more than 1 MeV",140,0.1,14.1);

     delete hf;
     G4cout << "\n----> Histogram tree is opened" << G4endl;
   }
 }
#endif  
}
When I reduce to 3 histograms the executable manages to run without memory errors.
Don't pay attention to parameters of Histogram1D's.

Thanks.

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

1 None: Re: memory error when creating many Histogram1D's   (Andreas Pfeiffer - 04 Jul, 2007)
1 None: Re: memory error when creating many Histogram1D's   (Victor - 04 Jul, 2007)
(_ None: Re: memory error when creating many Histogram1D's   (Andreas Pfeiffer - 04 Jul, 2007)
2 None: Re: memory error when creating many Histogram1D's   (Kazuyoshi Furutaka - 04 Jul, 2007)
1 None: Re: memory error when creating many Histogram1D's   (Andreas Pfeiffer - 04 Jul, 2007)
(_ None: Re: memory error when creating many Histogram1D's   (Kazuyoshi Furutaka - 04 Jul, 2007)
3 Ok: Re: memory error when creating many Histogram1D's   (Victor - 06 Jul, 2007)
 Add Message Add Message
to: "memory error when creating many Histogram1D's"

 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 ]