https://issues.apache.org/bugzilla/show_bug.cgi?id=57253

            Bug ID: 57253
           Summary: DirectoryScanner holds on to too many strings
           Product: Ant
           Version: 1.8.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: [email protected]
          Reporter: [email protected]

Found in 1.8.4 but I do not see any relevant changes since then. Upstream issue
is

  https://issues.jenkins-ci.org/browse/JENKINS-25759

When traversing a large directory structure looking for matches, the
filesNotIncluded, dirsNotIncluded, and scannedDirs fields of DirectoryScanner
(and probably also notFollowedSymlinks) grow to be quite large.

In the case of filesNotIncluded this is senseless if you never plan on calling
getNotIncludedFiles() etc. Even if you did, this method forces a slow scan to
be performed! Yet the field is built up during a fast scan too. Same for
dirsNotIncluded. Not sure about notFollowedSymlinks.

scannedDirs is trickier, because it actually seems to be used during the fast
scan, though
https://github.com/apache/ant/commit/9e89cec932a798d958cf6bb310936d9a00c09a9d
does not offer any explanation (or test) other than that it “avoids double
scanning”.

The partial workaround is to subclass DirectoryScanner and periodically clear
the filesNotIncluded and dirsNotIncluded fields. notFollowedSymlinks is private
but does not seem to hold anything in typical cases. scannedDirs is private but
(as above) it is unclear whether it is safe to clear it anyway. clearResults()
can clear all these, but also throws out things which are wanted
(filesIncluded, for example), and setting these fields back to their former
values after calling clearResults() seems risky.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to