【发布时间】:2009-10-01 21:57:43
【问题描述】:
我将尝试在不提供太多源代码的情况下提出这个问题,因为所有相关位加起来就是一堆。涉及的关键(我认为?)对象是
using namespace o2scl;
typedef MSMTModel<TASensor,PosModel,target2d,ovector,ovector_const_subvector> TA_MSMTModel;
typedef MPC_funct_mfptr<MSMT_InitialState,TA_MSMTModel,MSMTFormation> MPC_TAFormation_mfptr;
typedef boost::function<int (size_t, const ovector_base&, double&, TA_MSMTModel&)> TA_mfunct;
TA_mfunct mf1 = boost::bind(&MPC_TAFormation_mfptr::mfn, f1, _1, _2, _3, _4);
boost::function mf1 用作最小化例程 (o2scl::ool_mmin_spg) 的回调函数,但我认为我遇到的问题不是特定于此。该代码通过调用 ool_mmin_spg.mmin() 函数运行,该函数使用 mf1 作为回调并且似乎运行没有错误。然后我收到了这个可爱的消息
* 检测到 glibc * ./test: 损坏的双链表:0x0000000001e9fb20 ***
后面是回溯和内存映射。回溯的相关行似乎是
#7 0x000000000041d32a in boost::detail::function::functor_manager, o2scl::ovector_const_subvector_tlate >, MSMTFormation>, unsigned long, o2scl::ovector_base_tlate const&, double&, dmect::MSMTModel, o2scl::ovector_const_subvector_tlate >&> , boost::_bi::list5, o2scl::ovector_const_subvector_tlate >, MSMTFormation> >, boost::arg, boost::arg, boost::arg, boost::arg > > >::manage (in_buffer=, out_buffer=warning: (内部错误: pc 0x41d270 in read in psymtab, but not in symtab.)
我推断从 boost::function 释放内存存在问题,但除此之外我迷路了。是否有任何关于尝试调试 glibc“损坏的双链表”错误的指示?我在谷歌上找到了一些参考资料,但似乎都解决了非常具体的问题。如果需要更详细的代码片段,请告诉我,感谢您的宝贵时间!
【问题讨论】:
标签: c++ glibc boost-function