How to analyze size of exe file created using Delphi?

I would like to get a report explaining why the exe built with Delphi is of a certain size.

For example, something like this:

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

I would like to have such a report to understand why the exe I just built is 120 MB in size. It uses a lot of files from another application, which when building is 90 MB. I added only two units (and deleted a lot), and the size changed from 90 to 120 MB. I was expecting a smaller size (given many deleted units).

Is there any tool that already does this, or is there a way to examine this problem from the IDE?

+5
source share
2 answers

I would like to get a report explaining why the exe built with Delphi is of a certain size.

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

enter image description here

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

Another similar tool is MapFileStats Eric Grange.


Can I use EurekaLog without debuginfo?

From the EurekaLog Documentation :

"Debugging information" (Linker page, new Delphi) / "Enable TD32 debugging information" (old Delphi) / "Full debugging information" (C ++ Builder) - this option includes debugging information for an external debugger in TD32 format in your application, You may need this option if you use Run / Attach to Process, and Delphi cannot find debugging information. In addition, EurekaLog uses TD32 information to fill in the missing information in C ++ Builder. Please note that the size of your Delphi application can increase by 5-10 times by turning this option on (C ++ Builder writes information to a separate .tds file) if you did not enable the option "Debug space in a separate TDS file".

AND

Map file - By enabling this option, you tell the Delphi linker to create a separate .map file with your executable. The map file contains an easy-to-read view of the debugging information. Various settings for this option control the level of detail of the output. Usually there is no need to change it to anything that is different from "Off" or "Detailed". The file card is used by various tools as the main source of debugging information. For example, EurekaLog automatically enables this option and uses the map file to create debugging information in its own format, and then injects it into the application. This is why you rarely have to change this setting manually.

This means that the map file is inserted into the exe file, while full debugging information in exe is optional.

+6
source

If you do not read the small hex, you can set the Map File to Segments in the project settings - Delphi Compiler - Linking. You will receive a text file named yourexe.map, which contains a list of included modules and their corresponding length.

This allows a basic analysis of the contents of your exe. However, he will not answer your next question: “Do I really need all this?” ...

0
source

Source: https://habr.com/ru/post/1260574/


All Articles