<AWT Dev> [JDK-8175015] FileSystemView.isDrive(File) memory leak on "C:\" file reference
krishna.addepalli at oracle.com
Tue Aug 8 12:12:26 UTC 2017
Please review the fix for bug:
Bug: JDK- 8175015 https://bugs.openjdk.java.net/browse/JDK-8175015
JDK 10 Webrev : http://cr.openjdk.java.net/~pkbalakr/Krishna/8175015/webrev00/
The bug reports about memory leak by repeatedly querying FileSystemView, if "C:\" is a root drive.
The problem is internally, Win32ShellFolderManager2.java, the function "isFileSystemRoot" is called, which lists the contents of all the root drives, in addition to including them. It also includes the hidden files. For each file present, it is wrapped with a "Win32ShellFolder2" object. So, for each query, it will list the files in the drives, and throws them away, which is leading to both memory consumption as well as slow performance.
The fix is to use "Win32ShellFolder2.listRoots()", which is both fast and consumes less memory, since the number of drives on most systems will not exceed 5/10, whereas there can be a large number of files in the root directory.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the awt-dev