Pitching of generated IL/code?

Aug 6, 2011 at 1:32 PM

I am using Jurassic ina scenario where the end user of the silverlight site can edit & run javascript with Jurassic. If a user performs many edit/run cycles, what do I need to do to pitch/remove the generated code from each run?



Aug 7, 2011 at 7:35 AM
Edited Aug 7, 2011 at 7:36 AM

Easy - just cease using the ScriptEngine instance and all other Jurassic objects (almost all Jurassic types have a reference to the ScriptEngine) and spin up a new ScriptEngine instance.  The downside is that creating a new ScriptEngine is a heavyweight operation.  To mitigate this performance cost you could try serializing the ScriptEngine immediately after you create the first one and then deserializing it when you need a new one.