g2o_ba_example icon indicating copy to clipboard operation
g2o_ba_example copied to clipboard

*** Error in `./ba_example': double free or corruption (out): 0x00000000014abcc0 ***

Open lucasjinreal opened this issue 5 years ago • 1 comments

Strange problem, just those lines cause error:

  LOG(INFO) << "g2o optimizer done.";

  // 添加节点
  // 两个位姿节点
  for (int i = 0; i < 2; i++) {
    g2o::VertexSE3Expmap *v = new g2o::VertexSE3Expmap();
    v->setId(i);
    if (i == 0)
      v->setFixed(true); // 第一个点固定为零
    // 预设值为单位Pose,因为我们不知道任何信息
    v->setEstimate(g2o::SE3Quat());
    optimizer.addVertex(v);
  }
  // 很多个特征点的节点
  // 以第一帧为准
//  for (size_t i = 0; i < pts1.size(); i++) {
//    g2o::VertexSBAPointXYZ *v = new g2o::VertexSBAPointXYZ();
//    v->setId(2 + i);
//    // 由于深度不知道,只能把深度设置为1了
//    double z = 1;
//    double x = (pts1[i].x - cx) * z / fx;
//    double y = (pts1[i].y - cy) * z / fy;
//    v->setMarginalized(true);
//    v->setEstimate(Eigen::Vector3d(x, y, z));
//    optimizer.addVertex(v);
//  }

  LOG(INFO) << "vertex added.";

When I comment all rest codes, debug one by one, find that , only those lines codes cause error like this:

*** Error in `./ba_example': double free or corruption (out): 0x00000000014abcc0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fc8d66e07e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fc8d66e937a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fc8d66ed53c]
/usr/local/lib/libg2o_types_sba.so(_ZN3g2o26EdgeProjectP2MC_IntrinsicsD0Ev+0x2d)[0x7fc8d8cf6b0d]
/usr/local/lib/libg2o_core.so(_ZN3g2o7Factory12registerTypeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_32AbstractHyperGraphElementCreatorE+0x497)[0x7fc8d9188fd7]
/usr/local/lib/libg2o_types_sba.so(+0x20a3d)[0x7fc8d8ceea3d]
/lib64/ld-linux-x86-64.so.2(+0x106ca)[0x7fc8d93b96ca]
/lib64/ld-linux-x86-64.so.2(+0x107db)[0x7fc8d93b97db]
/lib64/ld-linux-x86-64.so.2(+0xc6a)[0x7fc8d93a9c6a]
======= Memory map: ========

Anybody knows why?

lucasjinreal avatar Apr 05 '19 03:04 lucasjinreal

I met the same problem o(╥﹏╥)o

zhh2005757 avatar Oct 08 '21 13:10 zhh2005757