Re: Possible leak on setOnAction

2024-04-21 Thread Thiago Milczarek Sayão
; I was investigating, >>> >>> It probably should be menuItem.setOnAction(new WeakEventHandler<>(e -> >>> stage.toFront())); >>> >>> But I bet it's a common mistake. Maybe the setOnAction should mention it? >>> >>> >>> >

Re: Possible leak on setOnAction

2024-04-20 Thread Thiago Milczarek Sayão
since it is >>> in turn is strongly referenced from the menu item it creates a leak. >>> >>> >>> >>> The lambda is essentially this: >>> >>> >>> >>> menuItem.setOnAction(new H(stage)); >>> >>> class $1 imple

Re: Possible leak on setOnAction

2024-04-20 Thread John Hendrikx
= s; // holds the reference and causes the leak   }   public void handle(ActionEvent ev) {     stage.toFront();   } } -andy *From: *openjfx-dev on behalf of Thiago Milczarek Sayão *Date: *Thursday, April 18, 2024 at 03:42

Re: [External] : Re: Possible leak on setOnAction

2024-04-19 Thread Andy Goryachev
paths to the root objects, often giving the answer on who is holding the reference. -andy From: Thiago Milczarek Sayão Date: Friday, April 19, 2024 at 07:58 To: Andy Goryachev Cc: John Hendrikx , openjfx-dev@openjdk.org Subject: [External] : Re: Possible leak on setOnAction Calling item.setO

Re: Possible leak on setOnAction

2024-04-19 Thread Thiago Milczarek Sayão
erence > from the menu item's eventHandler, shouldn't it? > > > > -andy > > > > *From: *openjfx-dev on behalf of Thiago > Milczarek Sayão > *Date: *Friday, April 19, 2024 at 05:47 > *To: *John Hendrikx > *Cc: *openjfx-dev@openjdk.org > *Subjec

Re: Possible leak on setOnAction

2024-04-19 Thread Andy Goryachev
4 at 05:47 To: John Hendrikx Cc: openjfx-dev@openjdk.org Subject: Re: Possible leak on setOnAction When the window list changes, I'm calling item.setOnAction(null) on the "old list" before inserting a new one. In general it's not a problem because the menu item or button is in

Re: Possible leak on setOnAction

2024-04-19 Thread Thiago Milczarek Sayão
ments EventHandler { >> >> private final Stage stage; >> >> public $1(Stage s) { >> >> this.stage = s; // holds the reference and causes the leak >> >> } >> >> public void handle(ActionEvent ev) { >> >> stage.t

Re: Possible leak on setOnAction

2024-04-18 Thread John Hendrikx
enjfx-dev on behalf of Thiago Milczarek Sayão *Date: *Thursday, April 18, 2024 at 03:42 *To: *openjfx-dev *Subject: *Possible leak on setOnAction Hi, I'm pretty sure setOnAction is holding references. I have a "Open Windows" menu on my applicatio

Re: Possible leak on setOnAction

2024-04-18 Thread Nir Lisker
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 abo

Re: [External] : Re: Possible leak on setOnAction

2024-04-18 Thread Andy Goryachev
08:51 To: Andy Goryachev Cc: openjfx-dev Subject: [External] : Re: Possible leak on setOnAction I was investigating, It probably should be menuItem.setOnAction(new WeakEventHandler<>(e -> stage.toFront())); But I bet it's a common mistake. Maybe the setOnAction should mention it?

Re: Possible leak on setOnAction

2024-04-18 Thread Thiago Milczarek Sayão
andy > > > > *From: *openjfx-dev on behalf of Thiago > Milczarek Sayão > *Date: *Thursday, April 18, 2024 at 03:42 > *To: *openjfx-dev > *Subject: *Possible leak on setOnAction > > Hi, > > > > I'm pretty sure setOnAction is holding references.

Re: Possible leak on setOnAction

2024-04-18 Thread Andy Goryachev
) { this.stage = s; // holds the reference and causes the leak } public void handle(ActionEvent ev) { stage.toFront(); } } -andy From: openjfx-dev on behalf of Thiago Milczarek Sayão Date: Thursday, April 18, 2024 at 03:42 To: openjfx-dev Subject: Possible leak on setOnAction Hi

Possible leak on setOnAction

2024-04-18 Thread Thiago Milczarek Sayão
Hi, I'm pretty sure setOnAction is holding references. I have a "Open Windows" menu on my application where it lists the Stages opened and if you click, it calls stage.toFront(): menuItem.seOnAction(e -> stage.toFront()) I had many crash reports, all OOM. I got the hprof files and analyzed them