CINT struct treatment question (memory corruption?)

Dear CINTers,

Maybe I’m doing something that’s not supposed to work, but I’m curious about what’s happening. The below test script works just fine when compiled root -b -q test.C+ but when running straight through CINT root -b -q test.C it mucks up the memory and dies. On lxplus with 5.32/00 it says that glibc detected a ‘ouble free or corruption’, on my Mac with 5.99/01 it’s malloc who claims that a ‘pointer being freed was not allocated’.

Does CINT create multiple structs on-the-fly in the loop? And why/how does that differ from what the compiled version does.

Best regards,

[code]struct TestStruct {
std::string dummy;

TestStruct Structor() {
TestStruct t;
return t;

void test() {
TestStruct t;
for(size_t i = 0; i != 2; ++i) {
t = Structor();


Indeed this seems to be a deficiency in the default constructor and/or destructor generated by CINT … as you have a simple work-around (using ACliC), we do not plan to resolve this issue directly in CINT (but instead are focusing on implementing Cling :slight_smile: ).


Thanks for confirming Philippe,

It was really just that I was curious. I’ll continue playing with Cling then. Haven’t had much of a chance to look into that yet, but it definitely sounds cool!