Following an OOM (of Java heap) on a small (-Xmx512m) Jenkins instance, I've found in the heap dump ~ 760 000 jenkins.branch.MultiBranchProject$BranchIndexing objects (retaining 370 MB according to Eclipse MAT).

      I was first suspecting that branch-scanning was somehow blocked and that these objects were piling up in the queue, but no, it is actually some past successful executions which are never garbage collected.

      The explanation is simple, and it's not in the branch-api-plugin (although it would be possible to work-around the issue there), but in the cloudbees-folder-plugin.

      See there:

      So, FolderComputations can optionally be chained (a computation can have a reference to the previous computation), via a private transient property.  And BranchIndexing, indeed, sets this property.

      What is this property for? It is only used to enable finding the previous Result, which is used for choosing an the icon color:

      There is no accessor for this "previous" property other than this getPreviousResult() method, plus it's transient, so it is easily possible to avoid the infinitely growing linked list, and simply store the previous Result instead, without changing any public API.

      I will submit a PR.

       

       

          [JENKINS-63312] FolderComputation memory leak

          Thomas de Grenier de Latour created issue -

          Thomas de Grenier de Latour added a comment - PR: https://github.com/jenkinsci/cloudbees-folder-plugin/pull/152

          PR is merged (thanks Francisco!), I'll set status to Resolved.

          Thomas de Grenier de Latour added a comment - PR is merged (thanks Francisco!), I'll set status to Resolved.
          Thomas de Grenier de Latour made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]

          Cheers Fransisco for the release.

          Thomas de Grenier de Latour added a comment - Cheers Fransisco for the release.
          Thomas de Grenier de Latour made changes -
          Released As New: https://github.com/jenkinsci/cloudbees-folder-plugin/releases/tag/cloudbees-folder-6.15
          Status Original: Fixed but Unreleased [ 10203 ] New: Closed [ 6 ]

            fcojfernandez Francisco Fernández
            tom_gl Thomas de Grenier de Latour
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: