rst-tu-dortmund / costmap_converter

A ros package that includes plugins and nodes to convert occupied costmap2d cells to primitive types
133 stars 104 forks source link

Memory leak when using costmap_converter::CostmapToLinesDBSMCCH #22

Open abylikhsanov opened 4 years ago

abylikhsanov commented 4 years ago

This is a valgrind output when the application crashed due to some memory leak with allocation. This happens only when using costmap_converter::CostmapToLinesDBSMCCH

==130793== Thread 12:
==130793== Invalid read of size 8
==130793==    at 0x4842A8F: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==130793==    by 0x10EB878E: costmap_converter::CostmapToLinesDBSMCCH::extractPointsAndLines(std::vector<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint, std::allocator<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint> >&, geometry_msgs::Polygon_<std::allocator<void> > const&, std::back_insert_iterator<std::vector<geometry_msgs::Polygon_<std::allocator<void> >, std::allocator<geometry_msgs::Polygon_<std::allocator<void> > > > >) (in /home/a/catkin_ws/devel/lib/libcostmap_converter.so)
==130793==    by 0x10EB8CD6: costmap_converter::CostmapToLinesDBSMCCH::compute() (in /home/a/catkin_ws/devel/lib/libcostmap_converter.so)
==130793==    by 0x4ADC867: ros::TimerManager<ros::Time, ros::Duration, ros::TimerEvent>::TimerQueueCallback::call() (in /opt/ros/noetic/lib/libroscpp.so)
==130793==    by 0x4AFEE61: ros::CallbackQueue::callOneCB(ros::CallbackQueue::TLS*) (in /opt/ros/noetic/lib/libroscpp.so)
==130793==    by 0x4B00372: ros::CallbackQueue::callAvailable(ros::WallDuration) (in /opt/ros/noetic/lib/libroscpp.so)
==130793==    by 0x1074A96C: costmap_converter::BaseCostmapToPolygons::spinThread() (in /opt/ros/noetic/lib/libteb_local_planner.so)
==130793==    by 0x525443A: ??? (in /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.71.0)
==130793==    by 0x517D608: start_thread (pthread_create.c:477)
==130793==    by 0x4F75102: clone (clone.S:95)
==130793==  Address 0xb70c130 is 0 bytes after a block of size 64 alloc'd
==130793==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==130793==    by 0x10E9FBB8: void std::vector<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint, std::allocator<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint> >::_M_realloc_insert<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint const&>(__gnu_cxx::__normal_iterator<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint*, std::vector<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint, std::allocator<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint> > >, costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint const&) (in /home/a/catkin_ws/devel/lib/libcostmap_converter.so)
==130793==    by 0x10E9082C: costmap_converter::CostmapToPolygonsDBSMCCH::dbScan(std::vector<std::vector<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint, std::allocator<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint> >, std::allocator<std::vector<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint, std::allocator<costmap_converter::CostmapToPolygonsDBSMCCH::KeyPoint> > > >&) (in /home/a/catkin_ws/devel/lib/libcostmap_converter.so)