You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked to make sure that this issue has not already been filed.
Environment
Select the following information.
DART version: master
OS name and version name(or number): Ubuntu 18.04
Compiler name and version number: GCC 7.4.0
Expected Behavior
Please describe the behavior you are expecting.
Creating a skeleton, then repeatedly cloning and deleting the clones should have a constant memory footprint.
Current Behavior
What is the current behavior?
Currently, the memory footprint grows linearly with the number of clones created and deleted.
Here is what Valgrind with Massif gives:
As you can see the very vast majority of the memory (99.5%) is used by dart::common::Signal<void (dart::dynamics::Shape*, unsigned long), dart::common::signal::detail::DefaultCombiner>
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
You can use the following example to reproduce this behavior:
The program can be executed with valgrind --tool=massif to produced the reports shown above.
Found Steps to Fix it
After analysing the code, I found out that the Signal shape->onVersionChanged used in the ShapeFrames keeps adding the "ConnectionBodies" in its set but never actually clear them when the connection is disconnected: mConnectionBodies.insert(newConnectionBody);
Then the connection are disconnected, they are flagged as "disconnected", but never removed from "mConnectionBodies".
Signal as a function cleanupConnections which would solve the problem, but it seems that this function is never used.
I don't know what is the cleanest way to manage these disconnected ConnectionBodies, but I found out that adding cleanupConnections();
after every insertion mConnectionBodies.insert(newConnectionBody); solves the issue, as demonstrated in the following graph, with a constant memory footprint lower than 1MB
I hope this report will help you fixing this.
Thanks for your work!
Cheers,
The text was updated successfully, but these errors were encountered:
Thank you for the detailed report! This is very helpful.
By design, the current Signal doesn't clean up the disconnected connections until the signal calls the registered slots or explicitly calls cleanupConnections(). Technically it's not a memory leak, but it could be problematic in the case like the case of this report.
#1462 should resolve the issue. Could you please confirm that PR fixes the issue?
Bug Report
Environment
Expected Behavior
Current Behavior
Currently, the memory footprint grows linearly with the number of clones created and deleted.
Here is what Valgrind with Massif gives:
As you can see the very vast majority of the memory (99.5%) is used by
dart::common::Signal<void (dart::dynamics::Shape*, unsigned long), dart::common::signal::detail::DefaultCombiner>
Steps to Reproduce
The program can be executed with
valgrind --tool=massif
to produced the reports shown above.Found Steps to Fix it
After analysing the code, I found out that the Signal
shape->onVersionChanged
used in the ShapeFrames keeps adding the "ConnectionBodies" in its set but never actually clear them when the connection is disconnected:mConnectionBodies.insert(newConnectionBody);
Then the connection are disconnected, they are flagged as "disconnected", but never removed from "mConnectionBodies".
Signal as a function
cleanupConnections
which would solve the problem, but it seems that this function is never used.I don't know what is the cleanest way to manage these disconnected ConnectionBodies, but I found out that adding
cleanupConnections();
after every insertion
mConnectionBodies.insert(newConnectionBody);
solves the issue, as demonstrated in the following graph, with a constant memory footprint lower than 1MBI hope this report will help you fixing this.
Thanks for your work!
Cheers,
The text was updated successfully, but these errors were encountered: