10

Why does it happen? An empty project (application, *.exe) size is 7 Mb, why?

stukelly
  • 4,257
  • 3
  • 37
  • 44
maxfax
  • 4,281
  • 12
  • 74
  • 120

1 Answers1

12

This is because you are using the Debug build configuration. change to Release and the size will be 1.5 mb (for an empty VCL project).

enter image description here

RRUZ
  • 134,889
  • 20
  • 356
  • 483
  • 5
    1.5 MB is still pretty big for an empty application. – lkessler Jan 25 '12 at 01:16
  • You can reduce this size further by using run time libraries – Peter Jan 25 '12 at 04:22
  • 2
    ... and unset RTTI generation – Arnaud Bouchez Jan 25 '12 at 06:04
  • 2
    Killing RTTI is the most effective option here. Runtime packages make the entire app bigger not smaller – David Heffernan Jan 25 '12 at 07:31
  • 1
    Each byte of an application doing nothing is just waste. It is like complaining about the size of a [swiss army knife](http://2.bp.blogspot.com/-5bfWeeV2EKs/TmKtblpX1HI/AAAAAAAAM7w/v9IBY2g1PRk/s1600/swiss-army-knives.jpg) when you are not going to use it at all. – Uwe Raabe Jan 25 '12 at 08:17
  • 3
    @kobik: Remove the Main Icon and you get a 300kb smaller file. 200kb come from the new Vcl.Themes unit. All other are the usual Delphi 6-XE2 times 100kb each increase. – Andreas Hausladen Jan 25 '12 at 11:30
  • OMG, you still argue for this nonsense topic .. 1.5Mb costs what on multi-Gb SSD/RAM? – Kromster Jan 25 '12 at 13:37
  • 1
    After all: what is the benefit of an empty application. Just delete it! You have the same functionality and it occupies zero bytes. – Uwe Raabe Jan 25 '12 at 14:51
  • @UweRaabe I've seem much more done with 64KB [in .the.product](http://www.pouet.net/prod.php?which=1221). – EMBarbosa Jan 25 '12 at 18:32
  • @Krom One definition of "optimization" I like is: "Use resources without waste them". – EMBarbosa Jan 25 '12 at 18:38
  • @AndreasHausladen there is anywhere the explanation on why? I mean despite RTTI and UNICODE? – EMBarbosa Jan 25 '12 at 18:51
  • 4
    @EMBarbosa: The RTL and VCL grow constantly. EMBT had 11 years to grow it from D5 to XE2. And the RTL VCL doesn't use interfaces that much, so the linker can't remove "unused" code, because it is used even if your application doesn't use it, but the class declarations have fields/properties/methods that are hard bound to other classes. – Andreas Hausladen Jan 25 '12 at 21:27
  • 3
    You can get an explanation from the compiler itself. Turn on the MAP FILES and look at them. That will show you what units are being linked in, and if you have the VCL and Forms, that will definitely be larger than a command line application without the VCL. Your application is definitely not "EMPTY" just because you didn't write much code yourself yet. – Warren P Jan 26 '12 at 00:57