<div dir="ltr">I didn't find such memory leaks in my application, though I don't do stage handling. What I would look at is where the `stage` reference in the lambda is coming from. You say you have a list of open stages. When you close a stage, do you remove the references to that stage from all places? What about the object that is holding the reference `stage` in the lambda?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 18, 2024 at 1:58 PM Thiago Milczarek Sayão <<a href="mailto:thiago.sayao@gmail.com">thiago.sayao@gmail.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 dir="ltr">Hi,<br><div><br></div><div>I'm pretty sure setOnAction is holding references. </div><div><br></div><div>I have a "Open Windows" menu on my application where it lists the Stages opened and if you click, it calls stage.toFront():</div><div><br></div><div>menuItem.seOnAction(e -> stage.toFront())</div><div><br></div><div>I had many crash reports, all OOM. I got the hprof files and analyzed them - turns out this was holding references to all closed stages.</div><div><br></div><div>To fix it, I call setOnAction(null) when the stage is closed.</div><div><br></div><div>I will investigate further and provide an example.</div><div><br></div><div>-- Thiago.</div></div>
</blockquote></div>