-
Notifications
You must be signed in to change notification settings - Fork 67
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 Fixes #819
Comments
Howdy @KD-92 , thanks for the feedback. Something to look at in more detail. Regarding item 3., the reason we use |
@schaubh @KD-92 @juan-g-bonilla I think the conflict between to |
@KD-92 Your exact changes don't seem to resolve RW memory leaks, and unit tests don't pass (python crashes) if I follow your fixes. I'm curious if your local basilisk repo has any other modifications? Or perhaps there's something left out of your code blocks etc? |
Another finding:The |
That's almost certainly because the C/C++ side is unable to keep the Python side object alive by itself. |
@Natsoulas , let’s look at this more. I bet we can rewrite these scenarios to ensure the RW in the factory class remain in memory. Can we make the factory class instance a class variable of BskSim? |
The latest branch for these memory issues now avoids the use of |
Describe the bug
When reinitializing the Simulator repeatedly, e.g., in a Reinforcement Learning (RL) setting, memory growth can be observed. Please find different fixes below (this is not a Pull Request due to the last item in the list).
To reproduce
In addition to issue #441, the destructor
ReactionWheelStateEffector::~ReactionWheelStateEffector()
insrc/simulation/dynamics/reactionWheels/reactionWheelStateEffector.cpp
usesfree()
on a data structure allocated withnew
. Additionally, it may be helpful to delete the elements ofrwOutMsgs
:Py_DECREF
in SWIG Eigen Type MapThere are missing
Py_DECREF
insrc/architecture/_GeneralModuleFiles/swig_eigen.i
in the fragmentcheckPyObjectIsMatrixLike
. The changes are annotated withnew decrement
.Msg disown()
It may be of interest to verify whether
<type>Msg.this.disown()
is necessary in:Expected behavior
With these changes, memory growth became unnoticeable for us even after millions of iterations.
The text was updated successfully, but these errors were encountered: