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)
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]][])->
3fb54760(Ciloci.Flee.Expression`1[[System.Object, mscorlib]])->
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,
AppPoint Software Solutions.

Feb 18, 2010 at 3:07 PM


  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.