Re: Re: 0.3.12 test tarballs

Posted by Klaus Spanderen on
URL: http://quantlib.414.s1.nabble.com/0-3-12-test-tarballs-tp10998p10999.html

Hi @all,

yes, Nando, Eric & Luigi you are right! Seems that I'm using Java & C# to often and sometimes forget that shared_ptr aren't fail-safe. Lugi, I'll break this circularity in LfmHullWhiteParameterization and send you an updated version soon.

thanks for the bug hunting!

cheers
 Klaus
----- original Nachricht --------

Betreff: Re: [Quantlib-dev] 0.3.12 test tarballs
Gesendet: Do 23 Feb 2006 13:47:37 CET
Von: "Luigi Ballabio"<[hidden email]>

>
> On 02/23/2006 01:22:42 PM, eric ehlers wrote:
> > I don't know about VC8 Pro but valgrind detects the memory leak at
> > line 95 of libormarketmodelprocess.cpp, the full output is below.
> >
> > I haven't had time to investigate further but a first guess would be
> > that maybe the shared pointer to the LiborForwardModelProcess object
> > is used incorrectly such that the reference counting is circumvented
> > preventing the object from being deleted when the pointer goes out of
> > scope.
>
> Ok, I see. There's a circular reference. First the shared_ptr to  
> process is passed to fct, which stores it. Then fct is passed to  
> process through setCovarParam and stored in turn. As process and fct  
> hold shared_ptrs to each other, neither reference count will ever reach  
> 0 and the allocated memory will never be freed.
>
> Klaus, is the circularity necessary in the test---or in real life? If  
> so, we'll have to think of a way to break the cycle; a weak_ptr would  
> be the obvious choice.
>
> Later,
> Luigi
>
>
> ----------------------------------------
>
> A debugged program is one for which you have not yet found the
> conditions that make it fail.
> -- Jerry Ogdin
>

--- original Nachricht Ende ----