outofmemoryexception, BusyChangedEventHandler

outofmemoryexception, BusyChangedEventHandler

Old forum URL: forums.lhotka.net/forums/t/9398.aspx


fsl posted on Wednesday, August 18, 2010

Hi there

I have a problem where a BusyChangedEventHandler is referencing my BOs and keeping them in memory. This is causing outofmemoryexception's when the number of fetch BOs gets high. I have no references to BusyChangedEventHandler in my own code. 

It seems to be related to this post:

http://forums.lhotka.net/forums/p/7133/34109.aspx#34109

, since i have a readonlybase derived object inside a businessbase, in a managed backing field. The readonlybased objects exists during the lifetime of the program.

I'm using csla 3.8.3

 

Any suggestions?

RockfordLhotka replied on Wednesday, August 18, 2010

If I understand you correctly, you have a ROB object that is cached - kept in memory using a static field.

And you have one or more BB objects that are treating this ROB as a child (because that's what it means when you store an object reference in a managed field).

That violates the single parent rule. A CSLA object can have exactly one parent. In this case the ROB is its own parent (due to the static cache) and you've made it a child of every instance of the BB object that has it in a managed field.

Yes, that'd be disaster.

The solution is to recognize that this object isn't a child of any BB, and therefore can't be stored in a managed field - because BB managed fields are only for child object references.

Copyright (c) Marimer LLC