Malloc in ROOT

Hi ,
I am trying to run the attached code in root (4.04). Its crashing when I am trying to access the 3d array from a function. This output is pasted below.

But the entire program runs smoothly if I just compile it using gcc and dont use root.

. output >>>>>>>>>>>>>>>>>>>>>>>>>>

root [12] .x test.C
inside get_1d
0 0.000000
1 1.000000
2 2.000000
3 3.000000
4 4.000000
5 5.000000
inside get_3d

*** Break *** segmentation violation
Generating stack trace…
0xb77733e4 in G__getvariable + 0x7d52 from /projects/903/debdatta/genie-installation/ext/root_4.04_02b/lib/
0xb76ce8e3 in G__getitem + 0x52a from /projects/903/debdatta/genie-installation/ext/root_4.04_02b/lib/
0xb76cd321 in G__getexpr + 0x7c05 from /projects/903/debdatta/genie-installation/ext/root_4.04_02b/lib/
0xb76d80c0 in G__getfunction + 0xfc5 from /projects/903/debdatta/genie-installation/ext/root_4.04_02b/lib/
0xb76ce913 in G__getitem + 0x55a from /projects/903/debdatta/genie-installation/ext/root_4.04_02b/lib/
test.C (1 KB)


I can reproduce this. Is there a chance that you can survive with compiling your macro for now (as in .x test.C+)? This patch requires a bit more work, and I would prefer to fix this in a few months, when we have a new reflection database in CINT.


Hi Axel,
thank you. Yes, I have found an alternate way of working with this. Once the fix is in, I will get the new version of root.
-regards Debdatta.