Unexplainable slowdown over time
I have a simple world plugin that creates several objects, waits a few seconds, deletes the old objects, and repeats this process several times.
For reasons I cannot identify, over the course of these iterations, the speed of the simulation slows down (the real time factor gets worse). Using the unix time utility to test, I've found the simulation starts off doing ~0.8 iterations per second, but after ~15 minutes of the simulation running, it gets down to 0.15 iterations per second.
- As far as I can tell, nothing persists or accumulates between iterations, so I don't think it's the simulator getting cluttered with more and more objects.
- According to htop, I can't see the resource usage of Gazebo increasing, so I don't think it's a memory leak, but I could be wrong.
- The only thing I could think of is that one of the models created each iteration has a plugin, and the plugin may be slowing things down? However, as far as I can tell, there's only one of these plugins printing anything at any one time, as expected, so I assume they're getting suitably destructed between iterations.
Does anyone have any guesses as to the cause of this? My hacky solution is to just restart gazebo after 30 iterations, but this is hardly the best solution. You can see the relevant source code here. Thank you for your help.
Any reason why you're using `Model::Fini` instead of `World::RemoveModel`?
No reason in particular.