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

Dynamic memory audit #102

Merged
merged 3 commits into from
Jun 17, 2018
Merged

Dynamic memory audit #102

merged 3 commits into from
Jun 17, 2018

Conversation

wjwwood
Copy link
Member

@wjwwood wjwwood commented May 11, 2018

This pull request makes sure that we're using rcutils_allocator_t everywhere and not using malloc, realloc, calloc, or free anywhere at all.

Requires #101

@wjwwood wjwwood added enhancement New feature or request in progress Actively being worked on (Kanban column) labels May 11, 2018
@wjwwood wjwwood self-assigned this May 11, 2018
@dejanpan
Copy link

@wjwwood sorry but I can't recall it now - you said that there will be another PR against rcutils after this one?

@wjwwood
Copy link
Member Author

wjwwood commented May 12, 2018

Yes, I will probably make it another one rather than combining it into this.

@wjwwood wjwwood added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Jun 15, 2018
@wjwwood
Copy link
Member Author

wjwwood commented Jun 15, 2018

If anyone has time to review these, that would be appreciated! 👍

CI:

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

@dejanpan
Copy link

@serge-nikulin could you do it please?

@@ -1,42 +0,0 @@
// Copyright 2017 Open Source Robotics Foundation, Inc.

Choose a reason for hiding this comment

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

why was this file removed?

I tried to find any mention but I couldn't.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just replaced all use of it with rcutils_format_string(), so it's unnecessary now.

}
const size_t size = 1024;
g_last_log_event.message = malloc(size);
g_last_log_event.message = allocator.allocate(size, allocator.state);

Choose a reason for hiding this comment

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

so free resp. malloc are now called inside deallocate resp allocate?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

@wjwwood wjwwood added in progress Actively being worked on (Kanban column) and removed in review Waiting for review (Kanban column) labels Jun 16, 2018
@wjwwood
Copy link
Member Author

wjwwood commented Jun 16, 2018

Sorry, there are some missing, but related pull requests for this one. I'll fix it up and ask for review again.

@dejanpan
Copy link

@wjwwood one more Q. I tried to find coverage information for rcutils but could only find this https://ci.ros2.org/job/ci_linux_coverage/2/cobertura/src_ros2_rcutils_src/ which seems a bit old.

@wjwwood
Copy link
Member Author

wjwwood commented Jun 16, 2018

@serge-nikulin you're welcome to review it too, but I do need someone from our team to review it as well.

@wjwwood one more Q. I tried to find coverage information for rcutils but could only find this https://ci.ros2.org/job/ci_linux_coverage/2/cobertura/src_ros2_rcutils_src/ which seems a bit old.

There's no coverage information still. We have what you linked to, but it's also not trusty worthy right now.

@wjwwood wjwwood added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Jun 16, 2018
@serge-nikulin
Copy link

@dejanpan, when do you need the review?

@@ -19,8 +19,10 @@

static char cwd[1024];

static rcutils_allocator_t g_allocator = rcutils_get_default_allocator();
Copy link
Member

Choose a reason for hiding this comment

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

Not actually changed in this patch but shouldn't all allocated return values be freed here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, looks like there are some memory leaks in that test, I'll clean them up.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, those were really bad leaks. I think 717e044 fixed them.

@wjwwood
Copy link
Member Author

wjwwood commented Jun 16, 2018

Ok, in review again, new CI:

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

Copy link
Member

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

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

lgtm

@wjwwood
Copy link
Member Author

wjwwood commented Jun 17, 2018

I could still use reviews of some of the other pr's associated with this pull request.

New CI after fix up:

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

@wjwwood wjwwood merged commit ae9be8f into master Jun 17, 2018
@wjwwood wjwwood deleted the dynamic_memory_audit branch June 17, 2018 05:05
@wjwwood wjwwood removed the in review Waiting for review (Kanban column) label Jun 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants