1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Create smaller Delphi exe file

Discussion in 'Delphi Programming' started by emarti, Nov 27, 2013.

  1. emarti
    Offline

    emarti DF Junior

    in RTTI :: Some time ago I've moved my Delphi 2007 project to Delphi XE. The size of the EXE produced by Delphi 2007 was ~ 5 MB (included some resources, no build with packages used).
    Moving to Delphi XE resulted in EXE size growth to 10.5 MB!


    Ok, "today" the size of the EXE should not be something your users would worry about - but I needed to send beta/test copies to a partner every day / two days / very often.


    The RTTI has changed from Delphi 2007. Delphi 2010 and Delphi XE have an "extended RTTI" - making executables larger.


    Anyway, I had to shrink the size of my EXEcutable, and since I was not using any RTTI in that project, here's what I did:


    program MyDelphiXE


    {$WEAKLINKRTTI ON}
    {$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}


    ...
    This was placed under the "program" keyword in the DPR (Delphi project file).
    The "{$WEAKLINKRTTI ON}" compiler directive (default value if OFF) only affects linking - methods are not included in the binary so that RTTI can not find and invoke methods at run time.


    The "{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}" controls the amount of extended RTTI information that is emitted for a class or record type - it disables all the RTTI options and sets to not emit any extended RTTI information.


    With the above directive in place my EXE size was reduced to 9 MB. Not much.


    Then, I've found UPX - packer for executables. Using "UPX -9 MyDelphiXE.exe" I've reduced the EXE size to a fantastic 3.5 MB!
     
    paramithas likes this.
  2. gujadoo
    Offline

    gujadoo DF Junior

    good technic. :)
    Thanks.


    *** I usally found antivirus report program that compress with UPX as a virus.
     
  3. emarti
    Offline

    emarti DF Junior

    Yes, but no problem. Problem is your anti-virus software. Change it! :)
     
  4. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    no problem with own antivirus problem with virustotal or other sites
    if you scan program virustotal say :virus found :D
     
  5. emarti
    Offline

    emarti DF Junior

    I am using AVG and Microsoft Security Ess. (other pc). No problem to found virus from compress with upx. But I said that Avast anti-virus may do it.
     
  6. kamiserg
    Offline

    kamiserg DF Member

    I once used this to make applications with low weight.

    http://kolmck.net/
     
  7. akosinald
    Offline

    akosinald DF Member

    been using UPX since version 1... UPX FTW!
     
  8. a3664910@drdrb.net
    Offline

    [email protected] DF Junior

  9. aarmada
    Online

    aarmada Guest

    RE:

    wow this is very helpful thanks
     
  10. Mr.Lonely
    Offline

    Mr.Lonely DF Junior

  11. sandro.giusto
    Offline

    sandro.giusto DF Member

    RE:

    The shrinkage obtained switching from Debug to Release build configuration is more than welcome for my needs!

    Thank you very very very much!

    Bye, Sandro
     
  12. Pichit
    Offline

    Pichit DF Junior

    RE:

    thank you i will try
     
  13. Prof_Ho2
    Offline

    Prof_Ho2 DF Member

    Good discussion point
     
     
  14. adisaks
    Offline

    adisaks DF Member

    helpful thank you.
     

Share This Page