Reducing static binary size

Boehm, Hans hans_boehm@hp.com
Tue Feb 19 09:40:00 GMT 2002


I think there is ongoing work on reducing that.  See for example
http://gcc.gnu.org/ml/java/2002-01/msg00171.html .

If startup time is not critical, you can also try gzexe.  Based on some
small experiments, startup time is still significantly better than with
standard JVMs, but appreciably worse than with an uncompressed executable.
There may be security issues ...

Hans

> -----Original Message-----
> From: Geert Bevin [mailto:gbevin@uwyn.com]
> Sent: Monday, February 18, 2002 11:45 PM
> To: java@gcc.gnu.org
> Subject: Reducing static binary size
> 
> 
> Hello,
> 
> I'm evaluating to use gcj for an opensource project instead 
> of plain old
> c. The merits would be that development in java is much 
> cleaner, offers
> faster development and better supports OO. It's however required to be
> able to provide a statically linked binary that doesn't rely on
> anything. This mainly for system rescue purposes. When trying out gcj
> 3.0.3 and compiling HelloWorld.java like this :
> 
> gcj -static --main=HelloWorld -o HelloWorld HelloWorld.java
> 
> I get an executable of 5752548 bytes, stripping that gets it down to
> 2064192 bytes. Surely this contains a huge lot of dead code for
> something as simple as printing one string to the standard output.
> 
> It there a way to reduce the size of the generated binary 
> even further,
> or does someone have any ideas about how to look into that?
> 
> Thanks for the help,
> 
> Geert Bevin
> -- 
> Geert Bevin             Uwyn
> "Use what you need"     Lambermontlaan 148
> http://www.uwyn.com     1030 Brussels
> gbevin@uwyn.com         Tel & Fax +32 2 245 41 06
> 



More information about the Java mailing list