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

GC : JVM exits on OutOfMemoryError after class unloading

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.4.1
    • hotspot
    • None
    • gc
    • sparc
    • solaris_8


      If we load a lot of classes (thousands) the permanent generation area of the Java VM gets filled and the Garbage Collector starts to unload the classes. After unloading an amount of classes we get an out-of-memory error and the Java VM exits with the return code 1. We have no chance to react.
      The class unloading should prevent lack of memory.
      By the way increasing memory and using a greater -XX:MaxPermSize value only postpones the problem.

      The testcase provided in attachment shows this behaviour and gives the following output :

      % /usr/j2se/bin/java -server -Xms128M -Xmx128M -verbosegc loadall
      Iteration 0
      JBF CLASS LOADER PRELOAD loaded: 762 failed: 0 elapsed (ms): 6028
      Iteration 1
      JBF CLASS LOADER PRELOAD loaded: 762 failed: 0 elapsed (ms): 3534
      Iteration 2
      [Full GC 26258K->236K(129792K), 0.5484575 secs]
      JBF CLASS LOADER PRELOAD loaded: 762 failed: 0 elapsed (ms): 3410
      [...]
      Iteration 28
      JBF CLASS LOADER PRELOAD loaded: 762 failed: 0 elapsed (ms): 2834
      Iteration 29
      [Full GC 19087K->1196K(129792K), 1.2942034 secs]
      [Full GC 1196K->1163K(129792K), 1.3505120 secs]
      It.: 29 FAILED: org.apache.oro.text.regex.Perl5Pattern : null : java.lang.OutOfMemoryError
      [Full GC 1403K->1165K(129792K), 1.2682526 secs]
      [Full GC 1181K->1165K(129792K), 1.2405491 secs]
      [Full GC[Unloading class org.apache.tools.ant.taskdefs.LogStreamHandler]
      [Unloading class org.apache.html.dom.HTMLDListElementImpl]
      [Unloading class org.apache.tools.ant.taskdefs.optional.Script]
      [Unloading class junit.framework.TestCase]
      [...]
      [Unloading class org.apache.tools.ant.taskdefs.optional.depend.constantpool.FieldRefCPInfo]
      [Unloading class org.apache.html.dom.HTMLLinkElementImpl]
      [Unloading class org.apache.oro.text.regex.PatternMatcherInput]
       1165K->1165K(129792K), 0.9285661 secs]
      java.lang.OutOfMemoryError

      % /usr/j2se/bin/java -version
      java version "1.4.1_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_06-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_06-b01, mixed mode)

            pbk Peter Kessler
            apoddany Arnaud Poddany (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: