Ask Your Question
0

Glibc detected

asked 2013-06-30 19:36:11 -0600

residentelvio gravatar image

Hi people I have this error entering a function: (really the error lines are more than this I put)

  *** glibc detected *** /home/elvio/workspace/aws/Debug/aws: double free or corruption    (!prev): 0x0000000001eff100 ***
  ======= Backtrace: =========
  /lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f950c739b96]
  /home/elvio/workspace/aws/Debug/aws[0x40afde] 
  /home/elvio/workspace/aws/Debug/aws[0x40a940]
  /home/elvio/workspace/aws/Debug/aws[0x409f3b]
  /home/elvio/workspace/aws/Debug/aws(_ZNSt6vectorId

The function is : (I print Welcome to see in console I enter in the function)

   void pre_filter_Computations(vector< vector<double> > radius,vector< vector<double> > theta,int cols,int rows){

   vector<double>x(cols);
   vector<double>y(rows);
   vector< vector<double> >X(cols, vector<double>(rows));
   vector< vector<double> >Y(cols, vector<double>(rows));
   double epsilon = 0.0001;

   printf("welcome\n");

   for(int i=0;i<cols;i++){
   x[i]=((double)(i-cols)/2)/((double)cols/2);
   }

   for(int z=0;z<rows;z++){
   y[z]=-(((double)(z-rows)/2)/((double)rows/2));
   }

   for(int m=0;m<cols;m++){
      for(int n=0;n<rows;n++){

        X[m][n]=x[m];
        Y[m][n]=y[n];
     }
   }

   for(int a=0;a<rows;a++){
        for(int b=0;b<cols;b++){

             X[a][b] = pow(X[a][b],2);
             Y[a][b] = pow(Y[a][b],2);
             X[a][b] = X[a][b] + Y[a][b];
              radius[a][b] = sqrt(X[a][b]);

        }
    }

    radius[rows/2][cols/2]=1;

    for(int a=0;a<rows;a++){
       for(int b=0;b<cols;b++){
           radius [a][b]= radius[a][b] + epsilon;
           theta[a][b] = atan2(Y[a][b],X[a][b])*180/PI;
       }
    }
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-07-02 18:18:24 -0600

CodeFinder gravatar image

I cannot see any problems in your code. The issue have to be related to calling free/delete on a pointer more than once (as the error message states).

You should use a debugger (with the -g flag) to step through your code. When the glibc detects your invalid free call, the debugger halts and you can inspect the backtrace. Hopefully, the backtrace gives you more information about your problem.

However, this problem does not seem to be OpenCV-related.

HTH ;-)

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-06-30 19:36:11 -0600

Seen: 769 times

Last updated: Jul 02 '13