ros-perception / openslam_gmapping

218 stars 206 forks source link

Issue 42 - changes for slow memory leak #43

Open joelziemann opened 1 year ago

joelziemann commented 1 year ago

Changes to fix Issue 42 - slow memory leak in GMapping::Array2d and memory cleanup of GMapping::TNode::reading using c++17 std::shared_ptr.

joelziemann commented 1 year ago

Valgrind output of gmapping_nodelets with fixes applied

==246825== LEAK SUMMARY:
==246825==    definitely lost: 320 bytes in 2 blocks
==246825==    indirectly lost: 278 bytes in 10 blocks
==246825==      possibly lost: 0 bytes in 0 blocks
==246825==    still reachable: 76,640 bytes in 225 blocks
==246825==         suppressed: 0 bytes in 0 blocks
joelziemann commented 1 year ago

Compiler and Warnings information

catkin_VERSION "0.8.10"
CMAKE Version 3.16.3
CMAKE_HOST_SYSTEM "Linux-5.4.0-155-generic"
CMAKE_HOST_SYSTEM_PROCESSOR "x86_64"
C compiler identification is GNU 9.4.0
CXX compiler identification is GNU 9.4.0

openslam_gmapping/sensor/sensor_range/rangereading.cpp:61:2: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
   61 |  if (density==0.)

openslam_gmapping/scanmatcher/scanmatcher.cpp:123:11: error: variable ‘p0’ set but not used [-Werror=unused-but-set-variable]
  123 |  IntPoint p0=map.world2map(lp);

openslam_gmapping/scanmatcher/scanmatcher.cpp:435:15: error: variable ‘matched’ set but not used [-Werror=unused-but-set-variable]
  435 |  unsigned int matched=likelihoodAndScore(sm.score, sm.likelihood, map, currentPose, readings);

openslam_gmapping/include/gmapping/grid/map.h:193:6: error: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Werror=parentheses]
  193 |  if (! s&Inside)

openslam_gmapping/scanmatcher/scanmatch_test.cpp:166:23: error: unused variable ‘rs’ [-Werror=unused-variable]
  166 |    const RangeSensor* rs=dynamic_cast<const RangeSensor*>(rr->getSensor());

openslam_gmapping/gridfastslam/gfs2log.cpp:23:7: error: variable ‘neff’ set but not used [-Werror=unused-but-set-variable]
   23 |  bool neff=0;

openslam_gmapping/gridfastslam/gfs2rec.cpp:378:7: error: variable ‘neff’ set but not used [-Werror=unused-but-set-variable]
  378 |  bool neff=0;