{"action":"created","comment":{"url":"https://api.github.com/repos/ros2/examples/pulls/comments/35333721","id":35333721,"diff_hunk":"@@ -0,0 +1,75 @@\n+// Copyright 2014 Open Source Robotics Foundation, Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+#include <iostream>\n+#include <memory>\n+\n+#include <rclcpp/rclcpp.hpp>\n+#include <rclcpp/executors.hpp>\n+#include <rclcpp/memory_strategies.hpp>\n+#include <rclcpp/strategies/single_msg_memory_strategy.hpp>\n+\n+#include <std_interfaces/msg/int32.hpp>\n+#include <std_interfaces/msg/string.hpp>\n+\n+using namespace rclcpp::single_msg_memory_strategy;\n+using rclcpp::memory_strategies::static_memory_strategy::StaticMemoryStrategy;\n+\n+unsigned int messages_received = 0;\n+\n+void chatterCallback(const std_interfaces::msg::String::ConstSharedPtr & /*msg*/)\n+{\n+  ++messages_received;\n+}\n+\n+int main(int argc, char * argv[])\n+{\n+  rclcpp::init(argc, argv);\n+  rclcpp::memory_strategy::MemoryStrategy::SharedPtr memory_strategy = nullptr;\n+  if (argc > 1) {\n+    std::string argument(argv[1]);\n+    if (argument == \"static\") {\n+      printf(\"Setting memory allocation strategy to 'static'.\\n\");","path":"rclcpp_examples/src/topics/listener_single_msg.cpp","position":43,"original_position":43,"commit_id":"80575fc77e0b207a40c9fa166f109749246ce457","original_commit_id":"80575fc77e0b207a40c9fa166f109749246ce457","user":{"login":"esteve","id":33620,"avatar_url":"https://avatars.githubusercontent.com/u/33620?v=3","gravatar_id":"","url":"https://api.github.com/users/esteve","html_url":"https://github.com/esteve","followers_url":"https://api.github.com/users/esteve/followers","following_url":"https://api.github.com/users/esteve/following{/other_user}","gists_url":"https://api.github.com/users/esteve/gists{/gist_id}","starred_url":"https://api.github.com/users/esteve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esteve/subscriptions","organizations_url":"https://api.github.com/users/esteve/orgs","repos_url":"https://api.github.com/users/esteve/repos","events_url":"https://api.github.com/users/esteve/events{/privacy}","received_events_url":"https://api.github.com/users/esteve/received_events","type":"User","site_admin":false},"body":"Just curiosity, are you using `printf` to avoid the extra allocations that come with `std::cout` and `std::cerr` ?","created_at":"2015-07-23T15:24:56Z","updated_at":"2015-07-23T15:24:56Z","html_url":"https://github.com/ros2/examples/pull/39#discussion_r35333721","pull_request_url":"https://api.github.com/repos/ros2/examples/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/ros2/examples/pulls/comments/35333721"},"html":{"href":"https://github.com/ros2/examples/pull/39#discussion_r35333721"},"pull_request":{"href":"https://api.github.com/repos/ros2/examples/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/ros2/examples/pulls/39","id":40612483,"html_url":"https://github.com/ros2/examples/pull/39","diff_url":"https://github.com/ros2/examples/pull/39.diff","patch_url":"https://github.com/ros2/examples/pull/39.patch","issue_url":"https://api.github.com/repos/ros2/examples/issues/39","number":39,"state":"open","locked":false,"title":"Message memory strategy example","user":{"login":"jacquelinekay","id":495933,"avatar_url":"https://avatars.githubusercontent.com/u/495933?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquelinekay","html_url":"https://github.com/jacquelinekay","followers_url":"https://api.github.com/users/jacquelinekay/followers","following_url":"https://api.github.com/users/jacquelinekay/following{/other_user}","gists_url":"https://api.github.com/users/jacquelinekay/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquelinekay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquelinekay/subscriptions","organizations_url":"https://api.github.com/users/jacquelinekay/orgs","repos_url":"https://api.github.com/users/jacquelinekay/repos","events_url":"https://api.github.com/users/jacquelinekay/events{/privacy}","received_events_url":"https://api.github.com/users/jacquelinekay/received_events","type":"User","site_admin":false},"body":"Needs https://github.com/ros2/rclcpp/pull/64","created_at":"2015-07-22T21:14:16Z","updated_at":"2015-07-23T15:24:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9ddcd7b2407a32e5c6c299dd0283a43f86e3608c","assignee":{"login":"jacquelinekay","id":495933,"avatar_url":"https://avatars.githubusercontent.com/u/495933?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquelinekay","html_url":"https://github.com/jacquelinekay","followers_url":"https://api.github.com/users/jacquelinekay/followers","following_url":"https://api.github.com/users/jacquelinekay/following{/other_user}","gists_url":"https://api.github.com/users/jacquelinekay/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquelinekay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquelinekay/subscriptions","organizations_url":"https://api.github.com/users/jacquelinekay/orgs","repos_url":"https://api.github.com/users/jacquelinekay/repos","events_url":"https://api.github.com/users/jacquelinekay/events{/privacy}","received_events_url":"https://api.github.com/users/jacquelinekay/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ros2/examples/pulls/39/commits","review_comments_url":"https://api.github.com/repos/ros2/examples/pulls/39/comments","review_comment_url":"https://api.github.com/repos/ros2/examples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros2/examples/issues/39/comments","statuses_url":"https://api.github.com/repos/ros2/examples/statuses/80575fc77e0b207a40c9fa166f109749246ce457","head":{"label":"ros2:message_memory_example","ref":"message_memory_example","sha":"80575fc77e0b207a40c9fa166f109749246ce457","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":21909749,"name":"examples","full_name":"ros2/examples","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/examples","description":"Example packages for ROS2","fork":false,"url":"https://api.github.com/repos/ros2/examples","forks_url":"https://api.github.com/repos/ros2/examples/forks","keys_url":"https://api.github.com/repos/ros2/examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/examples/teams","hooks_url":"https://api.github.com/repos/ros2/examples/hooks","issue_events_url":"https://api.github.com/repos/ros2/examples/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/examples/events","assignees_url":"https://api.github.com/repos/ros2/examples/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/examples/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/examples/tags","blobs_url":"https://api.github.com/repos/ros2/examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/examples/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/examples/languages","stargazers_url":"https://api.github.com/repos/ros2/examples/stargazers","contributors_url":"https://api.github.com/repos/ros2/examples/contributors","subscribers_url":"https://api.github.com/repos/ros2/examples/subscribers","subscription_url":"https://api.github.com/repos/ros2/examples/subscription","commits_url":"https://api.github.com/repos/ros2/examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/examples/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/examples/merges","archive_url":"https://api.github.com/repos/ros2/examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/examples/downloads","issues_url":"https://api.github.com/repos/ros2/examples/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/examples/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/examples/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/examples/labels{/name}","releases_url":"https://api.github.com/repos/ros2/examples/releases{/id}","created_at":"2014-07-16T17:11:20Z","updated_at":"2015-07-23T06:32:14Z","pushed_at":"2015-07-22T21:14:16Z","git_url":"git://github.com/ros2/examples.git","ssh_url":"git@github.com:ros2/examples.git","clone_url":"https://github.com/ros2/examples.git","svn_url":"https://github.com/ros2/examples","homepage":"https://github.com/ros2/examples/wiki","size":1403,"stargazers_count":8,"watchers_count":8,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":8,"default_branch":"master"}},"base":{"label":"ros2:master","ref":"master","sha":"38e31a14022ab622a5408dd0d51164da9cb8cc7f","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":21909749,"name":"examples","full_name":"ros2/examples","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/examples","description":"Example packages for ROS2","fork":false,"url":"https://api.github.com/repos/ros2/examples","forks_url":"https://api.github.com/repos/ros2/examples/forks","keys_url":"https://api.github.com/repos/ros2/examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/examples/teams","hooks_url":"https://api.github.com/repos/ros2/examples/hooks","issue_events_url":"https://api.github.com/repos/ros2/examples/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/examples/events","assignees_url":"https://api.github.com/repos/ros2/examples/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/examples/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/examples/tags","blobs_url":"https://api.github.com/repos/ros2/examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/examples/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/examples/languages","stargazers_url":"https://api.github.com/repos/ros2/examples/stargazers","contributors_url":"https://api.github.com/repos/ros2/examples/contributors","subscribers_url":"https://api.github.com/repos/ros2/examples/subscribers","subscription_url":"https://api.github.com/repos/ros2/examples/subscription","commits_url":"https://api.github.com/repos/ros2/examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/examples/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/examples/merges","archive_url":"https://api.github.com/repos/ros2/examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/examples/downloads","issues_url":"https://api.github.com/repos/ros2/examples/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/examples/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/examples/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/examples/labels{/name}","releases_url":"https://api.github.com/repos/ros2/examples/releases{/id}","created_at":"2014-07-16T17:11:20Z","updated_at":"2015-07-23T06:32:14Z","pushed_at":"2015-07-22T21:14:16Z","git_url":"git://github.com/ros2/examples.git","ssh_url":"git@github.com:ros2/examples.git","clone_url":"https://github.com/ros2/examples.git","svn_url":"https://github.com/ros2/examples","homepage":"https://github.com/ros2/examples/wiki","size":1403,"stargazers_count":8,"watchers_count":8,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ros2/examples/pulls/39"},"html":{"href":"https://github.com/ros2/examples/pull/39"},"issue":{"href":"https://api.github.com/repos/ros2/examples/issues/39"},"comments":{"href":"https://api.github.com/repos/ros2/examples/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/ros2/examples/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/ros2/examples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros2/examples/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/ros2/examples/statuses/80575fc77e0b207a40c9fa166f109749246ce457"}}}}