Hi
I used jfreechart 1.0.13 for a real time charting in a web application
I used a timeSerie chart
I have 10 chart that i update every 20 second
My problem is that after a time, i get an OutOfMemoryException
Is there any way to avoid this problem or some best practice to use to consume less memory ( for exemple i could use for my TimeSerie Millisecond,Second or Minute , what is the object betwwen them that use less ressources)
Performance in Jfreechart
-
- Posts: 12
- Joined: Tue Aug 25, 2009 9:12 am
- antibot: No, of course not.
Re: Performance in Jfreechart
Hello,
I think your problem is not coming from the chart at all.
If you get an out of memory after a while this is probably because your charts are kept in memory.
The lowest memory consumption would be to recreate the chart each time it is requested but this could eventually be heavy for the processor.
I don't know if you store your entire charts or only a part of it (like only the plots or datasets) but you should think about what is kept in memory and what is not necessary.
One last thing to think about is "does your server have enough memory ?"
I think your problem is not coming from the chart at all.
If you get an out of memory after a while this is probably because your charts are kept in memory.
The lowest memory consumption would be to recreate the chart each time it is requested but this could eventually be heavy for the processor.
I don't know if you store your entire charts or only a part of it (like only the plots or datasets) but you should think about what is kept in memory and what is not necessary.
One last thing to think about is "does your server have enough memory ?"
-
- Posts: 12
- Joined: Tue Aug 25, 2009 9:12 am
- antibot: No, of course not.
Re: Performance in Jfreechart
Thanks Ghurdyl for your replyGhurdyl wrote:Hello,
I think your problem is not coming from the chart at all.
If you get an out of memory after a while this is probably because your charts are kept in memory.
The lowest memory consumption would be to recreate the chart each time it is requested but this could eventually be heavy for the processor.
I don't know if you store your entire charts or only a part of it (like only the plots or datasets) but you should think about what is kept in memory and what is not necessary.
One last thing to think about is "does your server have enough memory ?"
I'm using a cach manager to store my datasets
my charts are recretaed each x second:
Code: Select all
JFreeChart chart = ChartFactory.createTimeSeriesChart(...);
FileOutputStream file1 = new FileOutputStream("...");
ChartUtilities.writeChartAsPNG(file1, chart, 400, 300,null);
the problem is that the consommation of memory is increasing with time: it won't have a limitOne last thing to think about is "does your server have enough memory ?"
Re: Performance in Jfreechart
If you already use a cache system, think about cache eviction so that data in cache will be persisted on a storage support and free the server memory.
In another context (nothing to make with charts) I am using JBoss Cache 3.2.1 and it's eviction module to cache images.
But if your server runs out memory quickly, you might load your storage support fast too so be sure to save only the needed data and to remove data that are no longer necessary.
In another context (nothing to make with charts) I am using JBoss Cache 3.2.1 and it's eviction module to cache images.
But if your server runs out memory quickly, you might load your storage support fast too so be sure to save only the needed data and to remove data that are no longer necessary.