Open CodeFinder2 opened 7 years ago
Just want to add a minor additional insight: when stage(_ros) is started with an empty world (w/o any model
being created), the segfault disappears. This emphasizes the fact that there's some problem in the destruction of Stage's object hierarchy.
Thanks, will look into it.
On Wed, Jun 7, 2017 at 4:40 AM, Adrian Böckenkamp notifications@github.com wrote:
Just want to add a minor additional insight: when stage(_ros) is started with an empty world (w/o any modelbeing created), the segfault disappears. This emphasizes the fact that there's some problem in the destruction of Stage's object hierarchy.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ros-simulation/stage_ros/issues/47#issuecomment-306769476, or mute the thread https://github.com/notifications/unsubscribe-auth/AACCnQypyiXoRL03QYzK6L-KOnRAoaZfks5sBow0gaJpZM4NpTSv .
-- Richard Vaughan Autonomy Lab / Computing Science / Simon Fraser University
Also found stage_ros memory leak problem. When I opened several stage_ros simulator for training in parallel, the used memory continuously increase. Hope this problem could be fixed.
Thanks for the report. Patches welcome.
On Fri, Aug 18, 2017 at 4:00 AM TeaganLi notifications@github.com wrote:
Also found stage_ros memory leak problem. When I opened several stage_ros simulator for training in parallel, the used memory continuously increase. Hope this problem could be fixed.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ros-simulation/stage_ros/issues/47#issuecomment-323246864, or mute the thread https://github.com/notifications/unsubscribe-auth/AACCnYC92mdw22GLvdHVHRlcrzFZ3UcBks5sZP4tgaJpZM4NpTSv .
-- Sent from a mobile gadget
We also found this problem which limited the usage of stage in multi agent simulation! Our solution just add memory to "fix" it! Hope someone can fix it~
Hi stage_ros and Stage maintainers / developers,
I've noticed that the cleanup logic in stage_ros as well as in the Stage simulator is buggy. First of all, the destructor
StageNode::~StageNode()
is not called when closing the Stage window or exiting the simulation via Ctrl+Q / File -> Quit. I've tested with the following command:rosrun stage_ros stageros $(rospack find stage_ros)/world/willow-erratic.world
(By adding--prefix "xterm -e gdb -ex run --args"
you can launch Stage in gdb to trace the issue more easily.)Secondly, the memory allocated for the
world
variable (and even others) is never free'd.I assume the problem is also related to the cleanup/exit logic of the Stage simulator itself (so I am not sure whether this issue should better be placed in the Stage repo): when closing the Stage window, exit(0) is executed which prevents calling dtors of variables with automatic storage duration, like the
StageNode sn
object created inmain()
.However, if the destructors would be invoked correctly (by modifying and re-compiling Stage, see modified version here), the simulator crashes with a segmentation fault:
Please note that there are also some minor changes required in stage_ros to reproduce this, see stage_segfault_patch.txt patch file. In a nutshell:
exit(0)
withreturn 0
to call ctorsros::shutdown()
afterStg::World::Run()
to ensure thread terminationI highly recommend these changes. I can provide a pull-request (w/o the "delete world" line), if desired.
@rtv Do you have an idea of how to fix this? As already mentioned, the problem seems to be located somewhere deep down in the object hierarchy of the libstage library code (see stack trace above).