On 03/01/2019 23:50, Alan Bateman wrote:
I think it's really hard to say that all weak references would be reclaimed by just 
calling "System.gc()" 10 times.
I don't like the new patch or catching OOME and do not wish to be a Reviewer on 
that version. The approach that we use in dozens of other tests is to call 
System.gc(), sleep, test if the reference has been cleared, and retry if needed.

I guess all such tests are broken since System.gc() may be complete ignored. 
The only reliable way to trigger gc is to use WhiteBox api from the vm tests, 
or trigger the real OOM like in the fix above(but note that the xmx should be 
specified in this case to limit the max memory of the test, to smth like 10m). 
Some of the beans tests use this pattern already: Test4646747.java, 
Test5102804.java, Test7172865.java, Test7195106.java, Test8027905.java, 
Test7064279.java

--
Best regards, Sergey.

Reply via email to