I’m having a problem with a part of my code that involves TStrings in an array. It only occurs when running the code a second or more times in the same instance of ROOT.
To fix it I tried using delete at the end of the macro to to hopefully clear the variable all together but it didn’t work either. I wrote the delete code as follows:
delete [] prop;
delete [] xmin;
delete [] xmax;
If you could provide any help, I would greatly appreciate it.
[quote]To fix it I tried using delete at the end of the macro to to hopefully clear the variable all together but it didn’t work either. I wrote the delete code as follows: [/quote]That would lead to a double deletion.
Here’s the problem code:TString prop[5]={"jet.Et","jet.Eta","jet.Phi","summary.fnTightJet","summary.fnLooseJet"};
Array of objects, especially there lifetime, is a current weakness in CINT.
In order to work around the problem you should call
gROOT->Reset()before re-executing your code (note that this should not be called from within a function).
Thanks for your reply. After typing gRoot->Reset() in ROOT, I got the following error:
Error: Symbol gRoot is not defined in current scope FILE:(tmpfile) LINE:1
Error: Failed to evaluate gRoot->Reset()Possible candidates are…
filename line:size busy function type and name
*** Interpreter error recovered ***
I’m not quite sure what that means either.
I also tried putting the line into my macro, but I got the same error.
[quote]Error: Symbol gRoot is not defined in current scope FILE:(tmpfile) LINE:1[/quote]says that you mistype gROOT. It should work with the correct casing.