views:

391

answers:

5

I have a query about the option in Delphi to build with or without runtime packages (Project->Option->Packages).
The executable file size seem to be smaller (389KB) when I checked the box "Build with runtime packages" compared to when I uncheck the box (3,521KB). Why is that the case?

I am having so much trouble building an installation disk for it and can't figure out what files should be included in the installation. I wonder if this might have anything to do with it, but I have tried both options already.

+9  A: 

When you build with runtime packages, the VCL and RTL are loaded from the packages and so their code doesn't have to be linked into your EXE. So the EXE gets smaller, but the total installation gets larger since you can't use smart linking to reduce the size of the packages.

As you've already noticed, using packages causes trouble for memory leak tracing, and it also causes trouble for debuggging. It's generally only worthwhile to use them if you're using plugins that will also need runtime packages.

Mason Wheeler
It's also beneficial if you are going to be running many different applications on one machine which all use the VCL -- no sense loading it into memory multiple times.
Nick Hodges
+1 And even in the secenario where plugins might need them, You're almost always better off designing them not to require runtime packages. Because those plugins wold all be broken when you built the app in a newer Delphi version, iow: you could never upgrade to newer tools, and the plugin authors could not as well.
Robert Giesecke
Except that with gigabytes of RAM on most PCs, the trouble from version issues and the idea that a wrong BPL could be loaded from somewhere in my path (DLL hell == BPL hell) keep a lot of people from ever wanting to use such a technology in practice. The ability to run entirely "side-along" would be great, if BPLs could be trusted to only load locally, and ignoring the system PATH environment.
Warren P
A: 

Don't know about D2010, but in D2006 there is an option in the project menu called "Information for ProjectName".

This will show you which packages are included after you compile.

However, as Mason has stated, there is little advantage to using run time packages, and quite a few disadvantages.

Gerry
+7  A: 

The answers so far miss one crucial point: Runtime packages are useful in the same way as DLLs are useful if you have a suite of applications that work together and are installed together. You could of course link the VCL and third party libraries into all of them by building them without packages, but depending on the number of applications and used libraries the size of these applications combined will be larger than the size of them built with runtime packages plus the size of those runtime packages. This will make for larger setup packages, which isn't the big issue it once was.

But using all these applications at the same time will also bring a much higher load for the system. Since every application uses its own copy of the VCL and the other libraries all these need to be loaded from disc into memory, which causes more I/O. And then there will be several copies of them in memory, each taking up space for the code. When runtime packages are used each application will have its own memory area for data, but they will all share the same copy of the packages' code in memory.

For a single self-contained application without any special needs definitely build without packages.

mghie
How much of the typical 4GB of memory is filled? Anyway, it still applies somewhat, because cache is memory too, and quite expensive. Still, I think is more a theoretic case, since not all pages of the RTL/VCL will be active too.
Marco van de Voort
Well, call me old-fashioned, but having enough memory isn't sufficient reason to waste it. That kind of thinking has brought us the sorry state of software we have today. My current machine has 4000 times the RAM and 20000 times the hard disc space compared to my first PC, yet it feels like most of all these additional resources are wasted...
mghie
I come from Chemistry originally, and there is no substitute for measuring and a feeling for magnitudes. That sense is stronger than the kneejerk "waste" reaction.
Marco van de Voort
Robert Giesecke
No, what I'm offering here is some technical background information. I have not advised to use packages for multiple applications (this is *not* about plugins only), I just think one should know enough about packages to make an informed decision. Every developer needs to make their own decision after weighing the pros and cons. It's true, I have so far always decided against using packages. But a statement like "a myriad of interdependency issues" is little more than hyperbole.
mghie
Well, "a myriad" might be a bit too much. However, everything that gets loaded into your process, that is using BPLs, has to know the versions of every DCU that got compiled into everything else. Otherwise things either fail immediately on init, or start acting weird later on. You increase complexity instead of partitioning it into manageable chunks.This might also negate the bandwidth argument WRT updates, since you have to replace a whole bunch of binaries after changing one package.
Robert Giesecke
+1  A: 

One of the main reason for using run-time packages is when you need module granularity to deploy/update over a medium that does not accept well large files, like over a wire with a low bandwidth.

Because the run-time packages remain the same until you change your Delphi version - like forever for those still on D7 ;-) - it allows to deploy new versions or new applications without the payload of the RTL/VCL.

But like with DLLs, you have to be careful with the versioning.

François
Does it mean if I "Built with runtime packages" then I have to ship the packages seperately? Sorry if this is a stupid question.
Snackmoore
You have to ship the packages with your application - and be very careful when installing them not to overwrite newer version (update packs may update tehm too). A good installer that properly checks versions is recommended.
ldsandon
snackmoore, most Delphi developers would never build with runtime packages on a final build that is shipped to customers, unless they also want to make their own job more difficult. BPL packages just make life harder for you, unless you really need them for some reason (the other answers tell you why you might need them), then you don't need it, so leave it be.
Warren P
+2  A: 

Regarding your question "what files should be included in the installation": you can use Dependency Walker to track down the library dependencies.

Moritz Beutel