Skip to content

Message memory strategy example#39

Merged
jackieokay merged 1 commit intomasterfrom
message_memory_example
Jul 24, 2015
Merged

Message memory strategy example#39
jackieokay merged 1 commit intomasterfrom
message_memory_example

Conversation

@jackieokay
Copy link
Copy Markdown
Contributor

@jackieokay jackieokay added the in progress Actively being worked on (Kanban column) label Jul 22, 2015
@jackieokay jackieokay self-assigned this Jul 22, 2015
@jackieokay jackieokay added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Jul 22, 2015
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would recommend using size_t here.

@esteve
Copy link
Copy Markdown
Member

esteve commented Jul 23, 2015

+1

@jackieokay jackieokay added in progress Actively being worked on (Kanban column) and removed in review Waiting for review (Kanban column) labels Jul 23, 2015
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These two statements could be simplified as:

auto msg_strategy_ptr = std::make_shared<SingleMessageMemoryStrategy<std_interfaces::msg::String>>();

or

auto msg_strategy_ptr = SingleMessageMemoryStrategy<std_interfaces::msg::String>::SharedPtr(
  new SingleMessageMemoryStrategy<std_interfaces::msg::String>());

The current pair of statements are sort of wasteful since it expands to essentially this:

SingleMessageMemoryStrategy<std_interfaces::msg::String> msg_strategy;
SingleMessageMemoryStrategy<std_interfaces::msg::String>::SharedPtr msg_strategy_ptr(new SingleMessageMemoryStrategy<std_interfaces::msg::String>());
*msg_strategy_ptr = msg_strategy;  // implicit copy

@jackieokay
Copy link
Copy Markdown
Contributor Author

I refactored the examples a bit to be in line with the changes in ros2/rclcpp#64. Most notably, I've added a LargeFixed message type that is used, instead of the string example, since the MessagePoolMemoryStrategy does not allow non-fixed message types. weirdly enough, I see the same memory address being printed in both examples now (meaning that the default memory strategy is also only using one address).

@jackieokay jackieokay added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Jul 23, 2015
@jackieokay jackieokay force-pushed the message_memory_example branch from a8850ae to e0dca3f Compare July 24, 2015 22:08
@jackieokay
Copy link
Copy Markdown
Contributor Author

@wjwwood, if these examples look OK to you, I'll merge it by the end of today.

@wjwwood
Copy link
Copy Markdown
Member

wjwwood commented Jul 24, 2015

lgtm, +1

jackieokay added a commit that referenced this pull request Jul 24, 2015
@jackieokay jackieokay merged commit 0556c00 into master Jul 24, 2015
@jackieokay jackieokay removed the in review Waiting for review (Kanban column) label Jul 24, 2015
@jackieokay jackieokay deleted the message_memory_example branch July 24, 2015 22:51
@dirk-thomas
Copy link
Copy Markdown
Member

@jacquelinekay With the windows build being back up again please revisit the new warnings introduced by this PR: http://ci.ros2.org/job/ros2_batch_ci_windows/133/warnings34Result/category.63476771/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants