Hi Szymon, I believe I haven't yet responded to your questions. Sorry for the delay.
> First I iterated the Embed1 sample 10 000 times. Unfortunately this resulted > in big increase in memory allocation (from 10K to >100K confirmed both in Task > Manager and with perfmon). I started looking at PythonEngine implementation > and it looks that although I can create its instance all calls are redirected > to a static global object. This doesn't "smells" nice. This does not necessarily have to be a bad sign. The Evaluate method ends up parsing the expression, generating code and then executing it. There is no smart caching in place that would detect repetitive expressions and reuse the code. Either way, the memory is garbage collected (including the generated code) so when the time comes (it depends on many variables garbage collector monitors when that time comes) memory will get collected. Pre-compiling the expression certainly helps as you have observed and I think that adding Compile method (equivalent to built-in compile function) on the PythonEngine is a good idea. > So I wonder what happens in the PythonEngine that makes this huge memory loss? > Another question is, why Expr.Evaluate() is marked as "experimental" and if it > is safe to use it? Good question. As part of the performance boosts, it may make sense to evaluate expression rather than parse/generage code/execute for certain kinds of expressions. This code is not currently used (Options.FastEval is set to false) so from that perspective there may be some bugs in the fast eval code path that we have not discovered yet. I hope this helps Martin _______________________________________________ users-ironpython.com mailing list users-ironpython.com@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com