Add "MemoryStrategy" to Executor with dep. injection#56
Merged
jacquelinekay merged 6 commits intomasterfrom Jul 15, 2015
Merged
Add "MemoryStrategy" to Executor with dep. injection#56jacquelinekay merged 6 commits intomasterfrom
jacquelinekay merged 6 commits intomasterfrom
Conversation
added 3 commits
July 13, 2015 12:01
7 tasks
Member
There was a problem hiding this comment.
You could use the RCLCPP_MAKE_SHARED_DEFINITIONS macro here to add the static function make_shared to the AnyExecutable class.
Member
|
+1 |
added 2 commits
July 13, 2015 15:39
Contributor
Author
|
Updates based on William's comments in 541385a: use RCLCPP_MAKE_SHARED for shared pointer typedefs for new classes |
rclcpp/include/rclcpp/executor.hpp
Outdated
Member
|
Thanks @jacquelinekay, 541385a lgtm. |
Member
There was a problem hiding this comment.
All those member variables should have a trailing underscore and no leading underscore.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces the
MemoryStrategyclass to delegate memory management on the execution path ofExecutor.By default,
MemoryStrategyis stateless and handles all delegated functions with dynamic memory management (malloc, free, new), but all functions are overrideable. An example subclass ofMemoryStrategy,StaticMemoryStrategy, shows how these functions can be overridden and state can be added to implement fully static memory management.The following functions are delegated to
MemoryStrategy:borrow_handles: returns a pointer to memory reserved for subscription, service, client or guard condition handles.return_handles: cleans up memory instantiated inborrow_handles, by deleting it or resetting to NULL.instantiate_next_executable: instantiates the nextAnyExecutableobject and passes it as a shared pointer.In order to manage circular dependencies, I moved the
AnyExecutablestruct from a protected member ofExecutorto its own header file.An example of how the memory strategy can be specified dynamically is in the
examples/memory_dependency_injection:https://github.com/ros2/examples/blob/memory_dependency_injection/rclcpp_examples/src/topics/listener_exec.cpp