[IronPython] Is this memory leak ?
Szymon Kobalczyk
s.kobalczyk at softwaremind.pl
Fri Nov 4 23:57:00 CET 2005
Sorry to bother you again.
>x = compile("2+2", "<string>", "eval")
>for i in xrange(123456789):
> eval(x)
>
>
>
In this code, what object is assigned to the x var? Can I just store it
by calling PythonEngine.Evaluate once than invoke multiple times passing
it as variable:
PythonEngine engine = new PythonEngine();
object x = engine.Evaluate("compile('2+2', '<string>', 'eval')");
and somewhere else
PythonEngine engine2 = new PythonEngine();
engine2.SerVariable("x", x);
object result = engine.Evaluate("eval(x)");
Besides, my scripts are not always simple expressions. Sometimes there
are multiple statements and thats why I mostly use PythonEngine.Execute
method. Would the compile function also handle such case? (I guess the
kind argument would should be 'exec' then)
Szymon.
More information about the Ironpython-users
mailing list