Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to analyze the filesize of an exe built with Delphi?

I would like to have a report that explains clearly why an exe built with Delphi has a specific size.

For example something like this:

filename: Project1.dpr - total size 100MB
   Details:
    - unit1.dcu - 20MB
    - unit2.dcu - 60MB
    - libraries.dcu - 20MB

I'd like to have this kind of report to understand why an exe i just built is 120MB in size. It uses many files from another application that when built is 90MB. I added just two units (and removed many) and the size changed from 90 to 120 MB. I was expecting a smaller size (considering many removed units).

is there some tool that already does this or is there a way to study this issue from the IDE?

like image 350
LaBracca Avatar asked Nov 30 '16 09:11

LaBracca


1 Answers

I would like to have a report that explains clearly why an exe built with Delphi has a specific size.

Ville Krumlinde wrote a tool that reports the unit sizes in an exe file by parsing the map file, created by the linker: DelphiUnitSizes.

enter image description here

Set Project Options|Linking|Map File to Publics or Detailed and make a full build of the exe. Open the resulting map file with DelphiUnitSizes.

Another similar tool is MapFileStats by Eric Grange.


can i use EurekaLog without debuginfo?

From EurekaLog documentation:

"Debug Information" (Linker page, new Delphi)/"Include TD32 debug info" (old Delphi)/"Full debug information" (C++ Builder) - this option embeds debug information for external debugger in TD32 format into your application. You may need this option if you use "Run"/"Attach to process" and Delphi can not find debug information. Also, EurekaLog uses TD32 info to complete missing information in C++ Builder. Note, that size of your Delphi application can increase 5-10 times by enabling this option (C++ Builder writes information in separate .tds file), unless you enable "Place debug information in separate TDS file" option.

And

"Map file" - by enabling this option you tell the Delphi's linker to create a separate .map file along with your executable. Map file contains human-readable representation of debug information. Different settings for this option controls the detalization level of output. Usually, there is no need to change it to anything, which differs from "Off" or "Detailed". The map-file is used by various tools as primary source of debug information. For example, EurekaLog automatically turns this option on and uses map-file to create a debug information in its own format and then injects it into application. That is why you rarely need to change this option manually.

This means that the map file is injected in a way into the exe file, while including full debug information into the exe is optional.

like image 52
LU RD Avatar answered Sep 28 '22 03:09

LU RD