Passing objects between Nashorn engines

Serguei Mourachov smourachov at gmail.com
Fri Oct 31 15:18:38 UTC 2014


I'm working on implementing automatic javascript code reloading.
The process is implemented using following sequence:  when I'm seeing 
any modification our our JS files, I'm preserving state of our system 
calling a function returning ScriptObjectMirror, creating new 
ScriptEngine, and initializing its state passing the ScriptObjectMirror 
to it.
Apparently, it It works as expected in my simple tests, but it seems 
that the initial ScriptObjectMirror keeps reference  to its original 
global and potentially to other old engine internals.
So my question is: is that safe in to share ScriptObjectMirror objects 
between multiple engines and can I assume it's not going to create a 
memory leak,  keeping all the previous engines in memory after I stopped 
using them?

SM




More information about the nashorn-dev mailing list