When I discussed the
memory footprints of several C/C++ elements, I apparently missed a
very important item: operator new
and related functions. I
assumed new
shouldn't increase the binary that much,
but boy was I wrong.
The short story is that officially new
should throw an
exception when it can't allocate new memory. Exceptions come with about
60 kb worth of baggage. Yes, this is more or less the same stuff that
goes into vector
and string
.
The long story, including a detailed look at a minimal binary,
a binary that uses new
and a solution to the exception overhead (in this particular case anyway) can be read below the fold.