XYPlot not releasing resources when setting dataset to null

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Thu Apr 10, 2008 1:46 pm

Part of the confusion arises from the fact that the OPs method called removeDataset(...) doesn't actually remove the dataset from the collection, it sets it to null.

Part of the reason why the internal collections are private is that there are many different collections (dataset, renderer, axis mapping etc) and they are related by index. If you actually try to remove a dataset from the plot, you will need to modify all the other collections that are related.

tomkieffer
Posts: 24
Joined: Wed May 16, 2007 8:20 am

Post by tomkieffer » Thu Apr 10, 2008 2:55 pm

I tried to point out that the dataset is only set to null, because by subclassing alone I have no access to the collections and have no possibility of actually removing items. That's why I would have liked the fields in XYPlot to be protected instead of private in the first place.

Locked