-
Notifications
You must be signed in to change notification settings - Fork 21
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
Partial memory leak fix #325
Conversation
Added a memory trace that tracks how the memory changes through a full connection/disconnect cycle so that memory leaks can be more easily detected.
A rosidl_runtime_c__String that was a member of a message was having an init() function called on it after the message was being created. But creating a message automatically initializes the string, so it was getting double initialized.
Are you sure that one line is the only 'relevant' fix? Your other branch had a lot more changes. I just did 7 disconnects in a row and got these results. It seems to conflict with what you stated during your tests.
|
Ignore the |
There are two parallel tasks which are still spooling up when this is printed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. There are two tasks still starting up. So yes, you are correct.
Ros_Debug_BroadcastMsg("Initialization complete. Memory available: (%d) bytes. Memory in use: (%d) bytes", | ||
mpNumBytesFree(), MP_MEM_PART_SIZE - mpNumBytesFree()); | ||
Ros_Debug_BroadcastMsg("Initialization complete."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we not move this to a place where initialisation was really complete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, there isn't anywhere to put it where it will give a deterministic value. We will need to add some semaphores to indicate init-complete
on each task and wait for those before dropping into the main loop.
A partial fix for #35.
There was a member of the QueueTrajPoint response that was getting initialized twice.
The response creation call already initialized
g_messages_QueueTrajPoint.response->message
, so the init call that followed caused a memory leak.This will not close out the issue, as there is still a trickier memory leak as mentioned in this comment. But from my testing, this does seem to recoup somewhere in the range of 24-48 bytes each connect/disconnect cycle.