Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6668

Model location handling uses too much memory

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.2
    • Component/s: core
    • Labels:
      None

      Description

      Every model element in Maven has one or several Location objects associated with it. These locations specify where in the POM each attribute of that object was configured. This is a very useful feature for better error messages and IDE assistance, but its current implementation takes too much memory.

      Locations are currently tracked with a LinkedHashMap, with String keys and Location values. LinkedHashMap has a large overhead per entry. In a particularly large build that I was investigating, just this overhead summed up to almost 3GB of memory. However, there is actually no need for arbitrary Strings or a Map. The keys are always the name of the corresponding field in the model class. So instead we could create one Location field for every actual data field in the model and then switch over the String key to assign the Location to the correct field. This would get rid of the LinkedHashMap overhead altogether. It would add a small overhead for modello users who don't care about location handling, but I assume that Maven is the only major consumer of it.

       

      See https://github.com/codehaus-plexus/modello/pull/31 and https://github.com/apache/maven/pull/252

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michael-o Michael Osipov
                Reporter:
                oehme Stefan Oehme
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: