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

Several memory-related fixes for rcl_variant_t benchmarks #813

Merged
merged 4 commits into from
Sep 28, 2020

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Sep 28, 2020

See each commit for justification.

  • Remove a bunch of redundant nullptr assignments
  • Fix some memory leaks
  • Ensure source string is deallocated
  • Remove redundant array size assignment

Follow-up to #803 and #810

The `rcl_yaml_variant_fini` is already setting these values to `NULL`,
so there isn't any reason to do that here.

Signed-off-by: Scott K Logan <logans@cottsay.net>
Assuming the source entity isn't empty, the `rcl_yaml_variant_copy` is
allocating memory during each iteration, and that memory needs to be
deallocated.

Signed-off-by: Scott K Logan <logans@cottsay.net>
Since the string is created with `rcutils_strdup`, it needs to be
deallocated.

Signed-off-by: Scott K Logan <logans@cottsay.net>
Unlike the `rcl_*` array types, the `rcutils_string_array_t` is
initialized with `rcutils_string_array_init`, which sets the size.

Signed-off-by: Scott K Logan <logans@cottsay.net>
@cottsay cottsay added the bug Something isn't working label Sep 28, 2020
@cottsay cottsay self-assigned this Sep 28, 2020
@cottsay
Copy link
Member Author

cottsay commented Sep 28, 2020

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@cottsay cottsay merged commit 9ad5d5c into master Sep 28, 2020
@delete-merged-branch delete-merged-branch bot deleted the cottsay/benchmark/rcl_yaml_param_parser branch September 28, 2020 19:09
ahcorde pushed a commit that referenced this pull request Oct 5, 2020
* Remove a bunch of redundant nullptr assignments
* Fix some memory leaks
* Ensure source string is deallocated
* Remove redundant array size assignment

Signed-off-by: Scott K Logan <logans@cottsay.net>
ahcorde pushed a commit that referenced this pull request Oct 8, 2020
* Remove a bunch of redundant nullptr assignments
* Fix some memory leaks
* Ensure source string is deallocated
* Remove redundant array size assignment

Signed-off-by: Scott K Logan <logans@cottsay.net>
Barry-Xu-2018 pushed a commit to Barry-Xu-2018/rcl that referenced this pull request Oct 29, 2020
* Remove a bunch of redundant nullptr assignments
* Fix some memory leaks
* Ensure source string is deallocated
* Remove redundant array size assignment

Signed-off-by: Scott K Logan <logans@cottsay.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants