Memory leaks Quantlib FixedRateBond现金流内存泄漏

Memory leaks Quantlib FixedRateBond现金流内存泄漏,memory-leaks,quantlib,Memory Leaks,Quantlib,当我提取并迭代固定利率债券中的现金流时,Valgrind报告内存泄漏。我正在使用以下代码: FixedRateBond fixedRateBond( settlementDays, faceAmount, fixedBondSchedule, std::vector<Rate>(1, couponRate), ActualActual(ActualActual::Bond), Busine

当我提取并迭代固定利率债券中的现金流时,Valgrind报告内存泄漏。我正在使用以下代码:

FixedRateBond fixedRateBond(
        settlementDays,
        faceAmount,
        fixedBondSchedule,
        std::vector<Rate>(1, couponRate),
        ActualActual(ActualActual::Bond),
        BusinessDayConvention ::Unadjusted,
        redemption,
        issueDate
);

vector<boost::shared_ptr<CashFlow>> cashFlows = fixedRateBond.cashflows();

for (size_t i=0; i != cashFlows.size(); ++i) {
    cout << "Date: " << cashFlows[i]->date() << " Amount: " << cashFlows[i]->amount() <<endl;
}
FixedRateBond FixedRateBond(
结算日,
面值,
固定债券时间表,
标准::向量(1,耦合率),
ActualActual(ActualActual::Bond),
BusinessDayConvention::未调整,
赎回
发行
);
向量现金流=固定利率债券。现金流();
对于(size_t i=0;i!=cashFlows.size();++i){

cout这似乎与OS X有关,因为该问题在Linux和as上不会发生(始终有用)Luigi声明QuantLib代码本身不存在。

我不知道如何正确管理存储内存,因为
vector
shared_ptr
都正确管理存储内存。您是否有valgrind报告的更多详细信息?我有,但这似乎是OSX的问题,因为我刚刚在Linux上运行了类似的代码,没有valgrind的任何消息。如果您仍然想要报告,请我能提供它们吗?奇怪。似乎它甚至不是QuantLib代码:它在
操作符中
==62096== 148 (80 direct, 68 indirect) bytes in 1 blocks are definitely lost in loss record 170 of 208
==62096==    at 0x1001F8EA1: malloc (vg_replace_malloc.c:303)
==62096==    by 0x102D3D4A2: __Balloc_D2A (in /usr/lib/system/libsystem_c.dylib)
==62096==    by 0x102D3DDEB: __d2b_D2A (in /usr/lib/system/libsystem_c.dylib)
==62096==    by 0x102D3A443: __dtoa (in /usr/lib/system/libsystem_c.dylib)
==62096==    by 0x102D6307A: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
==62096==    by 0x102D8C35C: __v2printf (in /usr/lib/system/libsystem_c.dylib)
==62096==    by 0x102D705A8: _vsnprintf (in /usr/lib/system/libsystem_c.dylib)
==62096==    by 0x102D70607: vsnprintf_l (in /usr/lib/system/libsystem_c.dylib)
==62096==    by 0x102D60AB1: snprintf_l (in /usr/lib/system/libsystem_c.dylib)
==62096==    by 0x102ACD752: std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::do_put(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, std::__1::ios_base&, char, double) const (in /usr/lib/libc++.1.dylib)
==62096==    by 0x102AB3B33: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(double) (in /usr/lib/libc++.1.dylib)
==62096==    by 0x10000A2D1: main (main.cpp:31)