delete f;
delete newtree;The TTree read and wrote to a TFIle belong to the TTree object and hence are deleted when you delete the file (and thus the above code lead to a double delete).
[quote]i remove it, but after that i see that my memory is increasing (probably not deleting everything)[/quote]PLease use valgrind (valgrind.kde.org) to track those leak down.
[quote]the problem with the memory that i can’t delete is after this command
Code:
TTree newtree = (TTree)chain->CloneTree();[/quote]
You do not need to delete it. It is owned by the TFile object.
Philippe
[quote=“pcanal”][quote]the problem with the memory that i can’t delete is after this command
Code:
TTree newtree = (TTree)chain->CloneTree();[/quote]
You do not need to delete it. It is owned by the TFile object.
Philippe[/quote]
when i close the file memory (RAM) is not free-ing
[quote]when i close the file memory (RAM) is not free-ing[/quote]From your descriptions, I do not see why this is the case nor how you assert this fact. I recommend that you try valgrind (valgrind.kde.org) to narrow down the source of the leak (if any).
Cheers,
Philippe.
PS. Alternatively, provide a complete running example showing your problem as well as what you see/observe when running it and what is different from your expectation.