This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: Memory footprint ?
- To: Amancio Hasty Jr <hasty@netcom.com>
- Subject: Re: Memory footprint ?
- From: Jeff Sturm <jsturm@cc42593-a.taylor1.mi.home.com>
- Date: Sun, 13 Jun 1999 12:38:46 -0400 (EDT)
- cc: java-discuss@sourceware.cygnus.com
This program is different than your first example, which allocates 1000
java.lang.String objects, due to the concatenation operator.
The memory footprint is due mostly to libgcj's runtime and the garbage
collector, I'd assume. The GC often starts up with a large heap, for
efficiency. (I don't know what the Boehm collector is doing exactly, but
some releases of Sun's JDK preallocate 8MB of heap.)
--
Jeff Sturm
jsturm1@home.com
On Sat, 12 Jun 1999, Amancio Hasty Jr wrote:
>
> Just out of curiosity I wrote a simple c++ hello program.
>
> #include <iostream>
> int main() {
> int i;
> for (i = 0; i < 10000 ; i++) {
> cout << "Hello" << "\n";
> }
> }
>
>
> ls -ald /usr/lib/libstd*
> -r--r--r-- 1 root wheel 373754 May 7 23:03 /usr/lib/libstdc++.a
> lrwxr-xr-x 1 root wheel 14 May 7 23:03 /usr/lib/libstdc++.so -> libstdc++.so.3
> -r--r--r-- 1 root wheel 274986 Apr 11 05:26 /usr/lib/libstdc++.so.2
> -r--r--r-- 1 root wheel 304674 May 7 23:03 /usr/lib/libstdc++.so.3
> -r--r--r-- 1 root wheel 348074 Apr 3 18:28 /usr/lib/libstdc++_p.a
>
> g++ -o test test.c++ -lstdc++
> root 95502 0.0 0.4 1004 468 p0 T 3:36AM 0:00.10 ./test
>
> So the virtual size of the c++ hello program is about 3 times smaller
> than the gcj hello program.
>
> Cheers,
> Amancio
>