[Qt-interest] QScriptEngine: "Could not allocate register file: 12"

Thiago Macieira thiago at kde.org
Thu May 6 21:46:55 CEST 2010


Em Quinta-feira 6. Maio 2010, às 20.55.40, Pedro Santos escreveu:
> Am 06.05.2010 20:33, schrieb Bob Hood:
> > On 5/6/2010 12:16 PM, Pedro Santos wrote:
> >> Am 06.05.2010 10:33, schrieb Thiago Macieira:
> >>> #else
> >>> 
> >>>               fprintf(stderr, "Could not allocate register file: %d\n",
> >>>               errno);
> >>> 
> >>> #endif
> >>> 
> >>>               CRASH();
> >>>           
> >>>           }
> >>> 
> >>> And as someone suspected, 12 is the errno and on Linux:
> >>> 
> >>> #define ENOMEM          12      /* Out of memory */
> >> 
> >> Is there a way to avoid the crash of the application? I've tryed to
> >> surround the allocation of QScriptEngine's with a try/catch block, but
> >> it won't work. I have no experience catching exections in C++, so I
> >> don't know if its possible in this case and when yes, what I do wrong.
> > 
> > If it's an actual C++ exception, then you should be able to catch it
> > 
> > simply by:
> >      try {
> >      
> >          <code that generates an exception>
> >      
> >      }
> >      catch(...) {
> >      
> >          <process a generic exception>
> >      
> >      }
> 
> The CRASH(); fuction is defined in
> qtsdk-2010.02/qt/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.
> h as:
> 
> #ifndef CRASH
> #if PLATFORM(SYMBIAN)
> #define CRASH() do { \
>      __DEBUGGER(); \
>      User::Panic(_L("Webkit CRASH"),0); \
>      } while(false)
> #else
> #define CRASH() do { \
>      *(int *)(uintptr_t)0xbbadbeef = 0; \
>      ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
> } while(false)
> #endif
> #endif
> 
> there is no execption thrown, right? Is there any other way to catch the
> error and do a decision in my program code. I've also tryed to monitor the
> RAM requirements in my application, but the allocation of QScriptEngine
> seems to not consume that much RAM, the problem seems to be that I run out
> of virtual adress space, as someon mentioned before :-/

No, there isn't.

Don't run out of memory. That's your only option.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100506/0e38ede0/attachment.bin 


More information about the Qt-interest-old mailing list