This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Exception handling information
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: SD <stardust496 at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 21 Aug 2009 03:50:53 +0100
- Subject: Re: Exception handling information
- References: <loom.20090821T042348-452@post.gmane.org>
SD wrote:
> Hello,
>
> After searching this list it appears that with recent gcc (I am using gcc
> 4.1), C++ exception handling has zero overhead (unless an exception actually
> happens)
>
> Where can I find more information on how exception handling is done and if
> this zero overhead property is always true.
There are two EH mechanisms in gcc, one using a Dwarf-2 table-driven
implementation, the other based around use of setjmp-longjmp. Which one is
used depends on the --en/disable-sjlj-exceptions flag at configure time. The
DW2 version has zero overhead in terms of execution time when no exceptions
are thrown, but adds a noticeable amount of memory usage for the eh tables.
The sjlj version incurs a time penalty every time it enters an EH region, and
probably incurs more stack usage doing so, but doesn't have all the big static
data tables that DW2 has.
> I looked a a couple of manuals on the gcc homepage but could not find anything.
Don't think there's much about sjlj except in the gcc sources themselves.
There's a page about DW2 EH on the wiki:
http://gcc.gnu.org/wiki/Dwarf2EHNewbiesHowto
cheers,
DaveK