strasdat / ScaViSLAM

This is a general and scalable framework for visual SLAM. It employs "Double Window Optimization" (DWO).
GNU Lesser General Public License v3.0
335 stars 133 forks source link

segmentation fault upon closing window #41

Open JzHuai0108 opened 9 years ago

JzHuai0108 commented 9 years ago

Dear code gurus,

I built ScaViSLAM without GPU by cmake and make, and tested it on new college. But after processing a couple of frames, this error pop out and kills the program.

* Error in `./stereo_slam': free(): invalid pointer: 0x000000000fdbd3ec * Aborted (core dumped)"

Then I built ScaViSLAM with Qt, again tested it on new college dataset. Invoking it in terminal like: ./stereo_slam ../data/newcollege.cfg, it played without any problem after pressing the play button. Although it is much slower (0.5 fps) than that built with make (3 fps), the resultant trajectory for new college dataset looked great. However, when the program window was closed, a segmentation fault was reported on the terminal. Using Qt to debug this error, the calling stack is shown in the attached picture.

xx Do you have any idea where this segmentation fault come from? Only a few possible culprits, I believe, (1)pangolin views, (2) frontend, file_grabber, (3) backend, (4) place_recognizer

I am going to spend a few days editing ScaViSLAM to make sure all allocated memory is properly released. If anyone could cut this debugging time down, I would be so obliged.

JzHuai0108 commented 9 years ago

I struggled two days and failed to solve this problem which is also related to issue #39. As far as I can look into the call stack, it seems once vector point_stats->num_matched_points is to be released, the error occurs. Therefore, I revised all interfaces of functions that have point_stats argument, only letting copies of vector num_matched_points pass in and not pass out. As a result, there are only one point_stats in the program. However, the error keeps occurring at the same call stack spot . Then to make sure all the libraries are built in release mode, I rebuilt all the libraries, pangolin, visiontools, etc. Still no luck! Finally, I suspect the issue may be due to some other memory leakage. From now on, I will replace the whole frontend, so this error will die in the trash bin.