Quantlib FixedRateBond Cashflow Memory Leak -
when extract , iterate on cashflows in fixed rate bond, valgrind reports memory leak. using following code:
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(); (size_t i=0; != cashflows.size(); ++i) { cout << "date: " << cashflows[i]->date() << " amount: " << cashflows[i]->amount() <<endl; }
edit: looks it's osx issue same code doesn't raise issues when run in linux. posterity, here report getting on osx:
==62096== 148 (80 direct, 68 indirect) bytes in 1 blocks lost in loss record 170 of 208 ==62096== @ 0x1001f8ea1: malloc (vg_replace_malloc.c:303) ==62096== 0x102d3d4a2: __balloc_d2a (in /usr/lib/system/libsystem_c.dylib) ==62096== 0x102d3ddeb: __d2b_d2a (in /usr/lib/system/libsystem_c.dylib) ==62096== 0x102d3a443: __dtoa (in /usr/lib/system/libsystem_c.dylib) ==62096== 0x102d6307a: __vfprintf (in /usr/lib/system/libsystem_c.dylib) ==62096== 0x102d8c35c: __v2printf (in /usr/lib/system/libsystem_c.dylib) ==62096== 0x102d705a8: _vsnprintf (in /usr/lib/system/libsystem_c.dylib) ==62096== 0x102d70607: vsnprintf_l (in /usr/lib/system/libsystem_c.dylib) ==62096== 0x102d60ab1: snprintf_l (in /usr/lib/system/libsystem_c.dylib) ==62096== 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== 0x102ab3b33: std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(double) (in /usr/lib/libc++.1.dylib) ==62096== 0x10000a2d1: main (main.cpp:31)
this seems related os x issue not occur on linux , (the helpful) luigi states not in quantlib code itself.
Comments
Post a Comment