Large file sizes after compiling with Lazarus

In the previous post when I was building the WLM Uninstaller tool, my choice was to write the app in Pascal (Lazarus).

When you compile a project in Lazarus, you might end up with large executables. In my case, it was about 100 lines of code but compiled to a 12MB executable!

Luckily, I found out how to significantly compress the file. In Lazarus there is a file called strip.exe that, as the name suggests, strips the file from any unnecessary mess. The file on my installation is located in C:\lazarus\fpc\2.2.2\bin\i386-win32. You can simply use it as follows: “strip file.exe”. The file I compiled went from 12MB to 1.77MB!

A further decrease can be accomplished by using a packer like UPX ( “upx -9 -o outputfile.exe inputfile.exe” ). In my case this was a further jump from 1.77MB to 668kB (5,4% of the original size!).