Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Prevent memory leak in CandleStickChart & VolumeChart #3914
Ensure that the superclass methods
This prevents a leak of old
By cycling through the Month, Week and Day interval a few dozen times, the following heap usage stats were obtained using JProfiler:
I believe updates to the two charts happen periodically as long as the trades charts view is selected, as it appeared to leak while unattended as well. I haven't had a chance to measure the rate, though.
Ensure that the superclass methods XYChart.removeDataItemFromDisplay & XYChart.removeSeriesFromDisplay are always called from the implemented dataItemRemoved & seriesRemoved methods respectively, as specified by the API javadoc. This prevents a leak of old Candle & VolumeBar objects every time the trades charts view is updated. The former is quite substantial, as each Candle object has a retained size of about 70kB and there are up to 90 candlesticks / volume bars leaked per chart update.
ripcurlx left a comment
Tested PR against Mainnet switching between time frames and currencies and everything seems to be still working as before from a user perspective. Code changes looking fine to me as well, but I didn't verified the change using jProfiler. If anyone wants to review/verify this part as well feel free to do so.