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

Enhancements needed for class loader caching

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • deploy
    • beta2
    • x86
    • windows_nt



      Name: mt13159 Date: 05/30/2001


      The Java Plug-in 1.3.1 has a mechanism to cache class loaders in memory. This is done in the class sun.plugin.ClassLoaderInfo. By default, up to 10 unreferenced class loaders are kept in memory in case they are needed again in the future. This is good because it improves performance - if a new applet is loaded which is in the same CODEBASE as a previously loaded applet, the class loader can be pulled from the cache. This avoids reloading all of that class loader's JAR files and classes. However, there is a serious problem with this. Our products have a very large number of classes. In some cases 30MB of classes may be loaded into memory by a single applet. With a default heap size of 64MB, this means that only two class loaders can be loaded into memory at any time. Caching class loaders in memory quickly results in OutOfMemory errors for these products.
      For example, say the user loads page A.html which contains applet A. This loads 30MB of classes. Then they navigate to B.html which contains applet B, which is in a different codebase and also loads 30MB of classes. Applet A is no longer used, so its class loader is put into the cache. Now A and B's class loaders are both in memory, taking up a total of 60MB. Applet B will quickly get an OutOfMemory error because the Java heap is full.
      What we are requesting is that the class loader cache be made memory sensitive. That is, soft references should be used to store class loaders in the cache. This will enable the VM to free up old class loaders in a low memory situation. Specifically, our requirement is that an OutOfMemory error only be thrown after all unreferenced class loaders have been cleared from the cache. Also, we would like the default number of cached loaders to be lowered from 10 to something smaller, like 3. Even 10 smaller applets will take a large amount of heap space.
      (Review ID: 125450)
      ======================================================================

            stanleyh Stanley Ho (Inactive)
            mthakore Mayank Thakore (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: