[Lazarus] Large program size - 1.8 MB for empty GUI project

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Apr 7 23:45:43 CEST 2009

Graeme Geldenhuys schrieb:

>> I thought this was known:
>> http://wiki.lazarus.freepascal.org/DesignGuidelines
> This is the first I here of this.

Me 2.

> I have used FPC since 2.0.2 under Linux and Windows and haven't had
> any issues. I limit the usage of interface uses clause as much as
> possible. I believed that is why the smartlinking works so well with
> fpGUI - I can create a GUI application that is only 340KB in size.

Smartlinking is not directly affected by Uses. Instead it's most often 
the code in used unit Initzialization sections, that makes all related 
code part of the executable. E.g. when initialization code creates 
objects or references subroutines, that are not otherwise used by the 
application code, a smart linker cannot exclude that definitely 
referenced code.

Similarly virtual methods: they are referenced in the VMT, which again 
is referenced in every instance of the class. Consequently virtual 
methods must become part of the executable, as soon as a class typename 
is used in any way in an application. Static methods, in contrast, can 
be safely omitted when not referenced anywhere else. IMO.


More information about the Lazarus mailing list