Friday, July 24, 2009

JRockit JRA Analyzer

See a great presentation of JRA here:

To analyse a practical case, write a piece of code which clearly leaks:

package com.pierre.test;

import java.util.ArrayList;
import java.util.List;

public class Pippo {
public static void main(String[] args) throws InterruptedException {
List<Object> list = new ArrayList<Object>();
for (int i = 0; i < 1000000; i++) {
list.add(new Integer(i));


start your program with


in the JVM arguments.

You should see a message
[JRockit] Local management server started.

Start JRockit Mission Control, in the JVM Browser find your running program (Pippo), right click and "Start JRA Recording", choose your template (Full Recording), save to a .jra file .

you should see this message in the Java stdout:

[INFO ][jra ] Starting JRA recording with these options:
filename=C:\temp\jrockit62462.jra, recordingtime=300s, methodsampling=1, gcsampling=1, heapstats=1, nativesamples=0, methodtraces=1, sampletime=5, zip=1, hwsampling=0 delay=0s, tracedepth=30 threaddump=1, threaddumpinterval=10s, latency=1, latencythreshold=20ms, cpusamples=1, cpusampleinterval=1s

Later on you can open again the JRA recording file (File-Open in Mission Control).

Thursday, July 16, 2009

Limitations of Java

quite interesting article - I agree myself, Java often frustrates me