Passing objects between Nashorn engines
sundararajan.athijegannathan at oracle.com
Sat Nov 1 13:19:19 UTC 2014
Yes, ScriptObjectMirror keeps the underlying ScriptObject and Global
instance in whose scope that object was created. So long as a
ScriptObjectMirror is alive, the ScriptObject and associated Global
instance (and any transitive data) would be alive.
On Friday 31 October 2014 08:48 PM, Serguei Mourachov wrote:
> 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?
More information about the nashorn-dev