Extremely large win32 exe file size 10.2 Delphi
I've decided to learn Delphi since I found it perfect for my needs, however while taking a first look at the IDE I've fired up a "VCL Forms Application - Delphi" resized the form and added a button, nothing more. After compiling it, I was socked that I found in the Debug folder the EXE file was INSANLY large!! A 10MB file with NOTHING on it. just a blank button(no code) and a blank form. Even tried removing the button, nothing changed.
Thought it could be the application icon, found that it was the one IDE provided, 56KB in size.
I've tried the Release config, which helped putting it down to 2MB which is still VERY unacceptable for a blank application.
I've tried googling found some complains about file sizes but nothing of my situation (blank app, no code, no tools etc), and also tried editting some configuration settings(Debug info OFF etc) in Debug and Release and in both nothing changed.
Delphi Starter 10.2 is the one I'm using.
Is this supposed to be a normal thing or am I supposed to do something?
With Delphi, the entire VCL framework that you use is linked into the executable - so you can literally just drop that file on any box and it will work - no additional stuff to include unless you reference other libraries (DLLs, OCXs, .NET stuff etc)
I can only guess that you are coming from some other language where the majority of your code is not linked into the application executable - a typical .NET app you describe might be in the order of 30-40k - (that doesn't include the 200+mb of the .NET framework that Microsoft pre-installs for you.) Or maybe a C++ app of similar size, or even a Java app - the problem with those is that you don't get the entire VCL/Component library as part of your app - you have to link to everything that you use, and include those when you distribute your app. That's the benefit of those other languages - mostly Microsoft ones, because the framework you are using is often already on the machine because it came with the OS or some other MS application (Office, Windows Updates, etc.) installed it for you. In the case of Java - your tiny app requires the JVM be installed - how many megs is that?
With Delphi, you can get a similar experience by using what is called Linking with "Run time packages" - but that means you have to also distribute additional files with your application(s) - BPLs - just like you would have to distribute the runtime (msvbvm*) library for VB6, or the MS*CRT* file(s) for C++ apps, or have the proper .NET framework pre-installed (Say you want to use .NET 4.7 on Windows 7 - you either include it with your install, or make it a pre-requisite to having your app run)
The code has to live somewhere - it is just a matter of using the proper technique to achieve what you want (small executable, or easy install)
Take a look at project options / Packages | Runtime Packages - there is a check box to "Link with runtime packages" - then you specify which ones you will distribute along with your app -- personally, I never use this option - with today's multi-terabyte drives, a few megs won't make much difference. - Mobiles apps are a slightly different story... Firemonkey apps are big by VCL standards.... and mobile devices have much more limited space for storing the app... As far as I know, Firemonkey/Mobile compiler doesn't employ smart linking (yet), so you get a lot more of the framework embedded in the exe than what you actually need/use.
Also, as far as having a 10mb DEBUG version - why would you need to distribute that? (btw, that does include all the debug symbols and such for your app - which you really don't want to ship - there are apps that can use that to decompile and produce your code, potentially revealing your intellectual property, similar to .NET - that's why people use the obfuscator with that language)
I have a very large VCL project. Using Delphi 10.1 the exe file is 8 MB in release mode. I didn't dare to use 10.2 yet, so no experience there.
>> A 10MB file with NOTHING on it, just a blank button (no code) and a blank form.
>> Even tried removing the button, nothing changed.
- I use 10.1 version, usual *.exe have about 6MB witch VCL forms, and enough simple FMX forms witch 3D model about 70MB.