{"action":"created","issue":{"url":"https://api.github.com/repos/ros-drivers/video_stream_opencv/issues/15","repository_url":"https://api.github.com/repos/ros-drivers/video_stream_opencv","labels_url":"https://api.github.com/repos/ros-drivers/video_stream_opencv/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/ros-drivers/video_stream_opencv/issues/15/comments","events_url":"https://api.github.com/repos/ros-drivers/video_stream_opencv/issues/15/events","html_url":"https://github.com/ros-drivers/video_stream_opencv/issues/15","id":313256212,"number":15,"title":"Memory leak when subscribing to /videofile/image_raw topic","user":{"login":"aviogit","id":11940165,"avatar_url":"https://avatars0.githubusercontent.com/u/11940165?v=4","gravatar_id":"","url":"https://api.github.com/users/aviogit","html_url":"https://github.com/aviogit","followers_url":"https://api.github.com/users/aviogit/followers","following_url":"https://api.github.com/users/aviogit/following{/other_user}","gists_url":"https://api.github.com/users/aviogit/gists{/gist_id}","starred_url":"https://api.github.com/users/aviogit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviogit/subscriptions","organizations_url":"https://api.github.com/users/aviogit/orgs","repos_url":"https://api.github.com/users/aviogit/repos","events_url":"https://api.github.com/users/aviogit/events{/privacy}","received_events_url":"https://api.github.com/users/aviogit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2018-04-11T10:04:16Z","updated_at":"2018-04-11T12:06:04Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Houston, we have another problem.\r\n\r\nThere is a memory leak when subscribing to /videofile/image_raw topic. Valgrind sees the memory as always reachable (so technically speaking it's not a true leak), but the process ends up using several gigs of memory. When one stops image_view, memory is released correctly.\r\n\r\nIf you want to take a look at it, you can clone this branch:\r\n\r\nhttps://github.com/aviogit/video_stream_opencv/tree/memory_leak_when_subscribing_to_slash_videofile_slash_image_raw\r\n\r\nI found an excellent piece of code by @BloodAxe here: https://computer-vision-talks.com/hacking-opencv-for-fun-and-profit/\r\n\r\nand now I can even see precise numbers. I'll try to understand why it happens, cv_bridge::CvImage::toImageMsg() does a deep copy, so I actually see no reason for this to happen.\r\n\r\nhttp://docs.ros.org/kinetic/api/cv_bridge/html/c++/cv__bridge_8cpp_source.html\r\n\r\nI'll try to look into this further..."},"comment":{"url":"https://api.github.com/repos/ros-drivers/video_stream_opencv/issues/comments/380428244","html_url":"https://github.com/ros-drivers/video_stream_opencv/issues/15#issuecomment-380428244","issue_url":"https://api.github.com/repos/ros-drivers/video_stream_opencv/issues/15","id":380428244,"user":{"login":"awesomebytes","id":1721716,"avatar_url":"https://avatars1.githubusercontent.com/u/1721716?v=4","gravatar_id":"","url":"https://api.github.com/users/awesomebytes","html_url":"https://github.com/awesomebytes","followers_url":"https://api.github.com/users/awesomebytes/followers","following_url":"https://api.github.com/users/awesomebytes/following{/other_user}","gists_url":"https://api.github.com/users/awesomebytes/gists{/gist_id}","starred_url":"https://api.github.com/users/awesomebytes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awesomebytes/subscriptions","organizations_url":"https://api.github.com/users/awesomebytes/orgs","repos_url":"https://api.github.com/users/awesomebytes/repos","events_url":"https://api.github.com/users/awesomebytes/events{/privacy}","received_events_url":"https://api.github.com/users/awesomebytes/received_events","type":"User","site_admin":false},"created_at":"2018-04-11T12:06:03Z","updated_at":"2018-04-11T12:06:03Z","author_association":"MEMBER","body":"I pulled your branch, I'm using your CMakeLists.txt: `set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -g3 -gdwarf-2 -O0 -std=c++11\")`"}}
{"actor":{"display_login":"awesomebytes"}}