Chris Dennett
Chris Dennett

Reputation: 22721

JFreeChart heap space

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

Upvotes: 2

Views: 1295

Answers (1)

Chris Dennett
Chris Dennett

Reputation: 22721

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 :)

Upvotes: 3

Related Questions