On Fri, 20 Dec 2019 09:53:56 GMT, Florian Kirmaier <fkirma...@openjdk.org> 
wrote:

>> @dsgrieve 
>> It's worth mentioning that JavaFX already has many tests based on 
>> System.gc().
>> An advantage of having a testsuit as an library (or copyied from an library) 
>> is, that its stability is regulary verified by the travis builds for 
>> different JVMs.
>> The alternative would be to not test for memory-leaks at all which is much 
>> worse than having slightly unstable tests.
>> Maybe it can make sense to seperate these tests for leaks in an own 
>> testgroup.
>> 
>> I'm introducing this library in more and more projects. I never had problems 
>> with unstable tests. 
>> I only had this kind of problem when I wrote the 
>> WeakReference/System.gc/sleep-logic for every single test.
> 
> I highly doubt that a code analysis tool will find such memoryleaks.

I agree. Static analysis tools are quite limited in this regard, and are in now 
way a substitute for regression testing.

So the question is how best to test fixes for memory leaks at runtime. Our 
current approach can be best characterized as "ad hoc", and is not all that 
robust (although works well enough in most cases and is still much better than 
doing no testing at all). I would welcome discussion of a more robust approach 
for testing, but it should be decoupled from this bug fix, and discussed as a 
separate JBS Enhancement request.

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

PR: https://git.openjdk.java.net/jfx/pull/71

Reply via email to