gz-sim
gz-sim copied to clipboard
Unload model plugins when the model is removed from the world
As discussed in https://github.com/ignitionrobotics/ign-gazebo/issues/39#issuecomment-613957221, model plugins are not unloaded when the model is removed from the world.
There are few problems that this behaviour could cause:
- Memory leak. If the simulation is very long and models are inserted and deleted multiple times, the RAM consumption slowly increases. (e.g. https://github.com/ignitionrobotics/ign-gazebo/issues/47)
- If the plugin access ECM components of the model and it does not handle properly the case when they are not found (because the model has been removed), the behaviour could be undefined.
In #39 the problem was acknowledged but no specific issue was opened to track it.