[IronPython] Lightweight Code Generation?

Jim Hugunin jim at ironpython.com
Mon Oct 11 05:46:41 CEST 2004

Lloyd Dupont wrote:
> what about [2.0] DynamicMethod?
> I heard they could be garbage collected...
> I mean each line of python code could be staright executed in the current
> context (without creating new assemblies and stuff), but function could
> generated as DynamicMethod
> this way you don't have any kind of 'memory leak', do you?

Absolutely.  DynamicMethods are the new class in 2.0 that people call
Lightweight Code Generation (LCG).  These are the near-term solution to the
need to reclaim memory from generated code.  Here's my quote from your own

Jim H. wrote previously:
> > It should be a trivial matter to support this form of generation as an
> > option in IronPython that is used only on systems that support
> > DynamicMethod.  This would mean that 1.1 systems would have an
> interactive
> > interpreter with a memory leak, but that on 2.0 that same interactive
> > interpreter would stop leaking making it viable in a greater range of
> > circumstances.

The leak on 1.1-based systems is there because they don't support
DynamicMethod so all code generation will have to be through
AssemblyBuilders which will leak over time.


More information about the Ironpython-users mailing list