|
From: <kla...@fr...> - 2006-02-23 14:02:07
|
Hi @all, yes, Nando, Eric & Luigi you are right! Seems that I'm using Java & C# to o= ften and sometimes forget that shared_ptr aren't fail-safe. Lugi, I'll brea= k this circularity in LfmHullWhiteParameterization and send you an updated = version soon. thanks for the bug hunting! cheers=20 Klaus ----- original Nachricht -------- Betreff: Re: [Quantlib-dev] 0.3.12 test tarballs Gesendet: Do 23 Feb 2006 13:47:37 CET Von: "Luigi Ballabio"<lui...@gm...> >=20 > 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. > >=20 > > 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. >=20 > Ok, I see. There's a circular reference. First the shared_ptr to =20 > process is passed to fct, which stores it. Then fct is passed to =20 > process through setCovarParam and stored in turn. As process and fct =20 > hold shared_ptrs to each other, neither reference count will ever reach = =20 > 0 and the allocated memory will never be freed. >=20 > Klaus, is the circularity necessary in the test---or in real life? If =20 > so, we'll have to think of a way to break the cycle; a weak_ptr would =20 > be the obvious choice. >=20 > Later, > =09Luigi >=20 >=20 > ---------------------------------------- >=20 > A debugged program is one for which you have not yet found the > conditions that make it fail. > -- Jerry Ogdin >=20 --- original Nachricht Ende ---- =0A=0A=0A=0A=0A=0A=0A=0A |