Does using 'new' and 'delete' increase executable size?

S

Stefan

Hi,
My file size has gone from 32kb to 100kb, and I was wondering if using
the 'new' and 'delete' keywords were responsible. I heard that if you
use them the linker has to include extra routines in the program to
make them work; a heap manager. Is this true? I am using Visual C++
..NET 2003 by the way.
 
V

Victor Bazarov

Stefan said:
My file size has gone from 32kb to 100kb, and I was wondering if using
the 'new' and 'delete' keywords were responsible. I heard that if you
use them the linker has to include extra routines in the program to
make them work; a heap manager. Is this true? I am using Visual C++
.NET 2003 by the way.

There is nothing in the language specification that defines or requires
a certain size of the resulting [compiled] program. It all depends on
the compiler/linker combination you're using. So, given that, it's really
impossible to answer your question in the language terms. I recommend
you to ask in the compiler newsgroup: microsoft.public.vc.language.

That said, the C++ motto is "you get only what you need", so adding any
element of the language to your program where it hasn't been before (new
and delete too) probably costs some amount of code size. As to what parts
of the library need to be pulled in, depends solely on the library. It's
circumstantial evidence that if you add 'new' and 'delete', the size grows
from 32K to 100K, but if that's the only change you make, it's pretty
strong indication that they are responsible. Still, no direct evidence,
though.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top