This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Memory residence


From: Andrew Haley <aph@redhat.com>

> shudo@computer.org writes:
>  > Generally speaking, AOT compilers like GCJ are known to be
>  > advantageous to JVMs which interpret and/or compile Java bytecode.
>  > I observed memory occupation of Java programs with GCJ 4.0, gij and
>  > JDK 5.0 on a Linux box.
>  >
>  >
>  > The first Java program is very simple one which just pauses for 60 sec:
>  > 
>  >   public class Pause {
>  >     public static void main(String[] args) {
>  >       try { Thread.sleep(60000); } catch (InterruptedException e) {}
>  >     }
>  >   }
>  >
>  > Memory occupation of the program (and a runtime) shown by 'ps' command
>  > is as follows:

I summerze those numbers into the following table:

           VSZ    RSS  (MB)
  Sun JDK  256.2   9.6
  gij      36.7   10.4
  gcj -O2  33.7   12.3
  IBM JDK  285.8  13.1

Sun JDK means JDK 5.0 Update 3 and IBM means IBM JDK 1.4.2 SR1a.

The computer has only 512 MB of memory and pages allocated for Eclipse
could be potentially paged out as you pointed out.


I made another experiment on another computer having much memory, 2 GB.
In this case, paging out did not happen.  I could confirm it with the
'free' command showing 'swap' as 0 at all times.
The results are as follows:

           VSZ    RSS  (MB)
  gij       35.8   9.5
  Sun JDK  256.2   9.7
  gcj -O2   32.6  11.2
  IBM JDK  564.0  14.6


>  > Another Java program is Eclipse, an IDE. The version runs with JDK 5.0
>  > is 3.1M7 and one with GCJ is 3.1M6 I found in the current development
>  > version of Fedora Core 4. Initial heap size was set as 40 MB in all cases.

The results on a PC with 2 GB of memory:

       VSZ    RSS   (MB)
  IBM  343.6  100.6
  Sun  503.8  110.1
  GCJ  291.9  138.0


> You've got to be very suspicious of these simple numbers.  gcj, like
> gcc, uses the system shared library loader to memory-map all of the
> shared libraries that are used.  These appear in both the virtual and
> resident set sizes.  However, the shared libraries are shared between
> processes, so memory consumption figures for a single process may be
> misleading.

It is one of advantages of AOT compilers like GCJ.  We have to note it
when we show numbers about memory consumption.

Sun has also been working on such sharing.  Their results are Class
Data Sharing of JDK 5.0 and a research named MVM (Multi-tasking VM).


  Kazuyuki Shudo	shudo@computer.org	http://www.shudo.net/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]