; 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?
>>>
>>>
>>>
>
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
= 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
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
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
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
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
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
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
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?
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.
) {
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
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
13 matches
Mail list logo