Glibc detected in a for loop

Hi,

The error I’m having while compiling my code is this:

[quote]*** glibc detected *** /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00/x86_64-slc5-gcc43-opt/root/bin/root.exe: free(): invalid pointer: 0x000000001938cf28 ***
[/quote]

My (simplified) code:

[code]
TMultiGraph mgboth [2];

for(int ii=0; ii<2; ii++){
    c->cd(ii+1);        
    for (int i = 0+4*ii; i<4+4*ii; i++){
    	mgboth[ii].Add(graph_e+i);
    	graph_e[i].SetMarkerColor(2+i);
    	graph_e[i].SetMarkerStyle(7);
    	graph_e[i].GetXaxis()->SetTimeDisplay(1);

    }
   //some draw options here
    mgboth[ii].Draw();
    gStyle->SetTimeOffset(timeoffset);
    mgboth[ii].Draw("AP");
}[/code]

From cout << __LINE__ << endl; I discovered the problem is happening when the for loop has finished the last iteration. It will probably has something to do with automatical deletes by C++ but I have no clue why.

Has anyone a clue why C++ cannot finish this for-loop?

Thanks

Hi,

We would need to complete running example to investigate the problem further.

You can also try running valgrind (see valgrind.org) on your example to get better information of what is going on (also you may want to compile with ACLiC if your code is interpreted).

Cheers,
Philippe.