[Ironpython-users] LightweightScopes and scopes in general

Igor Brejc igor.brejc at gmail.com
Fri Feb 10 19:04:15 CET 2012


Hi,

I'm running embedded IronPython scripts (2.6, .NET 3.5) and I was wondering
what happens with the stuff allocated within the script after the script
has finished? For testing purposes I've been executing the following script

s = set()
for i in range(0, 1000000):
    s.add(i)

...and then watching the memory usage of the application. BTW I always shut
down the scripting engine and create a new ScriptScope for each run.

I've noticed that in the debug mode, the memory increases after each run.
When I do a s.clear() before finishing, the increase is unnoticeable, so I
assume those Python sets are kept alive (even if I do GC.Collect()).

I've also tried running in the release mode and turning on
the options["LightweightScopes"] = true mode, which seems to help. But I
cannot find any information about what this option actually does and what
happens with the scope variables in general. Any info would be appreciated.

Thanks,
Igor Brejc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20120210/e4b77316/attachment.html>


More information about the Ironpython-users mailing list