2

I'm just wondering if there's a way to stop JFreeChart thrashing the heap, or an alternative that doesn't do it so much. SpreadsheetDate, Millisecond and Day are taking up about 70 MB of the heap, but the garbage collector is probably getting thrashed too. They are, collectively, the biggest users of heap space in my app. There's also TimeSeriesDataItem which uses 12 MB. This is with recording things every 200 milliseconds or so, for all charts.

I'm also updating / storing a fair few datasets which aren't used immediately, only when the user clicks on the item in the UI to display them.

Also, is it possible in Visual VM to show much garbage collection thrashing is due to a particular class name in the memory sampler table?

Cheers,
Chris

Chris Dennett
  • 22,412
  • 8
  • 58
  • 84
  • 2
    are you tried to run your project with JProfiler, there you can see all `Un-Closed Objects` – mKorbel Aug 01 '11 at 19:40
  • Would `DynamicTimeSeriesCollection`, shown [here](http://stackoverflow.com/questions/5048852/using-jfreechart-to-display-recent-changes-in-a-time-series/5048863#5048863), be an alternative? It profiles nicely at ~ 20 MB. – trashgod Aug 01 '11 at 20:43
  • @mKorbel Will have a go with JProfiler, could be useful! I could have done with an academic license way back when.. – Chris Dennett Aug 02 '11 at 00:33
  • Indeed, not JProfiler though. – Chris Dennett Aug 02 '11 at 10:20

1 Answers1

3

I think I solved this with a simple fix -- I now call timeSeries.removeAgedItems(false) after every addOrUpdate op. Works a treat, my heap usage is down :)

Chris Dennett
  • 22,412
  • 8
  • 58
  • 84