Memory usage keeps increasing during large-scale mapping – eventually crashes at \~98%
Thank you for your work on this project — it's been very helpful.
I'm using ros2 glim_rosnode to build a large-scale map. After a certain point, memory usage steadily increases until CPU memory reaches approximately 98%, after which the node crashes.
The following memory warnings repeatedly occur:
[glim_rosnode-1] [2025-05-30 14:57:35.294] [mem] [warning] CPU memory usage: 28979.05 / 31497.23 MB 92.01%
[glim_rosnode-1] [2025-05-30 14:57:40.294] [mem] [warning] CPU memory usage: 28938.97 / 31497.23 MB 91.88%
[glim_rosnode-1] [2025-05-30 14:57:50.295] [mem] [warning] CPU memory usage: 29336.95 / 31497.23 MB 93.14%
Eventually, it reaches >98% and the node crashes due to memory exhaustion.
Questions:
- Are there any parameters (e.g., cache size, voxel resolution, GPU memory use options) that can be adjusted to reduce memory usage or offload more to the GPU?
- Is there a recommended strategy for long-duration mapping with high memory efficiency?
- Is memory usage expected to grow indefinitely, or should it plateau during normal operation?
Any suggestions would be very helpful. Thanks in advance!
- Please try tuning the following parameters:
- Decrease "submap_target_num_points" in "config_sub_mapping_gpu.json" to 20000 ~ 30000 (decrease # points per submap)
- Decrease "keyframe_voxelmap_levels" in "config_sub_mapping_gpu.json" to 1 (decrease # layers of voxelmaps per submap)
- Increase "max_implicit_loop_overlap" in "config_global_mapping_gpu.json" to 0.3 ~ 0.4 (reduce # of factors in global optimization)
- If only the CPU-RAM matters, I recommend setting 16 ~ 32 GB swap memory to mitigate the problem https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04
- The memory usage grows indefinitely as the map area grows
@koide3 Thank you so much for your support and help.
I implemented GPU memory offloading that enables swapping out submap data from the GPU memory and drastically reducing the memory consumption. You may want to try it: github.com/koide3/glim/pull/235