<div dir="ltr">I would be surprised if that memory is ever released, JITed or not unless hotspot starts to try and determine object lifetimes per line. I'd be curious and will run it myself what happens if you just put a block around the allocation and println.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Nov 5, 2022 at 10:28 AM Arnaud Masson <<a href="mailto:arnaud.masson@fr.ibm.com">arnaud.masson@fr.ibm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg8991964810931916467">





<div lang="FR" style="overflow-wrap: break-word;">
<div class="m_-4263464085817920986WordSection1">
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:34.8pt"><span lang="EN-US">In the sync case, the big buffer is retained in heap during the slow IO (until it eventually returns), even if it’s not needed anymore.</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:34.8pt"><span><u></u> <u></u></span></p>
</blockquote>
<p class="MsoNormal" style="margin-left:34.8pt"><span>Are you sure you see an issue there once this code is warmed up? If so, are you running this in the IDE with the debugger (asking because the debugger need to access locals
 will prevent the compiler from pruning locals).<br>
<br>
<br>
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I just execute the main() entry once _<i>without</i>_ debugger (from IDE).<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I then check memory usage in VisualVM, and I force GC a few times to be sure memory is really retained.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">The async app releases the big buffer but not the sync app. (The sync app releases memory if I uncomment the null assignment.)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">By warmed-up, you mean it has been JIT-ed? It’s a bit outside the control of a normal app, is it really supposed to have such an impact on object strong ref lifetime?
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">thanks<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Arnaud<u></u><u></u></span></p>
</div>

<div>
Unless otherwise stated above:<br>
<br>
Compagnie IBM France<br>
Siège Social : 17, avenue de l'Europe, 92275 Bois-Colombes Cedex<br>
RCS Nanterre 552 118 465<br>
Forme Sociale : S.A.S.<br>
Capital Social : 664 069 390,60 €<br>
SIRET : 552 118 465 03644 - Code NAF 6203Z<br>
</div></div>

</div></blockquote></div>