Re: [ROOT] Problem using new Branch() with TString?

From: cstrato@EUnet.at
Date: Mon Jun 18 2001 - 22:09:13 MEST


Dear Rene

Thank you for this suggestion, I will try it as soon as possible.
Meanwhile I realized that sometimes it works, but most of the time
it crashes, so this may be a memory problem.

Could it be a problem with the storage of TString, since I am not sure
if I handle strings correctly:
In my class I have "TString fName" as member variable.
In the constructor I initialize  it to the empty string"fName = "";".
Only in a later function I set fName to a real name. Nowhere did I
reserve memory for TString.

My question now is:
Is it necessary to reserve memory for TString?
How do I have to reserve memory? (fName = TString(32); ?)

Thank you once more for your help

Best regards
Christian


Rene Brun wrote:

> Hi Christian,
>
> You can have your libraries where you want. They don't need to be
> in $ROOTSYS/lib !
> Concerning your problem, you do not provide enough information.
> Did you set the branch address ?
> You can get an idea of what happens (with version 3.01/05) by activating
> the debug flag. Just before the loop on entries, add the statement
>   gDebug = 2;  (in TSystem.h)
>
> Rene Brun
>
> On Sat, 16 Jun 2001 cstrato@EUnet.at wrote:
>
> > Dear Rene
> >
> > Thank you for your suggestion. Sorrowly, the problem persists
> > with version 3.01/05.
> >
> > Regarding your second suggestion, until now I have not been
> > able to extract a subset where the problem can be reproduced.
> > I have tried to create test classes, but the problem never
> > appeared.
> >
> > However, I know exactly where the program crashes:
> > // The following command is still ok:
> >    Int_t  vNEntries = (Int_t)(vTree->GetEntries());
> > cout << "vNEntries <" << vNEntries << ">" << endl;
> >    for (Int_t i=0;i<vNEntries;i++) {
> > // The following line crashes!!
> >       vTree->GetEntry(i);
> >       some code;
> >    }//for_i
> >
> > Although there are entries in the tree, it cannot get the
> > entries.
> > Maybe, you can give me some hints where to look further?
> >
> > I have seen that the option Bronch() requires access to the
> > library where the corresponding class is defined.
> > Since my libs are stored in /opt/rootcode maybe Bronch()
> > cannot access the corresponding library, although it is
> > loaded first with gSystem->Load(lib).
> > Could it be that I need to store my own libraries also
> > in /opt/root/lib in order for Bronch() to find the
> > corresponding class?
> >
> > Thank you for your help.
> > Best regards
> > Christian
> >



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:49 MET