<Swing Dev> [12]RFR: JDK-8198003: javax/swing/JFileChooser/6396844/TwentyThousandTest.java throws error

Krishna Addepalli krishna.addepalli at oracle.com
Wed Oct 31 14:58:55 UTC 2018


Hi All,

 

Please review a fix for JDK-8198003: https://bugs.openjdk.java.net/browse/JDK-8198003

Webrev: http://cr.openjdk.java.net/~kaddepalli/8198003/webrev00

 

This test tries to create a huge(20000) files and show them in JFileChooser, which inturn creates 20000 instances of File class. This internally has a reference to native file handle through COM object (IShellFolder), which is added to java2d.Disposer, to be disposed after use. The test then tries to fill the memory and thereby tries to check if the File records are deleted by GC. It repeats this test about 20 times for each of the installed L&Fs. So the problem essentially boils down to how fast the Disposer thread can clean up the objects, which may not always obey the time limit constraints. 

On Mac, the test always throws OOME - while running for Aqua L&F. Now the difference between the other L&Fs and Aqua is that, it in Aqua L&F, each File instance is wrapped inside SortableFile class, which are then presented in the JFileChooser, to provide quick sorting of the files. So, this makes it a tad bit slower in Mac to release the File objects. 

 

The solution is three fold:

1.       After each run, make sure System.gc() is called to make sure that some memory is available for subsequent run. Also, a Global Exception Handler is registered which does another round of GC calls to make sure that the memory is not run out of.

2.       Reduce the number of times the test runs (down from 20 to 10), since running additional number of times only increases the test case runtime without any additional information.

3.       Create and Delete files parallelly - although this doesn't have a big impact, it does help to provide more time for the actual test to run.

 

Even with these changes, the test fails sometimes on Mac while running Aqua L&F, so this L&F can be skipped. 

 

Thanks,

Krishna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20181031/6bd81a71/attachment.html>


More information about the swing-dev mailing list