This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: How to reduce size of executable?
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Sergiy Lozovsky <serge_lozovsky at yahoo dot com>
- Cc: tromey at redhat dot com, <java at gcc dot gnu dot org>
- Date: Thu, 12 Dec 2002 12:43:58 -0500 (EST)
- Subject: Re: How to reduce size of executable?
On Wed, 11 Dec 2002, Sergiy Lozovsky wrote:
> I'm not going to make serious changes to GCJ. Having
> this in mind, do I have any chances to run JAVA/GCJ
> application at Linux device with 8M of RAM? (sure
> kernel will take a little bit more than 1M, some other
> stuff).
Maybe. Obviously it depends on the size of your application.
> What minimal size of HelloWorld can I expect.
With a little bit of hacking (on i686-linux) I get:
[jsturm@suzy tmp]$ ls -l hello
-rwxrwxr-x 1 jsturm jsturm 997988 Dec 12 12:21 hello
[jsturm@suzy tmp]$ size hello
text data bss dec hex filename
741369 244800 111720 1097889 10c0a1 hello
[jsturm@suzy tmp]$ ldd hello
libgcc_s.so.1 => /opt/gcc/lib/libgcc_s.so.1 (0x40029000)
libm.so.6 => /lib/i686/libm.so.6 (0x40031000)
libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40054000)
libdl.so.2 => /lib/libdl.so.2 (0x40069000)
libc.so.6 => /lib/i686/libc.so.6 (0x4006d000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
[jsturm@suzy tmp]$ ./hello
Hello World
This image contains exactly 219 classes. The bytecode interpreter and
JNI are disabled. Overall VM footprint is around 5MB, but much of that
isn't mapped and consists of locale data, etc.:
VmSize: 5516 kB
VmLck: 0 kB
VmRSS: 1928 kB
VmData: 2620 kB
VmStk: 20 kB
VmExe: 728 kB
VmLib: 1580 kB
I'd guess that with a less-bloated libc (i.e. newlib) you could cut
the memory footprint about in half.
Jeff