I've got a massive memory leak in my program. This is the first time I've
used IronPython in a tight loop, so I'm wondering if this could be the
cause.
For Each column In m_Columns
Dim rawValue As String
rawValue =
line.Substring(column.FileColumnIndex.Value - 1,
column.FileColumnEndIndex.Value - column.FileColumnIndex.Value + 1)
If column.IncludeColumnFunction <> "" Then
Dim scope = m_ScriptEngine.CreateScope
scope.SetVariable("Line", line)
scope.SetVariable("Row", targetRow)
If Not
CBool(m_ScriptEngine.Execute(column.IncludeColumnFunction, scope)) Then
Continue For 'skip this column
End If
targetRow(column.DatabaseColumnName) =
column.ParseValue(rawValue, targetRow)
Next
The string named column.IncludeColumnFunction never changes for a given
column. It is usually something simple like "Row['Foo'] == 'Bar'".
Can I/should I be caching the compiled function?
Should I be destroying the scope variable in some way when I'm done with it?
Jonathan Allen
619-933-8527
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com