Contact cleanup reliability when changing physics engines in Gazebo 11
0 reputation · 25 Apr 2020, 00:28 UTC
0 reputation · 25 Apr 2020, 00:28 UTC
Goal: verify that contact memory created during short‑lived collisions is released when a model is spawned and then removed through Gazebo’s world/model lifecycle interface, independent of how the model was added.
Constraints: Gazebo forwards collision detection to interchangeable physics engines (ODE, Bullet, DART, Simbody), so ownership of contact objects is engine‑dependent; the cleanup path may vary between Gazebo Classic and the Gazebo/Ignition line, and the documentation does not explicitly state that all engines discard contact data on model deletion.
Questions: Does Gazebo 11 with ODE guarantee deletion of all contact allocations after a model is removed? Does the same guarantee hold when using Bullet or DART? Is the behavior consistent across Gazebo Classic and Gazebo/Ignition releases for a given engine?
35275 reputation · 25 Apr 2020, 05:52 UTC
No. Gazebo 11 does not document or guarantee complete release of all engine-level contact allocations when a model is removed, and the guarantee cannot be extended uniformly across ODE, Bullet, and DART. What Gazebo itself owns (its per-step contact caches, such as the ContactManager) is cleared each physics update and torn down with the model; what the physics engine owns internally is engine-dependent and outside Gazebo's contract.
Confirmed behavior: Gazebo forwards collision detection to the selected physics engine, so contact objects are created and owned inside the engine's collision detector. Gazebo clears its own contact bookkeeping every step, and deleting a model through the world/model interface destroys that model's collision entities and their associated contact managers. That is the primary cleanup path, independent of whether the model was spawned via the GUI, gz model --spawn-file, or a factory message.
Likely explanation per engine:
Because of these different ownership models, an ODE result must not be generalized to Bullet or DART.
Gazebo Classic 11 and the new Gazebo (formerly Ignition) line use entirely separate physics abstraction layers: the legacy gazebo::physics engine classes versus the gz-physics plugin architecture (DART by default in gz-sim). Cleanup behavior for a given engine is therefore not guaranteed to be consistent between the two product lines, and Classic findings do not transfer. Note also that Gazebo Classic 11 reached end of life in January 2025, so any residual leak you find is unlikely to be fixed upstream.
Since no cross-engine guarantee exists, measure it directly:
valgrind --tool=massif gzserver ... or heaptrack, and check whether heap usage returns to baseline after each removal cycle.ode, bullet, and dart and compare growth slopes.One caveat: behavior may differ between Gazebo 11.x patch releases, so record your exact version (gzserver --version) alongside any measurement before drawing conclusions.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.