Late cleanup of stack objects

Alex Otenko oleksandr.otenko at gmail.com
Mon Nov 7 13:28:05 UTC 2022


Would making a wrapper around the allocated object make a difference? (And
clear the reference in the wrapper after the right line)

On Mon, 7 Nov 2022, 11:55 Alan Bateman, <Alan.Bateman at oracle.com> wrote:

> On 07/11/2022 07:29, Sam Pullara wrote:
> > I am kind of annoyed this doesn't solve the problem (scoping the
> > allocation):
>
> You may have reduced the scope of bigBuffer in the source code but the
> code generated by the javac compiler will be the same, meaning the
> method will have the same number of locals as before.
>
> For Arnaud's test, the local for bigBuffer will be live when it is
> running in the interpreter so freezing the stack during slowIO will keep
> it reachable.  It should be different once the code is warmed and
> compiled by C2 but it may be that the observations with VisualVM are
> done before it is compiled at run-time.
>
> -Alan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20221107/95e6c28e/attachment.htm>


More information about the loom-dev mailing list