Revision as of 21:41, 27 October 2008 by extkbeditor2 (Talk | contribs)

Archived:Throwing any object from 'new' operator on the ARMV5 platform causes a crash (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search


Article Metadata
Platform(s): S60 3rd Edition
S60 3rd Edition, FP1 and FP2
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Created: (12 Jun 2008)
Last edited: extkbeditor2 (27 Oct 2008)


Throwing bad_alloc or any object from new on the ARMV5 platform causes a crash. The problem occurs even if the user throws an object from within an overloaded new operator.

The new operators with the following signatures are affected:

 void *operator new(unsigned int aSize);
 void *operator new[](unsigned int aSize);

How to reproduce

The following code snippet is an example that depicts the problem:

 class Dummy
 void *operator new(unsigned int aSize)
   void* __y = malloc(aSize);
   // try to simulate a bad alloc
   if (__y == 0)
     throw Dummy(); // this will result in a crash
   return __y;


To implement a user-owned overloaded version of new, it must be implemented as class specific. The other way this can be achieved is by defining new as follows:

 void* operator new(size_t s, newarg) throw (std::bad_alloc)

and invoking it as:

 Myclass* my = new (S60) Myclass()
33 page views in the last 30 days.