[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: RFR: 8319779: SystemMenu: memory leak due to listener never being removed [v4]
From:       John Hendrikx <jhendrikx () openjdk ! org>
Date:       2023-12-26 15:32:47
Message-ID: jHuJ7EPH6By0Nb0DUstkIqbRaEl-BSDCBHH4thASWCc=.071c24f6-a1bc-443f-ab17-124565742326 () github ! com
[Download RAW message or body]

On Tue, 26 Dec 2023 10:24:42 GMT, Johan Vos <jvos@openjdk.org> wrote:

> I'm still looking into adding a test. The challenge is that the (previously) \
> uncollected items are of type `com.sun.glass.ui.MenuItem`, and afaik we can't use \
> JMemoryBuddy to check the collectable state of instances on the heap that we don't \
> have a reference to ourselves. I see 2 options: 
> * a unit test, with new shim classes so that we get access to \
> `com.sun.glass.ui.MenuItem` from the test. The problem here is that this quickly \
>                 becomes a test for the shim class and not for the real classes
> * a systemtest that can somehow inspect the heap and count the instances of \
> `com.sun.glass.ui.MenuItem`

Perhaps add a package private method to get access to `GlassSystemMenu#systemMenus` \
(or use reflection)?  I think you could then put a weak reference on the returned \
list (or items) and see if that disappears.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1283#issuecomment-1869617031


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic