Error: memory allocation

Greetings,

I am running this program for n number of files.
void test()
{
TChain *chTree = new TChain(“tree”);
char *filespec = “file”;
chTree->Add(filespec);
int numEvts= chTree->GetEntries();
for ( int jentry=0; jentry<numEvts ; jentry++ ){
chTree->GetEntry(jentry); // -->LINE:112
}//jentry

It works when I use small n number of files but when I use large number of files it turns the following error.

Error: G__getvariable: expression test.C:112:
Error: Can not access pointer to function 0x0 from interpreter(1)
FILE:/./test.C LINE:112
Error: $()2076181688 Syntax error? test.C:112:
Syntax Error: * test.C:112:
Error: Illegal pointer operation (tovalue) test.C:112:
Error: memory allocation for (
(*)2076181688) size=4 pinc=1
FILE:./test.C LINE:112
*** Interpreter error recovered ***

Do you have an idea on how to solve this problem. Please let me know if I did not include enough information.

Thanks,

The snippets code you sent is fine. Something else you are doing and/or the content of your files must be corrupting the memory.

Cheers,
Philippe.

PS. Aka please provide a complete example if you would like us to take a close look.

In that case I need to send you an example of the root analysis tree. The file is 56 MB. What would be the best way to send this file to you.

Hi,

You can either make it available on afs or via an ftp site or via a web site.

Cheers,
Philippe

Hi,

The process is running out of memory in your case. Your ‘tree’ has many friends tree. Some of those friend trees contains std::vector of object and some event have a very large number of elements. For example look at the result of [code]root [0] TFile *_file0 = TFile::Open(“file.root”)
root [1] InitialHitSeriesReco->Scan(“I3RecoHit@.size()”,"",“colsize=20”)


  • Row * I3RecoHit@.size() *

  •    0 *                   22 *
    
  •    1 *                  186 *
    
  •    2 *                  307 *
    

  •  146 *                17251 *
    
  •  147 *              1777502 *
    
  •  148 *                  137 *
    

[/code]So in the entry number 147, there is more than one million and a half elements in the array. Is that really what you expect?
In addition, the compression factor of this tree is 10 (see the output of InitialHitSeriesReco->Print()) which usually means that their might be a problem with the data.

Cheers,
Philippe.