Late cleanup of stack objects

Ron Pressler ron.pressler at oracle.com
Tue Nov 8 10:25:55 UTC 2022



> On 7 Nov 2022, at 07:16, Sam Pullara <spullara at gmail.com> wrote:
> 
> 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.
> 

That’s exactly what C2 does, or, more precisely, it’s not about object lifetimes but about local variable lifetime.
Once the method is compiled by C2, the buffer is, indeed, released (unless there’s a debugger or possibly some other JVMTI agent attached).

— Ron



More information about the loom-dev mailing list