RE: ChangeFile() seg. violation?

From: Philippe Canal <>
Date: Wed, 29 Jun 2005 13:24:43 -0500


Your snippets of code seems correct. You may want to first try to use a newer version of ROOT. The current production release is 4.04/02. If this is no possible (or the problem is still present in 4.04/02, we would need as much detail as possible to be able to help (full running example, stack trace of the crash, result of running with valgrind, etc .. ).

The file size limit is about 2Gb.


-----Original Message-----
From: [] On Behalf Of Christopher Doran
Sent: Wednesday, June 29, 2005 10:45 AM
Subject: [ROOT] ChangeFile() seg. violation?

Hello there,
First off, I am using version 3.05/07. I am trying to chain together a large number of large files (i.e. ~400 files at ~300MB each), create a tree that is a condensed version of the one in the chained files, and fill that tree with the data from the files.

I know the code works for a tree smaller than the max tree size. Now, I'm trying to run it over the entire data set. After spending a long time filling the tree, Fill() automatically created a second output file. I hadn't read about the ChangeFile() method yet so I was suprised but happy. Then, 5 seconds later, I got a segmentation violation. The first file filled up at about 1.9 GB but nothing made it into the second file.

I've run it again and received the same error. Then I found the ChangeFile() method and tried to implement it manually when the tree reached a much smaller size. If there were any file size or space issues, that should've taken care of it. However, I still get the segmentation violation error after running it over a chain of only ten files. Here's what I'm trying to do:

   Int_t nentries = Int_t(fChain->GetEntries());    Int_t nbytes = 0, nb = 0;

   TFile *myFile1 = new TFile("condensed.root","recreate");    TTree t1("T", "QCD Condensed Ntuple");

   //creating lots of branches, nothing interesting

   for (Int_t jentry=0; jentry<nentries;jentry++) {

      	nb = fChain->GetEntry(jentry);  
        nbytes += nb;


	if(nbytes > 10000000){
		t1.ChangeFile(myFile1);  //added this after first error
		nbytes = 0;
   }            //--- loop over events

   myFile1 = t1.GetCurrentFile(); //added this after first error    myFile1->Write();

Can anyone tell me what's going wrong? Also, what is the maximum tree size for version 3.05/07 and is there a maximum file size? Thanks a lot for any help, this is my first post and I'm pretty new to ROOT!

Chris Doran
SULI Student, FNAL
DePauw University Received on Wed Jun 29 2005 - 20:25:36 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:10 MET