I'm getting a memory leak with a class that has operated for about a year, but starting with Java 1.5 - and it seems since upgrading to 1.6, the problem became severe: all my Jfreechart applications are leaking. Re-compiling with Java 1.5 makes no difference, however. It could be that I have added 6 new Java application programs recently.
Googling for several hours frequently mentions ChartUtilities.saveChartAsPNG as being the culprit - but no solutions have been posted.
Has anyone resolved this issue or found a work-around?
I am running on a Mac Xserve (OS v10.6), jfreechart-1.0.13, Java 1.6. The applications are launched every 15 minutes from a cron job. the JFreeChart class is instantiated in my code after I instantiate the CombinedDomainXYPlot class.
As I mentioned, these classes used to run just fine, and running them interactively shows no problems: the problem appears intermittently, making it hard to track down.
Thanks for any help.
Memory Leak, ChartUtilities.saveChartAsPNG
Re: Memory Leak, ChartUtilities.saveChartAsPNG
Just an update,
I removed the saveChartAsPNG portion of the code (using jpg instead)... get the same error message... sometimes. I still believe it is associated with JFreeChart somehow (but is it because there is a OS X java lib glitch it is running into?). Any suggestion on how to isolate the problem somehow would be appreciated.
-Dave
I removed the saveChartAsPNG portion of the code (using jpg instead)... get the same error message... sometimes. I still believe it is associated with JFreeChart somehow (but is it because there is a OS X java lib glitch it is running into?). Any suggestion on how to isolate the problem somehow would be appreciated.
-Dave
Re: Memory Leak, ChartUtilities.saveChartAsPNG
I believe I have finally figured it out:
I added the following option in the cron job runtime command: -Djava.awt.headless=true
I had it in the class constructor, but it didn't seem to have any effect.
I added the following option in the cron job runtime command: -Djava.awt.headless=true
I had it in the class constructor, but it didn't seem to have any effect.
Re: Memory Leak, ChartUtilities.saveChartAsPNG
While my last change to adding -Djava.awt.headless=true to the JRE seemed to work, gradually the memory leaks been reappearing: It happens a lot less, but it is still occurring.
I'm really at a loss at this point.
I'm really at a loss at this point.