size reduction

Hendrik Schreiber
Mon Feb 24 22:18:00 GMT 2003

Thank you guys for the pointers. And my apologies for not really having done my homework and searching the archives first. My question seems to be quite popular...

I don't quite understand how to strip out the unused libgcj classes, but that would definitely be desirable (if it is not done automatically).
Is there a way to tell the compiler to get rid of everything that is not reached by --main and a list of additional classes? We are doing some things with factories using getInstance() so some classes won't be referenced directly but only through interfaces.

Also - and maybe this has been discussed already - for small devices it would be sufficient to support J2ME (in some form or shape), which would reduce the size of the necessary core libraries quite a bit.



-----Original Message-----
From: G. Hauer []
Sent: Monday, February 24, 2003 11:18
Subject: Re: size reduction

Hi all,

Well, thanks to Andrew Green's generous assistance I've been able to
create an arm-elf gcj cross-compiler. I'm answering here since I think
it suffers from the same size problem.

Using the -s option I've been able to reduce a simple HelloWorld-type
application from 9.4M to 1.4M :) but, since I had intended to use this
in an embedded application, I don't think I'm quite there yet.

I'm going to try a build gcj with --disable-interpreter so determine
whether this makes a significant difference.


On Fri, 2003-02-21 at 13:45, Hendrik Schreiber wrote:
> Hi Folks,
> I am currently evaluating gcj. We are developing java software for small devices and consider switching to gcj instead of deploying a vm to the device. One of the biggest problems with the small device VMs is size... they are simply to big. However, I gave gcj a shot and compiled a simple HelloWorld on Win2000 with Cygwin, which produced a 2.1mb executeable with default parameters.
> I am sure that the size of this can be reduced, but unfortunately I don't know a lot about gcc. Can someone please point me at ways to reduce the size? What can I expect as the minimum size for a 'standalone' executable?
> Thanks - your help is appreciated!
> -hendrik

More information about the Java mailing list