Posted by
Peter Caspers-2 on
Mar 24, 2011; 7:39pm
URL: http://quantlib.414.s1.nabble.com/qlxl-dependencies-and-object-updates-tp13212p13216.html
Hi Eric, Ferdinando,
ok, I completely misinterpreted the meaning of the overwrite flag up to now.
In fact there may be a problem. I attach an example sheet. Please open it
in an excel with automatic calculations disabled. Calling the macro test
will create two quotes in cells c2 and c3 and two associated rate helpers
in cells a2 and a3. Then a piecewise yield curve object in cell a6 is
created and recomputed many times in an infinite loop. During this I
observe that more and more memory is used by excel.exe. Escaping the
loop, the number of objects is 5 (seems ok). If I delete the yield curve
object (by computing cell b12) the memory allocated before is released.
I am aware that one should not recompute the yield curve object if quotes
are updated, but rather rely on the implemented observer pattern. However
the behaviour above should not be as it is, should it?
And there is one more thing I do not understand (for today): The update of a
quote by the setValue method will force the recomputation of the yield curve
(as a lazy object observing the rate helpers), as I can reproduce by
computing cell d2 (setValue on Quote) and a9 (get discount factor from yield
curve). This is as expected and working just as in a pure C++ world.
However, if I recompute e.g. cell a2 (the first rate helper) and a9
afterwards, I see the same effect, i.e. the yield curve object seems to
have received a notification from the recomputed rate helper object? I
thought that recomputation of a cell containing a ql-constructor creates a
new object using the constructor and deletes the previous version of the
object? Obviously this is not the case, but something smarter is going on.
Could you briefly explain please?
Thanks a lot
Peter
----------------------------------------------------------------------
From: "Eric Ehlers" <
[hidden email]>
To: "Peter Caspers" <
[hidden email]>
Date: Thu, 24 Mar 2011 01:04:56 +0100
Subject: Re: [Quantlib-dev] qlxl dependencies and object updates
> Hi Peter,
>
> > Eric, thank you very much. I will try to set overwrite to yes in the
> > formulas, this is certainly the origin of the problem. Is it by the
> > way in general useful _not_ to overwrite objects, i.e. is there a
> > special reason why this parameter defaults to false?
>
> Happy to help. Usually you would allow the overwrite parameter to
> default to false. Suppose you create an object with ID foo. Then you
> attempt to recreate a new object foo, for example during a recalc.
> The system verifies that the new object resides in the same cell as
> the existing one, which is the usual case, and the old object is
> overwritten by the new one. If the new object resides in a different
> cell, this usually indicates an error on the part of the user - you
> have tried to create two different objects with the same name - and
> the construction of the new object fails with an error message to the
> effect that an existing object with the same name resides in a
> different cell. If you set overwrite to true then the creation of the
> new object will succeed even if the new object resides in a different
> cell than the old one. There are not many situations where it is
> desirable to set overwrite to true.
>
> I am worried that you have found a memory leak so I am curious to hear
> the results of your investigations.
>
> Kind Regards,
> Eric
>
> ===================================================
> Eric Ehlers
> nazcatech sprl | Brussels |
http://www.nazcatech.be> * Distributed computing for pricing analytics
> * Use Microsoft Excel as a client to the Grid
>
>
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today!
http://p.sf.net/sfu/intel-dev2devmar_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev