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

Out of Memory occurrs because FileDialogs are not GCed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • client-libs
    • x86
    • windows_2000

      Filedialogs do not seem to be GCed.
      So, when we invoke and close FileDialogs many times, too much memory
      is consumed and the VM freezes.

      1. Reproducing

       1) Compile the new sample program(Fd2.java)
       2) Invoke "java Fd2"
          -> you will see a frame which has "Show Child Dialog" and "Cancel"
             buttons.
       3) Click the "Show Child Button"
          -> you will see a frame which has "File Dialogue" and "Cancel"
             buttons.
       4) Click the "File Dialogue"
          -> you will see a file dialogue for file selection.
       5) Click the "Cancel" button in the file dialogue which appeared
          at the 4) opearation.
       6) Click the "Cancel" button on the frame which appeared at 3).
          -> you will be aware that you returns 2).
       7) Repeat from 2) to 6) for many times.
       8) Finally, you will see the following messages in the command prompt
          window and opration freezed.

      total=66650112byte,free=3621592byte
      total=66650112byte,free=2014104byte
      total=66650112byte,free=1974888byte
      total=66650112byte,free=367736byte
      total=66650112byte,free=328968byte
      java.lang.OutOfMemoryError
      total=66650112byte,free=291808byte
      java.lang.OutOfMemoryError


      2. Configration

        MPU: Pentium IV 1.4[GHz]
        Mem: 384[MB]
        OS : Windows2000 SP2 (Japanese)
        JDK: 1.4.0fcs, 1.4.1-beta-b11

      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      D:\>java -version
      java version "1.4.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b11)
      Java HotSpot(TM) Client VM (build 1.4.1-beta-b11, mixed mode)


      3. Note
        - I attached an image file(leak.jpg) which shows how the memory becomes
          short as a sample.
          This is the result with OptimizeIt4.11.
        - How many time should we repeat the 2)-6) loop in the above process ?
          It depends on each platform.
          With my PC, I repeated 50 times or so.
        - The Memory usage becomes 64[MB]( by watching the graph of optimizeit),
          this issue happpens.

      2002-05-10
      ==============================================================================

            mmartaksunw Michael Martak (Inactive)
            tbaba Tadayuki Baba (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: