On Mon, 18 Nov 2024 20:21:29 GMT, Andy Goryachev <ango...@openjdk.org> wrote:
>> I tried, but it isn't that easy - since the memory is not leaked because we >> keep some references we should not keep - rather we are adding listener >> again and again and again. So we can not assert things to be collectable, as >> they should not be, still they increase the memory footprint instead. >> >> So I did not manage to make a test with `JMemoryBuddy`, but can prove the >> point with the amount of listener instead. >> >> I wrote a test that checked, that the memory is similar high as before, that >> worked as well but I was afraid that is might be flaky, which I want to >> avoid. > > I think this is an acceptable explanation as it tests the root cause of the > leak. > > Do you think changing the skin would allow us to create a test for the memory > leak specifically. Maybe some variation of `SkinMemoryLeakTest` ? Found a way to test it with `JMemoryBuddy`. Kept the listener tests as well, since they also prove the point. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1640#discussion_r1854312461