You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Memory leak in exploration_node causes severe slowdown during full HM3D v2 benchmark (~14 GB RSS, 30+ min/episode after ~400 eps) #41
While running the full HM3D v2 val benchmark (1000 episodes) with habitat_evaluation.py, I observed severe slowdown over time caused by what appears to be a memory leak in the C++ exploration_node. After ~420 episodes the planner's RSS grew to ~14 GB and per-episode time went from ~37s (episode 0) to 30+ minutes (episode ~420). Restarting only the ROS 2 planner (while keeping VLM servers and habitat_evaluation.py's continue.txt checkpoint) brought per-episode time back to ~60s and RSS down to ~500 MB.
Environment
OS: Ubuntu 22.04 (jammy) — note: ROS 2 Jazzy is Tier 3 here, source-built per official docs
ROS 2: Jazzy (built from source against the conda env's Python)
conda env: apexnav (Python 3.9, per apexnav_environment.yaml)
Branch: ros2-jazzy
GPU: NVIDIA RTX 4090, CUDA 12.8, PyTorch 2.8.0+cu128
VLM servers (default ports 12181-12184): all running fresh, never restarted during the run
After episode ~420 the system began swapping (60 GB total RAM, planner alone holding ~14 GB), turning the 60-second exploration loops into 30+ minutes due to OS-level page thrashing.
Reproduction
Run the full HM3D v2 val split with test_epi_num=-1 (1000 episodes) and need_video=true.
Check the cumulative seconds spend in this task field in videos/test_hm3dv2_val/record.txt — the per-episode delta grows roughly monotonically from ~40s to thousands of seconds.
Workaround (works, but obviously not ideal)
I wrote a tmux watchdog that restarts only the ROS 2 planner every 200 episodes (or whenever its RSS exceeds 5 GB), while keeping the 4 VLM servers and habitat_evaluation.py running. Because continue.txt checkpoints per-episode, evaluation resumes seamlessly from where it left off, and per-episode time returns to ~30-60s after each restart.
Possible Causes
In exploration_fsm.cpp lines 14-20 the FSM code does fp_.reset(...), fd_.reset(...), expl_manager_.reset(...) etc. on each episode reset, which suggests inter-episode reset was intended. But something downstream — possibly:
a shared_ptr to point clouds / occupancy grids / SDF map is held by another component (visualization? mapping? planner cache?) and never released
PCL / Octomap-style data structures that grow but never shrink
Thank you for the detailed report and reproduction steps.
I think this issue may be related to the ROS 2 branch. This branch was contributed by community users and may not be as mature or fully tested as the official version. In the official version, we have not received similar reports from users so far.
Your observation does look like some resources are not being properly released across episodes, possibly due to differences in the ROS 2 port.
Activity
Zager-Zhang commentedon Apr 27, 2026
Thank you for the detailed report and reproduction steps.
I think this issue may be related to the ROS 2 branch. This branch was contributed by community users and may not be as mature or fully tested as the official version. In the official version, we have not received similar reports from users so far.
Your observation does look like some resources are not being properly released across episodes, possibly due to differences in the ROS 2 port.
zhu-hang131433 commentedon May 22, 2026
Bug Fix Report: Episode Reset 内存泄漏
问题现象
exploration_node进程在跨 episode 运行时内存持续增长(呈指数级),最终导致 OOM。根因分析
发现两个独立的泄漏源:
Bug 1: ObjectMap2D / ValueMap reset 后缓冲区大小归零(堆破坏)
ObjectMap2D::reset()和ValueMap::reset()中在clear()+shrink_to_fit()之后调用assign(xxx.size(), val),此时size()已为 0,assign(0, val)是空操作。Reset 后缓冲区大小为 0,后续代码通过operator[]以 voxel 索引直接访问,造成堆越界读写,破坏堆元数据。Bug 2: Astar2D 每 episode 重新 init 导致 100 万 Node2D 泄漏(主因)
Astar2D::init()每 episode 通过ExplorationManager::reset()被重复调用,每次创建 1,000,000 个new Node2D对象并覆盖旧指针,旧对象永不释放。Astar2D::reset()已正确实现了搜索状态重置,只需调它而非init()。修复内容
Fix 1:
src/planner/plan_env/src/object_map2d.cpp:67-74Fix 2:
src/planner/plan_env/src/value_map2d.cpp:27-34Fix 3:
src/planner/exploration_manager/src/exploration_manager.cpp:92Zager-Zhang commentedon May 27, 2026
@zhu-hang131433 Thanks for the report. I have fixed the confirmed issue in the ROS2 Jazzy branch.