Dismiss Notice

REGISTRATION IS AFTER ADMIN ACTIVATION

DONATIONS WITH PAYPAL CLICK TO BUTTON

1 MONTH VIP - 5$; 3 MONTHS VIP - 10$; 6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$

DONATIONS WITH Bitcoin Address:3NRs3CK3fhXifrNYxHEZKpETDd9vNLMsMD

Dismiss Notice
The registration is approved by the Administrator. It takes about 1 day to approve your registration
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!
     
  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. N0body
    Online

    N0bodyN0body is a Verified Member DelphiFan Administrator 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

    a3664910@drdrb.net DF Junior

  9. aarmada
    Offline

    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
    Online

    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

Laws
Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.
Donate Help To Us and Be VIP
DONATIONS WITH PAYPAL CLICK TO BUTTON
6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$
Social Block