We are having about 45 different kind of graphs in tabbedpanes. We are facing strange out of memory issues. When user starts to see different graphs the amount of used memory starts increase. When ever new graph is opened more memory is used. The software doesn't free that reserved memory and if user has looked enough graphs the memory is full.
We are not reusing those JFreeChart objects, we just have each graph own JFreeChart object, but this shouldn't be any problem or how?
It seems that the system reserves a huge amount of memory (more than 2Mb) when drawing each of those graphs. When user changes to a new graph the old could be thrown "away" and free that memory resource, but this doesn't happen...
Any idea how to avoid this memory problem?
Performance
Re: Performance
Infact I just noticed that the same effect is in JFreeChartDemo program. When I start the software and open windows task manager and start to observe how the memory usage increases when I start to go trough all charts what the software includes, the memory usage will increase and increase and cause out of memory effect...
How to prevent this?
How to prevent this?
Re: Performance
The ChartPanel class (by default) uses a BufferedImage to store the drawn charts...this speeds up window repainting when a covered chart is revealed, but uses up memory. You can switch it off using the second constructor, and charts will just be redrawn as required.
Regards,
DG.
Regards,
DG.
Re: Performance
Thanks David for a tip. I already looked this issue, but now I noticed that it isn't possible to use the second constructor. in version 0.9.2(?) there are no switch for buffering. The second constructor uses also the default constant. The third constructor can be used in this purpose.
I noticed that the "buffering" can cause a lot of memory problems when using many different charts...
I noticed that the "buffering" can cause a lot of memory problems when using many different charts...