[IronPython] IronPython with CherryPy through WSGI Memory issue

Dino Viehland dinov at microsoft.com
Fri Apr 2 18:30:35 CEST 2010

Can Gencer wrote:
> I did some more digging around this, I tried using the wsgi.py found
> in FePy instead (and modifying it to fit with my webserver) and the
> results seem to be better, although not perfect.
> There seems to be a whole bunch of objects that are referenced from this root:
> ESP:550f3e8:Root:015c0150(Microsoft.Scripting.Ast.Block2)->
> 015c00fc(Microsoft.Scripting.Ast.ScopeN)->
> 015c00ec(System.Runtime.CompilerServices.TrueReadOnlyCollection`1[[Microsoft.S
> cripting.Ast.Expression,
> Microsoft.Scripting.Core]])->
> 015c002c(System.Object[])->
> What is this exactly?

Block2/ScopeN are DLR expression trees.  They hold onto more expression trees
or variables and more expression trees.  Can you do !DumpArray on 15c002c?  
I'm curious how big the array is - is it that the array's holding onto the objects
or something in the array?  I would assume it's something in the array.

> Also I have a question about ScriptScopes. Do they get garbage
> collected when a ScriptScope goes out of scope?

More or less the answer is yes.  We can compile code in an optimized form which
is uncollectible but we should only do this for .py files which are getting 
compiled when executing from the command line.  Even then the ScriptScope will
get collected but a bunch of other info won't.

More information about the Ironpython-users mailing list