-
Notifications
You must be signed in to change notification settings - Fork 534
Clear members for StaticExecutorEntitiesCollector to avoid shared_ptr dependency #1303
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
Changes from 5 commits
6d5d903
5b19c63
d671b93
61023d1
9f3552c
cc17f60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,8 @@ StaticSingleThreadedExecutor::spin() | |
| entities_collector_->refresh_wait_set(); | ||
| execute_ready_executables(); | ||
| } | ||
|
|
||
| entities_collector_->fini(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should fini also be called if an exception is thrown inside the while loop? That is, should this call be put in a
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that is a good idea I didn't think of earlier. It's pretty unlikely to happen (and if it did the test would fail, so a memory leak isn't the worst thing), but we may as well be complete while we are looking at it. @iuhilnehc-ynos do you mind making that last change?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for pointing this. Edit: there exists |
||
| } | ||
|
|
||
| void | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -190,6 +190,7 @@ TEST_F(TestStaticExecutorEntitiesCollector, add_remove_basic_node) { | |
|
|
||
| // Still one for the executor | ||
| EXPECT_EQ(1u, entities_collector_->get_number_of_waitables()); | ||
| entities_collector_->fini(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question for all these
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
| } | ||
|
|
||
| TEST_F(TestStaticExecutorEntitiesCollector, add_remove_node_out_of_scope) { | ||
|
|
@@ -224,6 +225,7 @@ TEST_F(TestStaticExecutorEntitiesCollector, add_remove_node_out_of_scope) { | |
|
|
||
| // Still one for the executor | ||
| EXPECT_EQ(1u, entities_collector_->get_number_of_waitables()); | ||
| entities_collector_->fini(); | ||
| } | ||
|
|
||
| class TestWaitable : public rclcpp::Waitable | ||
|
|
@@ -303,6 +305,7 @@ TEST_F(TestStaticExecutorEntitiesCollector, add_remove_node_with_entities) { | |
| EXPECT_EQ(0u, entities_collector_->get_number_of_clients()); | ||
| // Still one for the executor | ||
| EXPECT_EQ(1u, entities_collector_->get_number_of_waitables()); | ||
| entities_collector_->fini(); | ||
| } | ||
|
|
||
| TEST_F(TestStaticExecutorEntitiesCollector, add_callback_group) { | ||
|
|
@@ -365,7 +368,7 @@ TEST_F(TestStaticExecutorEntitiesCollector, prepare_wait_set_rcl_wait_set_clear_ | |
| } | ||
|
|
||
| EXPECT_TRUE(entities_collector_->remove_node(node->get_node_base_interface())); | ||
| entities_collector_->init(&wait_set, memory_strategy, &rcl_guard_condition); | ||
| entities_collector_->fini(); | ||
| } | ||
|
|
||
| TEST_F(TestStaticExecutorEntitiesCollector, prepare_wait_set_rcl_wait_set_resize_error) { | ||
|
|
@@ -395,7 +398,7 @@ TEST_F(TestStaticExecutorEntitiesCollector, prepare_wait_set_rcl_wait_set_resize | |
| } | ||
|
|
||
| EXPECT_TRUE(entities_collector_->remove_node(node->get_node_base_interface())); | ||
| entities_collector_->init(&wait_set, memory_strategy, &rcl_guard_condition); | ||
| entities_collector_->fini(); | ||
| } | ||
|
|
||
| TEST_F(TestStaticExecutorEntitiesCollector, refresh_wait_set_not_initialized) { | ||
|
|
@@ -432,7 +435,7 @@ TEST_F(TestStaticExecutorEntitiesCollector, refresh_wait_set_rcl_wait_failed) { | |
| } | ||
|
|
||
| EXPECT_TRUE(entities_collector_->remove_node(node->get_node_base_interface())); | ||
| entities_collector_->init(&wait_set, memory_strategy, &rcl_guard_condition); | ||
| entities_collector_->fini(); | ||
| } | ||
|
|
||
| TEST_F(TestStaticExecutorEntitiesCollector, refresh_wait_set_add_handles_to_wait_set_failed) { | ||
|
|
@@ -483,7 +486,7 @@ TEST_F(TestStaticExecutorEntitiesCollector, refresh_wait_set_add_handles_to_wait | |
| } | ||
|
|
||
| entities_collector_->remove_node(node->get_node_base_interface()); | ||
| entities_collector_->init(&wait_set, memory_strategy, &rcl_guard_condition); | ||
| entities_collector_->fini(); | ||
| } | ||
|
|
||
| TEST_F(TestStaticExecutorEntitiesCollector, add_to_wait_set_nullptr) { | ||
|
|
@@ -511,7 +514,7 @@ TEST_F(TestStaticExecutorEntitiesCollector, add_to_wait_set_nullptr) { | |
| rcl_reset_error(); | ||
|
|
||
| EXPECT_TRUE(entities_collector_->remove_node(node->get_node_base_interface())); | ||
| entities_collector_->init(&wait_set, memory_strategy, &rcl_guard_condition); | ||
| entities_collector_->fini(); | ||
| } | ||
|
|
||
| TEST_F(TestStaticExecutorEntitiesCollector, fill_memory_strategy_invalid_group) { | ||
|
|
@@ -543,7 +546,7 @@ TEST_F(TestStaticExecutorEntitiesCollector, fill_memory_strategy_invalid_group) | |
| ASSERT_EQ(entities_collector_->get_all_callback_groups().size(), 1u); | ||
|
|
||
| EXPECT_TRUE(entities_collector_->remove_node(node->get_node_base_interface())); | ||
| entities_collector_->init(&wait_set, memory_strategy, &rcl_guard_condition); | ||
| entities_collector_->fini(); | ||
| } | ||
|
|
||
| TEST_F(TestStaticExecutorEntitiesCollector, remove_callback_group_after_node) { | ||
|
|
@@ -615,5 +618,5 @@ TEST_F( | |
| entities_collector_->execute(); | ||
|
|
||
| EXPECT_TRUE(entities_collector_->remove_node(node->get_node_base_interface())); | ||
| entities_collector_->init(&wait_set, memory_strategy, &rcl_guard_condition); | ||
| entities_collector_->fini(); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.