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 static memory strategy #62

Merged
merged 1 commit into from
Jul 21, 2015
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
8 changes: 2 additions & 6 deletions rclcpp/include/rclcpp/strategies/static_memory_strategy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ class StaticMemoryStrategy : public memory_strategy::MemoryStrategy
for (size_t i = 0; i < pool_size_; ++i) {
memory_map_[memory_pool_[i]] = 0;
}

for (size_t i = 0; i < max_executables_; ++i) {
executable_pool_[i] = std::make_shared<executor::AnyExecutable>(executor::AnyExecutable());
}
}

void ** borrow_handles(HandleType type, size_t number_of_handles)
Expand Down Expand Up @@ -116,7 +112,7 @@ class StaticMemoryStrategy : public memory_strategy::MemoryStrategy
size_t prev_exec_seq_ = exec_seq_;
++exec_seq_;

return executable_pool_[prev_exec_seq_];
return std::make_shared<executor::AnyExecutable>(executable_pool_[prev_exec_seq_]);
}

void * alloc(size_t size)
Expand Down Expand Up @@ -161,7 +157,7 @@ class StaticMemoryStrategy : public memory_strategy::MemoryStrategy
void * service_pool_[max_services_];
void * client_pool_[max_clients_];
void * guard_condition_pool_[max_guard_conditions_];
executor::AnyExecutable::SharedPtr executable_pool_[max_executables_];
executor::AnyExecutable executable_pool_[max_executables_];

size_t pool_seq_;
size_t exec_seq_;
Expand Down