Uploaded image for project: 'Ivy'
  1. Ivy
  2. IVY-1332

OutOfMemoryError: PermGen caused by IvyContext leaked when building subprojects

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Core

    Description

      The build.xml files of my subprojects include Ant's <taskdef/> element to define Ivy tasks. This element causes creation of a new classloader to load the Ivy jars.

      The code from IvyContext.java:

      public class IvyContext {

      private static ThreadLocal/<Stack<IvyContext>>/ current = new ThreadLocal();
      ...
      }

      This static initialization runs once with every classloader and creates a new ThreadLocal object every time. All those ThreadLocal objects are visible (referenced) from the main Thread. For 12 subprojects I end up with 12 ThreadLocal objects each containing one Stack holding IvyContext objects. The IvyContext objects point to its class which points to its ClassLoader. The 12 ClassLoaders stay retained.

      Attachments

        1. ivy_eclipse_memory_analyzer.png
          12 kB
          Ales Nosek
        2. build-caller.xml
          0.9 kB
          Ales Nosek
        3. build.xml
          0.4 kB
          Ales Nosek

        Activity

          People

            Unassigned Unassigned
            noseka1 Ales Nosek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: