jahaniam / orbslam3_docker

ORBSLAM 3 docker with GUI
131 stars 42 forks source link

Memory issues with default examples #2

Closed LeightonSmallshire closed 3 years ago

LeightonSmallshire commented 3 years ago

Hi, I got everything set up and tried to run some examples (/ORB_SLAM3/Examples/tum_vi_examples.sh) but filled almost 16GB plus swap with no indication of getting anywhere.

I tracked the issue down to a decompressing /ORB_SLAM3/Examples/Vocabulary/ORBvoc.txt.tar.gz repeatedly without cleaning up, possibly a memory leak in orb-slam3 or the cleanup is only after loading everything.

Mainly adding this issue here to recommend either noting this in your readme or adding the unzip line to the dockerfile, or for others with the same issue

FIX: decompress and remove archive manually 'cd /ORB_SLAM3/Vocabulary && tar -xf ORBvoc.txt.tar.gz && rm ORBvoc.txt.tar.gz'

jahaniam commented 3 years ago

Can you test the euroc example? that is the one I tested and confirm it works.

I'm afraid extracting should not be related to the vocabulary dictionary as that file is 145MB uncompressed! and cd /ORB_SLAM3/Vocabulary && tar -xf ORBvoc.txt.tar.gz && rm ORBvoc.txt.tar.gz command should not be the reason for your system going out of memory of 16 GB + swap.

When you run ORB_SLAM3/Examples/tum_vi_examples.sh the tar.gz is already decompressed and orbslam is using the decompressed ORBvoc.txt file. It's possible there is a possible memory leak in the orbslam code.

LeightonSmallshire commented 3 years ago

After a rebuilding from the beginning the problem seems to have disappeared, which means it was likely something I had done when setting up for the tum examples that I can't reproduce from scratch. I'll try to compare the containers in-depth but that's my own problem.

The vocabulary dictionary itself isn't large, but is used ~70 times and loaded/decompressed each time. Without looking more into the orb-slam code I can't say where the leak is but unzipping the file manually seems to avoid it, hence my fix.

jahaniam commented 3 years ago

@LeightonSmallshire Thanks for confirming. No, the vocabulary is not decompressed each time. You decompress it only one time before you start compiling orbslam and happening when you are running build_container_cpu/cuda.sh . You won't run build_container_cpu/cuda.sh every time