hit@hit:~/qt/pclsurface/build$ valgrind ./pclsurface 1
==5651== Memcheck, a memory error detector
==5651== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==5651== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==5651== Command: ./pclsurface 1
==5651==
load point clouds 304
cloud point number : 304
kd tree established
save surface.pcd
==5651== Invalid free() / delete / delete[] / realloc()
==5651== at 0x4C32D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5651== by 0x117155: Eigen::internal::aligned_free(void*) (Memory.h:177)
==5651== by 0x1282D5: Eigen::aligned_allocator<Eigen::Matrix<float, 3, 1, 0, 3, 1> >::deallocate(Eigen::Matrix<float, 3, 1, 0, 3, 1>*, unsigned long) (Memory.h:747)
==5651== by 0x12647F: std::allocator_traits<Eigen::aligned_allocator<Eigen::Matrix<float, 3, 1, 0, 3, 1> > >::deallocate(Eigen::aligned_allocator<Eigen::Matrix<float, 3, 1, 0, 3, 1> >&, Eigen::Matrix<float, 3, 1, 0, 3, 1>*, unsigned long) (alloc_traits.h:328)
==5651== by 0x123A75: std::_Vector_base<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<float, 3, 1, 0, 3, 1> > >::_M_deallocate(Eigen::Matrix<float, 3, 1, 0, 3, 1>*, unsigned long) (stl_vector.h:180)
==5651== by 0x120015: std::_Vector_base<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<float, 3, 1, 0, 3, 1> > >::~_Vector_base() (stl_vector.h:162)
==5651== by 0x11C3E2: std::vector<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<float, 3, 1, 0, 3, 1> > >::~vector() (stl_vector.h:435)
==5651== by 0x133D69: pcl::GreedyProjectionTriangulation<pcl::PointNormal>::~GreedyProjectionTriangulation() (gp3.h:130)
==5651== by 0x115189: main (main.cpp:77)
==5651== Address 0x1f0fb6a0 is 32 bytes inside a block of size 3,680 alloc'd
==5651== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5651== by 0x975CE3C: std::vector<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<float, 3, 1, 0, 3, 1> > >::reserve(unsigned long) (in /usr/local/lib/libpcl_surface.so.1.12.1.99)
==5651== by 0x9767B83: pcl::GreedyProjectionTriangulation<pcl::PointNormal>::reconstructPolygons(std::vector<pcl::Vertices, std::allocator<pcl::Vertices> >&) (in /usr/local/lib/libpcl_surface.so.1.12.1.99)
==5651== by 0x976BD9A: pcl::GreedyProjectionTriangulation<pcl::PointNormal>::performReconstruction(pcl::PolygonMesh&) (in /usr/local/lib/libpcl_surface.so.1.12.1.99)
==5651== by 0x119DB1: pcl::MeshConstruction<pcl::PointNormal>::reconstruct(pcl::PolygonMesh&) (reconstruction.hpp:165)
==5651== by 0x115140: main (main.cpp:96)
==5651==
==5651==
==5651== HEAP SUMMARY:
==5651== in use at exit: 3,920 bytes in 4 blocks
==5651== total heap usage: 46,386 allocs, 46,383 frees, 4,645,641 bytes allocated
==5651==
==5651== LEAK SUMMARY:
==5651== definitely lost: 3,680 bytes in 1 blocks
==5651== indirectly lost: 0 bytes in 0 blocks
==5651== possibly lost: 0 bytes in 0 blocks
==5651== still reachable: 240 bytes in 3 blocks
==5651== suppressed: 0 bytes in 0 blocks
==5651== Rerun with --leak-check=full to see details of leaked memory
==5651==
==5651== For counts of detected and suppressed errors, rerun with: -v
==5651== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
double free or corruption when :
//初始化GreedyProjectionTriangulation对象,并设置参数
pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3;
//创建多变形网格,用于存储结果
pcl::PolygonMesh triangles;
//设置GreedyProjectionTriangulation对象的参数
//第一个参数影响很大
gp3.setSearchRadius(200.0f); //设置连接点之间的最大距离(最大边长)用于确定k近邻的球半径【默认值 0】
gp3.setMu(2.5f); //设置最近邻距离的乘子,以得到每个点的最终搜索半径【默认值 0】
gp3.setMaximumNearestNeighbors(100); //设置搜索的最近邻点的最大数量
gp3.setMaximumSurfaceAngle(M_PI / 4); // 45 degrees(pi)最大平面角
gp3.setMinimumAngle(M_PI / 18); // 10 degrees 每个三角的最小角度
gp3.setMaximumAngle(2 * M_PI / 3); // 120 degrees 每个三角的最大角度
gp3.setNormalConsistency(false); //如果法向量一致,设置为true
//设置搜索方法和输入点云
gp3.setInputCloud(cloud_with_normals);
gp3.setSearchMethod(tree2);
// //执行重构,结果保存在triangles中
gp3.reconstruct(triangles);
problem localization using
valgrind :
valgrind introduction
Eigen !
视觉SLAM十四讲 报错ch12: segmentation fault (core dumped) ./pointcloud_mapping
double free or corruption in pcl -march=native
solve :
add : pcl cmake -march=native ..
failed .
==15723== HEAP SUMMARY:
==15723== in use at exit: 3,920 bytes in 4 blocks
==15723== total heap usage: 46,386 allocs, 46,383 frees, 4,645,641 bytes allocated
==15723==
==15723== LEAK SUMMARY:
==15723== definitely lost: 3,680 bytes in 1 blocks
==15723== indirectly lost: 0 bytes in 0 blocks
==15723== possibly lost: 0 bytes in 0 blocks
==15723== still reachable: 240 bytes in 3 blocks
==15723== suppressed: 0 bytes in 0 blocks
==15723== Rerun with --leak-check=full to see details of leaked memory
==15723==
==15723== For counts of detected and suppressed errors, rerun with: -v
==15723== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
my own program in qt : .pro : QMAKE_CXXFLAGS += -march=native
==15723== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
hit@hit:~/qt/pclsurface/build$ valgrind ./pclsurface 1
==15769== Memcheck, a memory error detector
==15769== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==15769== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==15769== Command: ./pclsurface 1
==15769==
load point clouds 304
cloud point number : 304
kd tree established
save surface.pcd
==15769==
==15769== HEAP SUMMARY:
==15769== in use at exit: 240 bytes in 3 blocks
==15769== total heap usage: 46,386 allocs, 46,383 frees, 4,645,833 bytes allocated
==15769==
==15769== LEAK SUMMARY:
==15769== definitely lost: 0 bytes in 0 blocks
==15769== indirectly lost: 0 bytes in 0 blocks
==15769== possibly lost: 0 bytes in 0 blocks
==15769== still reachable: 240 bytes in 3 blocks
==15769== suppressed: 0 bytes in 0 blocks
==15769== Rerun with --leak-check=full to see details of leaked memory
==15769==
==15769== For counts of detected and suppressed errors, rerun with: -v
==15769== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)