Segmentation violation using vector::push_back

I have just started using Root 5.18 on an Ubuntu machine and I am having problems running the following macro:

void test()
vector< vector< double > > Matrix;

//populate vector
for (int i=0;i<1000;i++)
    vector<double> row;//creates empty row
    for (int j=0;j<10;j++)
        row.push_back(i+1.0+j);//add an element to the row
    Matrix.push_back(row);//add row to main vector


I obtain the following error message:

*** Break *** segmentation violation
Attaching to program: /proc/3826/exe, process 3826
[Thread debugging using libthread_db enabled]
0xb77b3430 in __kernel_vsyscall ()
error detected on stdin
A debugging session is active.

Inferior 1 [process 3826] will be detached.

Quit anyway? (y or n) [answered Y; input not from terminal]
Detaching from program: /proc/3826/exe, process 3826
Root > Function test() busy flag cleared
Function construct() busy flag cleared
Function push_back() busy flag cleared

Am I doing something wrong? I am completely new to root, so I am not sure…

Thank you!



I first thought this would be a scoping problem. But actually, the vectors in you inner loop should be copied. So I guess that Cint does not handle this case correctly.


Well, “Root 5.18” is very old, so try 5.34/32 (or maybe even better the head of the v5-34-00-patches branch) or/and 6.04/02.

I have installed a newer version and all seems to be working just fine.
Thank you!