Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-161

FileCleaningTrackerTestCase hangs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4
    • 2.0
    • Utilities
    • None

    Description

      The following code in FileCleaningTrackerTestCase never exits, hanging the whole compilation/testing process:

      private void waitUntilTrackCount() {
      while (theInstance.getTrackCount() != 0) {
      int total = 0;
      while (theInstance.getTrackCount() != 0)

      { byte[] b = new byte[1024 * 1024]; b[0] = (byte) System.currentTimeMillis(); total = total + b[0]; System.gc(); }

      }
      }

      It is clear that in theory this code might loop forever, as the allocation of the byte arrays might never unleash a garbage collection complete enough to deallocate all marker objects, so to bring the track count to zero. Believe me, it's not only theory .

      Attachments

        Activity

          People

            niallp Niall Pemberton
            vigna Sebastiano Vigna
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: