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

Pedro Santos nonspam2048 at yahoo.de
Thu May 6 20:55:40 CEST 2010


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 :-/



More information about the Qt-interest-old mailing list