Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-7316

ScmInfoRepositoryImpl uses way to much heap for non-first analysis with little file changes

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.4
    • Component/s: Compute Engine
    • Labels:
      None

      Description

      Analysis of the heap dump of an OOM on Nemo in INFRA-1378 highlighted a huge memory footprint of the ScmInfoRepository when analyzing the Open JDK project:

      Having a closer look, it appears most memory usage is made of String (char[]) objects and apparently because of the author of each line. Two lines with the same author are not using the same String object:

      A good way to avoid this waste of memory would be to use String.intern. See this article http://java-performance.info/string-intern-in-java-6-7-8/ for a discussion on the performance impact in term of CPU, in particular. This other article https://plumbr.eu/blog/memory-leaks/reducing-memory-usage-with-string-intern is also interesting with a fair warning when comparing intern string and regular strings (nasty bug).

      Note, that revisions could also be interned.

        Attachments

          Activity

            People

            • Assignee:
              fabrice.bellingard Fabrice Bellingard
              Reporter:
              sebastien.lesaint Sebastien Lesaint
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: