• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • sloccount-plugin
    • None
    • Version 1.15, introduced in 1.11

      SloccountResult.lazyLoad() caches the data to a member variable. The class is loaded during Jenkins startup (all build.xml files) and never released so Java garbage collector has no chance to trash the lazy loaded details since the reference exists forever. This is kind of a memory leak.

      Consider to make "private SloccountReport report" member transient and to use readResolve() from Java Serialization to transform legacy data instead of calling convertLegacyData() in getStatistics().

      Found during a work on Cppcheck's JENKINS-17363.

          [JENKINS-21921] Lazy loaded report details are never released

          Michal Turek added a comment -

          The issue introduced here.

          Michal Turek added a comment - The issue introduced here.

          Michal Turek added a comment -

          Similar issue in Cppcheck plugin.

          Michal Turek added a comment - Similar issue in Cppcheck plugin.

          Code changed in jenkins
          User: Michal Turek
          Path:
          src/main/java/hudson/plugins/sloccount/SloccountResult.java
          http://jenkins-ci.org/commit/sloccount-plugin/32b1fa89cbe28eeb0831db3d1f9dae39bb102a35
          Log:
          JENKINS-21921 Lazy loaded report details are never released

          • SloccountResult.lazyLoad() caches the data to a member variable. SloccountResult objects (all build.xml files) are loaded during Jenkins startup and never released so Java garbage collector has no chance to trash the lazy loaded details since the reference exists forever. This is kind of a memory leak.
          • Lazy loading reads the data everytime and doesn't use any cache, saving of memory is now prefered to performace. It is not expected the user will show the details very often, so it should be ok.
          • Explicit calls of convertLegacyData() replaced by readResolve() from Java serialization with the same effect.
          • Report object made transient, null is always passed in SloccountPublisher while storing.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Michal Turek Path: src/main/java/hudson/plugins/sloccount/SloccountResult.java http://jenkins-ci.org/commit/sloccount-plugin/32b1fa89cbe28eeb0831db3d1f9dae39bb102a35 Log: JENKINS-21921 Lazy loaded report details are never released SloccountResult.lazyLoad() caches the data to a member variable. SloccountResult objects (all build.xml files) are loaded during Jenkins startup and never released so Java garbage collector has no chance to trash the lazy loaded details since the reference exists forever. This is kind of a memory leak. Lazy loading reads the data everytime and doesn't use any cache, saving of memory is now prefered to performace. It is not expected the user will show the details very often, so it should be ok. Explicit calls of convertLegacyData() replaced by readResolve() from Java serialization with the same effect. Report object made transient, null is always passed in SloccountPublisher while storing.

          Michal Turek added a comment -

          Fixed, will be released in version 1.16.

          Michal Turek added a comment - Fixed, will be released in version 1.16.

            mixalturek Michal Turek
            mixalturek Michal Turek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: