Newer root version causing double memory release and seg break when calling with PyRoot using dictionaries generated with CINT

Dear ROOT & RooFit Experts,

I create a class with a member object as a pointer to RooWorkspace. Then I import a RooDataSet.
In destructor, I release the space allocated to the pointer to workspace.

When calling with compiled cxx file, the code runs without a problem.
When calling the class with PyRoot, it will have double-release seg break of:
*** glibc detected *** python: free(): invalid pointer: 0x0000000003811bd4 ***

If I don’t release the memory in destructor, both method works fine.

If I comment out the line of RooWorkspace::writeToFile(), cxx compiled code will throw a seg break, if I don’t release the memory in destructor.

The problem is produced with root 6.12.06-x86_64-slc6-gcc62-opt and it doesn’t exist in root 5.34.19-x86_64-slc6-gcc47-opt

I’m using setupATLAS and lsetup to setup the root version, but I think ATLAS environment will not contaminate root environment. Also I’m not sure it’s a compiler behavior. Is it possibly related to RooTrace? I see it’s added in some version of ROOT 6.

Here’s a minimal reproducible setup of the problem. I do this setup and compile in place. You can take a look at or use your root version. After compile, run bin/main or ./
file.tar.gz (3.0 KB)

Thanks in advance!


I guess @monetacan help you with this.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.