Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In which memory area are exception classes instances created?

Tags:

c++

exception

I could not find the information where are exception class instances created during exception handling ? In which memory area (stack, heap, static storage, etc.) ? I assume it is not on the stack because of stack-unwinding ...

like image 983
tommyk Avatar asked Feb 12 '10 14:02

tommyk


1 Answers

From the standard:

15.2.4: The memory for the temporary copy of the exception being thrown is allocated in an unspecified way, except as noted in 3.7.3.1.

And 3.7.3.1 says:

3.7.3.1: All objects which neither have dynamic storage duration nor are local have static storage duration. The storage for these objects shall last for the duration of the program (3.6.2, 3.6.3).

like image 50
xian Avatar answered Oct 13 '22 01:10

xian