In other words, you have to go out of your way to delete C++ objects
which would most likely mean that you would have to have your own
memory management scheme to deal with it. So this means V8 is geared
more towards browsers than for general purpose use and should really
not be used outside the browser verse. I think that more documentation
is needed on the v8 engine to help shed light on the subject. Guess
it's back to Lua. (-_-).

On Jun 9, 10:08 am, Stephan Beal <[email protected]> wrote:
> On Thu, Jun 9, 2011 at 8:52 AM, CodeJunkie <[email protected]> wrote:
> > Now X is lost and dangling. The C++ destructor is never called, even
> > at program exit.
>
> Don't get lured into that false sense of security (as i did). v8 does NOT
> guaranty that GC will EVER be called, including at app exit. It does not do
> a full GC at exit (supposedly as a performance boost when closing tabs in
> Chrome, if my memory serves me correctly).
>
> That means that when wrapping types which REQUIRE destructor calls for
> proper semantics, you must add functions to those objects which performs
> such cleanup, and call those functions from your JS code. The canonical
> examples are file handles and db connections, which would have a close()
> member (or similar) which cleans up the native object and sets up the object
> state so that future method calls on that object will not step on a
> destructed pointer.
>
> --
> ----- stephan bealhttp://wanderinghorse.net/home/stephan/

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to