[IronPython] Will this leak memory?

Jonathan Allen grauenwolf at gmail.com
Thu Oct 14 07:49:37 CEST 2010


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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20101013/ea0502b9/attachment.html>


More information about the Ironpython-users mailing list