-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak in stage(_ros) and resulting segfault #47
Comments
Just want to add a minor additional insight: when stage(_ros) is started with an empty world (w/o any |
Thanks, will look into it.
…On Wed, Jun 7, 2017 at 4:40 AM, Adrian Böckenkamp ***@***.***> 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
<#47 (comment)>,
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. |
Thanks for the report. Patches welcome.
On Fri, Aug 18, 2017 at 4:00 AM TeaganLi ***@***.***> 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
<#47 (comment)>,
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! |
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).
The text was updated successfully, but these errors were encountered: