So I have this matrix from the Eigen library.
Eigen::MatrixXd
And it is filled with data and is 4×3900 points. It is used in a function that has the following lines:
Now the matrix is not even used in this set of code, and for reference it is called modelPointCloud.
Using GDB I step through the lines in the image. For the workIndex and tid line the matrix is the correct size (ie. 4×3900). But when I step to the next line (idTableLock) it is still fine but when i execute that line suddenly the matrix changes to being 0x167 which happens every time but is seemingly a random number.
Now because of that I get this error:
On this line:
Which makes sense because the matrices are no longer the correct size.
Now other threads are running but none should have access to this data type. Does anyone have an idea about why this is happening? Why would it be that particular line that changes the matrix?
My guess is that this has nothing to do with Eigen. To me this sounds like memory corruption. You may not directly access the memory through your modelPointCloud variable but are likely writing over the memory that holds the size of the matrix. These types of bugs are quite hard to debug. It’s likely you are using an out of bounds index somewhere. Have a look at other posts on this subject.