Patch review request - Test bug 7123972 test/java/lang/annotation/loaderLeak/Main.java fails intermittently

David Holmes david.holmes at oracle.com
Thu Jun 21 06:32:27 UTC 2012


Hi Eric,

On 21/06/2012 4:05 PM, Eric Wang wrote:
> I come from Java SQE team who are interested in regression test bug fix.
> Here is the first simple fix for bug 7123972
> <http://monaco.us.oracle.com/detail.jsf?cr=7123972>, Can you please help
> to review and comment? Attachment is the patch Thanks!
>
> This bug is caused by wrong assumption that the GC is started
> immediately to recycle un-referenced objects after System.gc() called
> one or two times.
>
> The proposed solution is to make sure the un-referenced object is
> recycled by GC before checking if the reference is null.

Your patch makes its own assumptions - specifically that finalization 
must eventually run. At a minimum you should add 
System.runFinalization() calls after the System.gc() inside the loop. 
Even that is no guarantee in a general sense, though it should work for 
hotspot.

David


> Regards,
> Eric



More information about the core-libs-dev mailing list