C++ exception code size / recommended practice

Joe Buck jbuck@synopsys.com
Thu Apr 10 18:24:00 GMT 2003


On Thu, Apr 10, 2003 at 01:20:32AM +0200, Tim Jansen wrote:
> Hi...
> 
> I wonder what are the recommended practices for decreasing code size of C++ 
> applications with exceptions. I switched a project from -fno-exceptions to 
> regular exception support. This increased the size of the two binaries, after 
> stripping, from 370572 and 39660 bytes to 581308 and 58408, respectively. 
> Thus the increase in code size is > 50% (compiler: GCC 3.3 20030226 from SuSE 
> 8.2). 

Actually, the extra size is, for the most part, not code at all; rather,
it is tables (for specifying how the stack is to be unwound if an
exception occurs).  Since the tables land in a separate section, in most
cases they will not occupy RAM until an exception occurs, at which point
they are paged in from disk.  What this means is that your executable
consumes extra disk space, but the increase in RAM is far less.



More information about the Gcc mailing list