Closed costashatz closed 8 years ago
Thanks for reporting this issue. I recommend using gist.github.com when you want to include long snippets of text.
Unfortunately, not quite all of DART's codebase has been updated to using C++11 yet, so that leaves us open to some memory leak vulnerabilities. I'm noticing that several vectors of dynamically allocated constraints are not being properly deleted in the destructor of the ConstraintSolver
class, and that could certainly explain the leak you're seeing. I'll try switching to shared_ptrs for these constraints, and that should remedy the memory leak.
Just to clarify, are you frequently creating and destroying World
objects (and the Skeletons inside of them), or do you recycle World
objects so that you don't need to continuously create and destroy them? If you are recycling your World
objects, then there must be another cause behind the memory leaks that I haven't identified yet. Switching to shared_ptr
should still fix it, but I'd be curious to know where else it might have been leaking.
Also, if you are frequently creating and destroying Skeleton
s with meshes, then that might result in a known memory leak caused by Assimp. If you are not using any meshes, then you shouldn't need to worry about that one.
Unfortunately, not quite all of DART's codebase has been updated to using C++11 yet, so that leaves us open to some memory leak vulnerabilities. I'm noticing that several vectors of dynamically allocated constraints are not being properly deleted in the destructor of the ConstraintSolver class, and that could certainly explain the leak you're seeing. I'll try switching to shared_ptrs for these constraints, and that should remedy the memory leak.
I am waiting for this. When can you have this ready? I can help you on that one, if you can point to me where I should look.
Just to clarify, are you frequently creating and destroying World objects (and the Skeletons inside of them), or do you recycle World objects so that you don't need to continuously create and destroy them? If you are recycling your World objects, then there must be another cause behind the memory leaks that I haven't identified yet. Switching to shared_ptr should still fix it, but I'd be curious to know where else it might have been leaking.
I am not recycling World objects. I am creating and destroying them every time.
Also, if you are frequently creating and destroying Skeletons with meshes, then that might result in a known memory leak caused by Assimp. If you are not using any meshes, then you shouldn't need to worry about that one.
I am loading a skeleton once (using URDF file) and then cloning it each time. Inside URDF I only have basic shapes (spheres, cylinders, boxes). So I guess I shouldn't worry about that.
I am waiting for this. When can you have this ready?
I'm making the changes right now. It should be done some time this afternoon.
Although to clarify, for right now I'm only going to focus on changing the known trouble spots in ConstraintSolver
. Attempting to scan through the whole code base for areas that are not yet updated to modern C++ practices would take much longer.
I'm making the changes right now. It should be done some time this afternoon.
Thanks for prompt answer once again.
I've created a pull request #584 with the changes. I have not yet run any tests to make sure that the leaking is gone, but I'd be very surprised if it still persists (unless there's another leak source that wasn't caught in the Valgrind report).
This was solved by #584 !
Hello,
After running huge simulations in our cluster, we observed some memory leaks that filled up our RAM and swap (64gb + 64gb!). I was able to create a small program that
valgrind
finds possible memory leaks:Just running a few simulations does not make a problem, but we are using DART in evolutionary algorithms and we are running million of small simulations. So, small memory leaks add up and create a problem.
I am using DARTCollisionDetector, but I also tried with FCL and Bullet and I still get similar memory leak errors.
Any ideas on how to solve this issue?
Sorry for the long question. The small simulation code I am using is the following (basically code from your tutorials):
To be able to reproduce the error, you will need
ControllerDuty.hpp
,ControllerDuty.cpp
andpexod.urdf
: