EAO-SLAM icon indicating copy to clipboard operation
EAO-SLAM copied to clipboard

Segmentation Fault caused by "Eigen"

Open DrShawnDai opened this issue 2 years ago • 7 comments

Both the created class "Object_Map" in file "Object.h" and the modified class "Frame" in file "Frame.h" contain several member variables that are fixed-size vectorizable "Eigen" class. In my computer, these two classes have caused a segmentation fault due to memory misalignment. Therefore, it is recommended to add a macro "EIGEN_MAKE_ALIGNED_OPERATOR_NEW" in the public part of these two classes.

DrShawnDai avatar Mar 10 '22 09:03 DrShawnDai

Thank you for sharing! Excuse me, where should this macro be added?

lin-fangzhou avatar Apr 06 '23 09:04 lin-fangzhou

Thank you for sharing! Excuse me, where should this macro be added?

In Frame.h: Frame

In Object.h object

DrShawnDai avatar Apr 06 '23 10:04 DrShawnDai

Thank you for your reply, and I have also tried your method, but it seems that this method did not help me run the entire program. This is the problem I encountered: ORB Extractor Parameters:

  • Number of Features: 1000
  • Scale Levels: 8
  • Scale Factor: 1.2
  • Initial Fast Threshold: 20
  • Minimum Fast Threshold: 7 read groundtruth.txt

Start processing sequence ... Images in the sequence: 405

Offline semi-dense mapping and line segment extraction updating model New Map created with 153 points 段错误 (核心已转储)

lin-fangzhou avatar Apr 06 '23 12:04 lin-fangzhou

Try changing the member variable "mLastFrame" of class "Tracking" to a pointer form

DrShawnDai avatar Apr 06 '23 13:04 DrShawnDai

Thank you again for your reply! In fact, I understand how to implement your suggestion. So I consulted some materials and learned from some blogs that this seems to be a step in orb slam2. Is this step already in the code for the case?

lin-fangzhou avatar Apr 06 '23 13:04 lin-fangzhou

Thank you again for your reply! In fact, I understand how to implement your suggestion. So I consulted some materials and learned from some blogs that this seems to be a step in orb slam2. Is this step already in the code for the case?

The official program of orb-slam2 has not yet converted "mLastFrame" into a pointer, but I personally believe that this writing method is risky because the "Frame" class contains too many member variables, which can easily cause memory overflow. For example, I once attempted to further introduce line feature extraction (LSD + LBD). According to the official source code, the member variable "mLastFrame" will be called during monocular camera initialization ("MonocularInitialization" function), and at this time, due to further increasing the amount of data loaded in memory, it will cause "Segment Faults". Therefore, dynamically allocating memory (pointer form) may be a more reasonable and secure way.

DrShawnDai avatar Apr 06 '23 18:04 DrShawnDai

Thank you for your reply! Modifying these codes is beyond my ability.

lin-fangzhou avatar Apr 07 '23 01:04 lin-fangzhou