由于固定尺寸成员而引起的EIGEN运行时断言

Eigen runtime assertion due to fixed size members

本文关键字:EIGEN 运行时 断言 于固定 成员      更新时间:2023-10-16

运行程序时,我目前正在检索以下特征主张:

test_engine:/usr/include/eigen3/eigen/src/core/densestorage.h:128:eigen :: internal :: internal :: plain_array :: plain_array :: plain_array(([with t = double;int size = 16;int matrixorarrayOptions = 0]:断言`(reinterpret_cast(eigen_unaligned_array_assert_assert_workaround_gcc47(array((&(31((== 0&&&"此处解释了此断言:" http://eigen.tuxfamily.org/dox-devel/group __topicunalignedArrayAssert.html" ****阅读此网页!!! ********************************>

导致此断言的代码的确切行是:

  std::shared_ptr<Reference> ptr_tmp = std::make_shared<ReferenceLinCart>(cart_traj);

其中ReferenceReferenceLinCart在公共标题文件中定义为:

  struct Reference {
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
    virtual ~Reference() {}
  }
  struct ReferenceLinCart : Reference {
    Eigen::Transform<double, 3, Eigen::Affine> T_start;
    Eigen::Transform<double, 3, Eigen::Affine> T_goal;
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
  };

描述中的链接为我提供了有关静态大小结构成员的信息,这就是为什么我添加了EIGEN_MAKE_ALIGNED_OPERATOR_NEW标志。

使用的G 编译标志为:-march =本机-funroll -loops -Std = C 11 -ofast -wall

不幸的是,我仍在检索相同的运行时断言。关于如何摆脱这一点的任何建议?

这是因为make_shared不符合请求的对齐方式,也不使用operator new进行分配。您需要使用Allocate_shared与对齐分配器(例如Eigen::aligned_Allocator(。

用C 17编译代码,错误(内存分配器(已修复