Memory leak - cloning ExpressionContext

Aug 19, 2011 at 12:48 PM

Hi

1st let me thank you for such great library as Flee really is.

I think i've found bug in ExpressionContext class which leads to leaking memory when using ExpressionContext member method Clone.

Problem is in CloneInternal method

If cloneVariables = True Then
	context.MyVariables = New VariableCollection(Me)
	Me.Variables.Copy(context.MyVariables)
End If

Here, source context is passed into VariableCollection constructor instead of cloned one which means tha VariableCollection hooks to the source context CaseSensitiveChanged event. This way, all clones are indefinitely hooked to its "master" :) And because I use one ExpressionContext as "template" and use its Clone method to create contexts i really use for evaluating expressions, all contexts are held in memory for application lifetime....which is not good

HTH