Chart object is not released!

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Werner Baumann

Chart object is not released!

Post by Werner Baumann » Tue Oct 29, 2002 10:04 pm

Hi,
i'm using a very simple JFreeChart object. But after execution the following code the app will not return to system. What's wrong?


public static void main(String[] args) throws Exception
{
double[][] data = new double[][] {
{ 1.0, 4.0, 3.0, 5.0, 5.0, 7.0, 7.0, 8.0 },
{ 5.0, 7.0, 6.0, 8.0, 4.0, 4.0, 2.0, 1.0 },
{ 4.0, 3.0, 2.0, 3.0, 6.0, 3.0, 4.0, 3.0 }
};

DefaultCategoryDataset dataset = new DefaultCategoryDataset(data);
JFreeChart chart = ChartFactory.createLineChart("Line Chart Demo 1",
"Category",
"Value",
dataset,
true);
ChartUtilities.saveChartAsPNG(new File("test.png"), chart, 400, 300);
System.out.println("done");
}

Dave Gilbert

Re: Chart object is not released!

Post by Dave Gilbert » Wed Oct 30, 2002 9:50 am

My guess is that this is related to the following Java bug (or one of its many related bugs):

http://developer.java.sun.com/developer ... 30718.html

But I'm guessing, because I can't see the exact cause yet.

Regards,

DG

Werner Baumann

Re: Chart object is not released!

Post by Werner Baumann » Thu Oct 31, 2002 10:07 am

The descibed bug is already fixed and i'm using JVM 1.3.1_05.

Regards,
Werner

Dave Gilbert

Re: Chart object is not released!

Post by Dave Gilbert » Thu Oct 31, 2002 10:21 am

Hi Werner,

I've tried out two of the test programs on the three JVMs I have handy (all on Linux). Both fail on 1.3.0_02 and 1.3.1_04 but work on 1.4.0_01. Can you try them out on your JVM?

The bug report mentions the SystemColor class as one cause of the problem. This is used in the JFreeChartConstants class, so this might be the link.

Regards,

DG.

*** Test1.java **********************************

import java.awt.*;

public class Test {
public static void main(String[] args) {
Toolkit.getDefaultToolkit();
System.out.println("Done");
}
}

*** Test2.java **********************************

public class Test2 {

static public void main(String args[]) {
java.awt.Color color = java.awt.SystemColor.window;
System.out.println("Done");
}
}

Werner Baumann

Re: Chart object is not released!

Post by Werner Baumann » Thu Oct 31, 2002 11:39 am

Hi Dave,

i've tried 1.3.1_05 and the brand new 1.3.1_06 on Win2000. Unfortunately Test and Test2 fails. Now i've tried 1.4.1 and all works fine. Maybe this is the time to switch to 1.4.1.

Thanks for your help.

Regards,
Werner

Locked