What you want is to dispose the context and create a new one. You can find an example for this in d8.cc. There should be no cross-context memory leaks (if you find one, report it!).
In the specific case of your example, (if understood it correctly) the property "wnd" of the global object is set to the new Window object, retaining it in memory. GC won't touch it since the object is reachable through the global object. Setting wnd to undefined will break that link and cause the GC to step in eventually. Yang On Saturday, October 27, 2012 2:59:10 PM UTC+2, Florent S. wrote: > > Hi there ! > > I would like to know if there is a way to force V8 to release ALL the > objects in memory. > > After I executed my script, I would like to free all memory that has been > allocated during the script in the embedded object. > I already the "MakeWeak" mechanism and it works when V8 does a garbage > collection. But if my script is like : > > // begin > var wnd = new Window(); > // end > > The C++ object embedded in Window will never been destroyed, resulting of > course memory leaks. > > I've tried to do a v8::V8::Dispose() but it doesn't help. > > Is there any way to totally clean up the memory without exiting my > application ? > > Best regards, > Florent > > P.S: My application is under Windows 32b > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
