The change to fix the memory leak issues was to use dynamic methods instead of 
Reflection.Emit which generates non-garbage collectable types & code.  There 
are some downsides to this in that having a type allowed us to make more 
optimizations.  If you want more information than that hopefully Jim can chime 
in.

The Compile/Execute change gives you a method to re-use compiled Python code 
within your program.  It's usable as a work around if we didn't have the leak 
fix in Beta 1.  It looks like there's some limitations to what can be done 
dynamically (currently), and if you hit one of those then you could always us 
this as a work around.

But the real long-term purpose will be to provide a way to execute w/o 
recompiling commonly used code fragments in your program.  That will allow you 
to avoid the overhead of consistently recompiling your scripts when they're not 
changing (or changing infrequently).

I'll file a bug about not having access to the last result of Execute.  One 
option might be to just have Execute return a value - would that be sufficient, 
or do you want to later access _ in another script?.  

If you want it from a script it probably makes sense to make it an option (as 
some people wouldn't want the output for every statement).
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Szymon Kobalczyk
Sent: Tuesday, January 03, 2006 4:00 AM
To: Discussion of IronPython
Subject: Re: [IronPython] 1.0 Beta 1 is out now!

Thanks for a great New Years present!

I'm most interested in what you did to fix the memory issues from 
previous versions. I've already found the Compile and Execute(object) 
methods on PythonEngine. Are there any other changes that can help to 
limit memory footprint when hosting IP?

I found one problem with the Compile/Execute duo: in this mode I don't 
have access to the '_' variable.
It can be read when using the Execute(string) method and it was 
available with the earlier trick to precompile scripts.
I found that it is disabled by last parameter in 
OutputGenerator.GenerateSnippet() method (printExprStmts) that is later 
passed to CodeGen. I don't know Python enough to know if this is 
intended behavior but I found the '_' variable really useful for 'multi 
statement evals'.

Szymon Kobalczyk


_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to