Designer - out-of-memory error

Ok, so a better pattern for this would be to have a field of type PyCode and store the compiled version. Here is some pseudocode minus error handling:

[code]class MyScriptRunner {
String scriptCode;
PyCode compiledScript;

public void runIt() {
if (compiledScript == null){
compiledScript = Py.compile_flags(scriptCode,
“”,
CompileMode.exec,
CompilerFlags.getCompilerFlags());
}
ScriptManager manager = …
PyStringMap locals = manager.createLocalsMap();
manager.runCode(compiledScript, locals);
}
}[/code]