Clearing variable references during expression evaluation

Feb 11, 2010 at 3:07 PM

Hi Eugene,
    We are using Ciloci in our project to execute expressions and allow designers to change them on the fly. Thanks for this awesome library.

    We are using a static instance of IDynamicExpression to perform expression evaluation. Whenever we execute an expression, we fill up the required variables collection and clear them once the expression has executed. After performing a memory analysis of our process, the Ciloci Variables collection seems to be holding on to an instance of our object. An extract of the Windbg log is as follows:

0:049> !gcroot 3fb54754 ( - This is the address of my object whose reference remains in Garbage collector - generation 2)
DOMAIN(00157778):HANDLE(Pinned):6713e0:Root:01fe5270(System.Object[])->
01500b68(System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[BizAPP.Runtime.Core.Utils.ExpressionEvaluatorHelper+ExpressionEvaluatorItem, BizAPP.Runtime.Core.Framework]])->
25e1999c(System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[BizAPP.Runtime.Core.Utils.ExpressionEvaluatorHelper+ExpressionEvaluatorItem, BizAPP.Runtime.Core.Framework]][])->
3fb4b3d8(BizAPP.Runtime.Core.Utils.ExpressionEvaluatorHelper+ExpressionEvaluatorItem)->
3fb54760(Ciloci.Flee.Expression`1[[System.Object, mscorlib]])->
3fb54940(Ciloci.Flee.ExpressionOptions)->
3fb6222c(System.EventHandler)->
3fb621fc(System.Object[])->
3fb4d584(System.EventHandler)->
3fb4d530(Ciloci.Flee.VariableCollection)->
3fb4d550(System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[Ciloci.Flee.IVariable, Ciloci.Flee]])->
3fb54718(System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[Ciloci.Flee.IVariable, Ciloci.Flee]][])


    I could provide you with the detailed log and code samples if you need them. Can you please let us know if there are any additional references to the Variables collection being added internally that are not cleared?

Thanks in advance,
Bharath
AppPoint Software Solutions.

Feb 18, 2010 at 3:07 PM

Hello,

  On further analysis I found that the memory leakage was an issue at my end. I was not clearing the variables for the base expression that was cloned many time over even though the resultant cloned expressions were being disposed correctly.

Cheers,
Bharath.