Subj : Re: Problem with the context To : Baltasar San Frutos From : Igor Bukanov Date : Wed Sep 17 2003 06:17 pm The sequence > ctx.setCachingEnabled(false); > ctx.setCachingEnabled(true); would not cleanup ALL caches, it was only addressed in Rhino CVS tip, see http://bugzilla.mozilla.org/show_bug.cgi?id=213279 which removed all static caches from Rhino and instead stores then in the top level scope object. Note that Context does not store any objects or caches, it the scope object that does and you should ALWAYS use the following try/finally pattern when using Context.enter/exit: Context cx = Context.enter(); try { use cx } finally { Context.exit(); } Regards, Igor Baltasar San Frutos wrote: > Hello > I believe that I have a problem with the context. This is the JAVA source. > ..... > Context cx = Context.enter(); > Scriptable scope = cx.initStandardObjects(null); > > ScriptableObject.defineClass(scope, api.dom.Window.class); > Object[] arguments = { document.getBody(), respuesta, > _location_url }; > Scriptable myWindow = cx.newObject(scope, > api.dom.Window.class.getName(), arguments); > scope.put("window", scope, myWindow); > > ScriptableObject.defineClass(scope, api.dom.Screen.class); > Screen screen = (Screen) cx.newObject(scope, > api.dom.Screen.class.getName(), null); > scope.put("screen", scope, screen); > > ScriptableObject.defineClass(scope, ObjectGenerico.class); > ObjectGenerico objThis = (ObjectGenerico) cx.newObject(scope, > ObjectGenerico.class.getName(), null); > scope.put("this", scope, objThis); > > executeSource(source); > > ctx.setCachingEnabled(false); > ctx.setCachingEnabled(true); > ctx.exit(); > ..... > > As it is seen, I add to the context several objects, Soon I execute the > JavaScript source , after executing the JavaScript source clean cache of > the context and I exit the context, but them object that I have added, > does not erase follow in memory, that can I make to erase these objects? > > Thank you very much > > > .