Re: eval date-problem solved

Posted by Toyin Akin on
URL: http://quantlib.414.s1.nabble.com/eval-date-problem-solved-tp1121p1133.html


Hi,

Yes it's generally not a good idea to mess with the garbage collection
internal calculation policy.

This is definatly pointing to notification problems within .NET. The same
will be true under java as this also uses the garbage collection scheme.

Best Regards,
Toyin Akin,
CapeTools QuantTools,
www.QuantTools.com

>From: "JURAJ HUSKA" <[hidden email]>
>To: "Toyin Akin" <[hidden email]>
>CC: [hidden email]
>Subject: Re: [Quantlib-users] eval date-problem solved
>Date: Tue, 10 Jul 2007 10:52:04 -0500
>
>HI,
>
>I just tried to run the function in which I compute the yieldcurves and
>removed the part where I dispose of the SwapRateHelper, instead I forced
>garbage collection right after I run the function
>
>GC.Collect();
>GC.WaitForPendingFinalizers();
>
>
>which also fixes the problem. I am being told this isn't a great solution
>either as those two lines of code could affect other running
>processes.Inany case, it seems to come down to some garbage collection
>issues.
>
>Juraj
>
>
>On 7/10/07, Toyin Akin <[hidden email]> wrote:
>>
>>Hi,
>>
>>Yes you're right.
>>
>>I reckon you might have it there with the notification logic.
>>
>>But if that is the case, if you write significant amount of code based on
>>the C# wrapper, you are likely to encounter various places where the logic
>>will slow down based on unneeded notifications.
>>
>>Geez, It just goes to show that the garbage collection methodology doesn't
>>play at all well with notification messages where you have this sort of
>>Observer pattern. At least with the QuantLib C# wrapper anyway
>>
>>I wonder how regular .NET objects work written with the Observer pattern,
>>where notifications are generated within a loop?
>>
>>Maybe it would be possible to expose a method from the C# generated
>>classes
>>to unregister itself.
>>However, I think that unlike the Dispose() method, this may act on all
>>referenced objects (the one within the array as well as itself in our loop
>>example).
>>
>>If this is indeed true, it's hard to see an elegant solution to this.
>>Besides turning off notification altogether.
>>
>>Toyin Akin
>>CapeTools QuantTools
>>www.QuantTools.com
>>
>> >From: Luigi Ballabio <[hidden email]>
>> >To: Toyin Akin <[hidden email]>
>> >CC: [hidden email], [hidden email]
>> >Subject: Re: [Quantlib-users] eval date-problem solved
>> >Date: Tue, 10 Jul 2007 11:33:03 +0200
>> >
>> >On Tue, 2007-07-10 at 10:07 +0100, Toyin Akin wrote:
>> > > If the latter point is true, then this issue would/should also be
>> >present
>> > > within the c++ layer. Might be interesting to write the c++ version
>>of
>> >this
>> > > example to compare...
>> >
>> >Yes, I though about this. However, in the C++ version the helpers would
>> >be automatically deleted as soon as the corresponding curve goes out of
>> >scope at the end of the loop. Therefore, they would no longer be around
>> >to receive notifications when the evaluation date is changed at the
>> >beginning of the next loop. If one wanted to see the effect, one would
>> >have to store them somewhere so that they're kept alive.
>> >
>> >Luigi
>> >
>> >
>> >--
>> >
>> >The rule on staying alive as a forecaster is to give 'em a number or
>> >give 'em a date, but never give 'em both at once.
>> >-- Jane Bryant Quinn
>> >
>> >
>>
>>_________________________________________________________________
>>Watch all 9 Live Earth concerts live on MSN.  http://liveearth.uk.msn.com
>>
>>

_________________________________________________________________
The next generation of Hotmail is here! http://www.newhotmail.co.uk


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users