<Beans Dev> Fwd: Re: [PATCH] test/jdk/java/beans/PropertyEditor/Test6397609.java failed in JITed code

Fu Jie fujie at loongson.cn
Sun Jan 6 00:05:25 UTC 2019


Hi Sergey,

How about putting "System.gc()" in a while-loop and running with 
-XX:-DisableExplicitGC?
Is it still possible that "System.gc()" may be completely ignored by the 
JVM?

As far as I know, GC will finally be triggered if "System.gc()" is 
called repeatedly with the JVM flag -XX:-DisableExplicitGC.
And I prefer "System.gc()" because it seems more readable and more elegant.
However, if it really doesn't work, I will not use it any more.

Could you please help me to explain it?
Thank you.

Best regards,
Jie


On 2019年01月05日 06:46, Sergey Bylokhov wrote:
> 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
>




More information about the beans-dev mailing list