Can we re-initialize v8 if it is dead?

18 views
Skip to first unread message

Xiang Zhong

unread,
Nov 23, 2009, 6:10:00 AM11/23/09
to v8-u...@googlegroups.com
Hi, All,


Suppose v8 encounter some fatal exception, like out of memory, and  v8::V8::IsDead() return true.

Is there a way to re-initialize v8 to make it work as normal without restarting the program?



Sincerely~
Xiang

 

Stephan Beal

unread,
Nov 24, 2009, 5:27:54 AM11/24/09
to v8-u...@googlegroups.com
On Mon, Nov 23, 2009 at 12:10 PM, Xiang Zhong <cloc...@gmail.com> wrote:
Suppose v8 encounter some fatal exception, like out of memory, and  v8::V8::IsDead() return true.

Is there a way to re-initialize v8 to make it work as normal without restarting the program?


As i understand it (perhaps incorrectly - the docs aren't as clear as they could be!), IsDead() will return true once static destruction of v8 has started. If that is indeed the case, IsDead() will not return true until after main() has returned. This can be important for client-side objects which use v8 but themselves are also subject to destruction post-main(), since the destruction order of those objects is unpredictable.

--
----- stephan beal
http://wanderinghorse.net/home/stephan/

Xiang

unread,
Nov 24, 2009, 8:02:08 AM11/24/09
to v8-users
Hi, Stephan,


It seems possible that v8::IsDead() returns true before main() exit.

Please check the following comments in v8.h
/**
* Check if V8 is dead and therefore unusable. This is the case
after
* fatal errors such as out-of-memory situations.
*/
static bool IsDead();


From the comments, it looks like IsDead() will return true in
situation of fatal exception like OOM(out of memory).

I think we can catch OOM exception in main() using C++ SEH.

About whether we can re-initialize v8 or not, I now agree with you
that we can't do it.


Sincerely~
Xiang




On Nov 24, 6:27 pm, Stephan Beal <sgb...@googlemail.com> wrote:
Reply all
Reply to author
Forward
0 new messages