Suppose I’ve a TFile containing a TTree and inside it some vector branches, and I want to read it, for example:
vector<float> *truth_ph_pt; vector<float> *truth_ph_E; TBranch *b_truth_ph_pt; //! TBranch *b_truth_ph_E; //! truth_ph_pt = 0; truth_ph_E = 0; fChain->SetBranchAddress("truth_ph_pt", &truth_ph_pt, &b_truth_ph_pt); fChain->SetBranchAddress("truth_ph_E", &truth_ph_E, &b_truth_ph_E);
for every event I call GetEntry(i), but my question is what appens to the vectors object allocated for the previous events? For example, when the loop loads the event 0 with GetEntry(0) it load the vectors from the TFile to the memory, right? But when the first loop it finished the memory used by the two vectors in the example is free? Or I need to call manually something like truth_ph_pt->clear() (or delete truth_ph_pt)?
My problem is that I’ve a big TChain with a lot of vectors branches and my proof session crashes when the memory used reaches the maximum. I don’t know why it need so much memory, if I look at the plot on a ganglia monitor I see that the profile of the memory (ram + swap) is like a sqrt(time).