Java Performance

How to check the Memory used by Java


class CheckMemory{
   public static void main(String[] a) {
      Runtime rt = Runtime.getRuntime();
      System.out.println(" Free memory: " + rt.freeMemory());
      System.out.println("Total memory: " + rt.totalMemory());
      while (true);
   }
}

To cehck its usage at Client and Serverside run them like:-

Client Side - JVM Usage:-
C:\>\progra~1\java\jdk1.6.0_02\bin\java LongWhile
 Free memory: 4997088
Total memory: 5177344
ServerSide JVM usage:-
C:\>\progra~1\java\jdk1.6.0_02\bin\java -server LongWhile
 Free memory: 4997088
Total memory: 5177344

Comments

Popular posts from this blog

Java

RTC - Repository : How to Revert Back the Changes