Skip to content

Commit

Permalink
Merge pull request #62 from ros2/fix_static_memory_strategy
Browse files Browse the repository at this point in the history
Fix static memory strategy
  • Loading branch information
jacquelinekay committed Jul 21, 2015
2 parents 76963dd + 12612ee commit 3bc4365
Showing 1 changed file with 2 additions and 6 deletions.
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

0 comments on commit 3bc4365

Please sign in to comment.