Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation Fault caused by "Eigen" #20

Open
DrShawnDai opened this issue Mar 10, 2022 · 7 comments
Open

Segmentation Fault caused by "Eigen" #20

DrShawnDai opened this issue Mar 10, 2022 · 7 comments

Comments

@DrShawnDai
Copy link

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.

@lin-fangzhou
Copy link

lin-fangzhou commented Apr 6, 2023

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

@DrShawnDai
Copy link
Author

DrShawnDai commented Apr 6, 2023

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

In Frame.h:
Frame

In Object.h
object

@lin-fangzhou
Copy link

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
段错误 (核心已转储)

@DrShawnDai
Copy link
Author

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

@lin-fangzhou
Copy link

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?

@DrShawnDai
Copy link
Author

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.

@lin-fangzhou
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants