Skip to content
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

fix memory leak on service call #774

Merged
merged 6 commits into from
Oct 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rosbridge_library/src/rosbridge_library/internal/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ def call_service(node_handle, service, args=None):
client = node_handle.create_client(service_class, service)

result = client.call(inst)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
node_handle.destroy_client(client)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@achim-k

No.

And I know that node_handle.destroy_client(client) does not free all memory.

Adding this code, memory leak issue is not solved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first commit was this, but I found it didn't release all the memory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@achim-k

releasing resources by node_handle.destroy_client(client) is rclpy responsibility, so I'll change this PR, and I'll also submit to fix this issue to rclpy repo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you create a rclpy issue / PR, could you add a link here? Thanks!

node_handle.destroy_client(client)
if result is not None:
# Turn the response into JSON and pass to the callback
json_response = extract_values(result)
Expand Down