Catching V8::FatalProcessOutOfMemory while creating an isolate (SetFatalErrorHandler does not work)

319 views
Skip to first unread message

Oliver Bock

unread,
Sep 3, 2014, 12:53:46 AM9/3/14
to v8-u...@googlegroups.com
If I create many isolates to run v8 in many threads then I will run out of memory.  How can I catch these out-of-memory situations so that I can output an appropriate error message?  SetFatalErrorHandler() does not work for me because it needs an isolate to be installed before it is called.  However the out-of-memory error occurs during the second line below, before I can call SetFatalErrorHandler().  (The Locker calls V8::Initialize(), which eventually runs out of memory.)

    isolate = v8::Isolate::New();
    v8::Locker v8ThreadLock(isolate);
    v8::Isolate::Scope isolate_scope(isolate);
    V8::SetFatalErrorHandler(FatalErrorCallback);


  Oliver

Ben Noordhuis

unread,
Sep 3, 2014, 6:38:21 AM9/3/14
to v8-u...@googlegroups.com
On Wed, Sep 3, 2014 at 6:53 AM, Oliver Bock <oli...@g7.org> wrote:
> If I create many isolates to run v8 in many threads then I will run out of
> memory. How can I catch these out-of-memory situations so that I can output
> an appropriate error message? SetFatalErrorHandler() does not work for me
> because it needs an isolate to be installed before it is called. However
> the out-of-memory error occurs during the second line below, before I can
> call SetFatalErrorHandler(). (The Locker calls V8::Initialize(), which
> eventually runs out of memory.)

I don't think you can catch them. Last I looked at it, the isolate
initialization step neither handled OOM errors or resource limits like
RLIMIT_NPROC graciously.
Reply all
Reply to author
Forward
0 new messages