Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8130331

(fs) Files.list().forEach() leaks native memory on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • tbd
    • 8u60, 9, 11, 17, 20, 21
    • core-libs
    • None

      Files.list().forEach() is observed to leak native memory (heap) on Windows when iterating large file hierarchy.

      When native heap is inspected, it is full of file names which are being iterated.

      How to reproduce:
        $ java -jar test-leak.jar -prepare <folder>
        $ java -jar test-leak.jar L <folder>

      -prepare creates a deep hierarchy of files.

      The test contains alternative for-loop based file iterator, which doesn't leak:
        $ java -jar test-leak.jar H <folder>

      The problem was reported by Dmitry Sviridov.

            bpb Brian Burkhalter
            vlivanov Vladimir Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: