<p>Ensure that the superclass methods <code>XYChart.removeDataItemFromDisplay</code> and <code>XYChart.removeSeriesFromDisplay</code> are always called from the implemented <code>dataItemRemoved</code> and <code>seriesRemoved</code> methods respectively, as specified by the API javadoc.</p>
<p>This prevents a leak of old <code>Candle</code> and <code>VolumeBar</code> 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.</p>
<p>--</p>
<p>By cycling through the <em>Month</em>, <em>Week</em> and <em>Day</em> interval a few dozen times, the following heap usage stats were obtained using JProfiler:</p>
<p><a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/54855381/72887622-fd2cf680-3d03-11ea-9404-9e97f04a74a1.png"><img src="https://user-images.githubusercontent.com/54855381/72887622-fd2cf680-3d03-11ea-9404-9e97f04a74a1.png" alt="Screenshot from 2020-01-22 10-42-19" style="max-width:100%;"></a></p>
<p>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.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/bisq-network/bisq/pull/3914'>https://github.com/bisq-network/bisq/pull/3914</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Prevent memory leak in CandleStickChart & VolumeChart</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3914/files#diff-0">desktop/src/main/java/bisq/desktop/main/market/trades/charts/price/CandleStickChart.java</a>
    (17)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3914/files#diff-1">desktop/src/main/java/bisq/desktop/main/market/trades/charts/volume/VolumeChart.java</a>
    (23)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/3914.patch'>https://github.com/bisq-network/bisq/pull/3914.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/3914.diff'>https://github.com/bisq-network/bisq/pull/3914.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/3914?email_source=notifications&email_token=AJFFTNQV5VF2AML7KGVZH73Q7AQSNA5CNFSM4KKDVO72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IH5EUTA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNXK3EMEVJU4CCOHOXTQ7AQSNANCNFSM4KKDVO7Q">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNTGJ7BMNDDJP77V3HTQ7AQSNA5CNFSM4KKDVO72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IH5EUTA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/3914?email_source=notifications\u0026email_token=AJFFTNQV5VF2AML7KGVZH73Q7AQSNA5CNFSM4KKDVO72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IH5EUTA",
"url": "https://github.com/bisq-network/bisq/pull/3914?email_source=notifications\u0026email_token=AJFFTNQV5VF2AML7KGVZH73Q7AQSNA5CNFSM4KKDVO72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IH5EUTA",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>