Reduce memory usage of the PostAnalysisIssueVisitor #258
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The collection of
DefaultIssue
objects hold by thePostAnalysisIssueVisitor
can take a significant amount of memory in the CE process heap, when there are numerous issues (aDefaultIssue
alone can weigh several 10th of kilobytes).A small example in Eclipse MAT (and I've seen much worse):
This PR mostly fixes that. The logic is unchanged: there is still a list of issues to be processed at the end. But it contains lighter objects, with only the few members which would actually be used later to decorate pullrequests. On our production instances (1.3.2 plugin / SQ 7.9 LTS), a similar patch made a major difference on the CE processes memory footprint.
I've tried to write this patch to minimize impact/changes on the code. The
PostAnalysisIssueVisitor.LightIssue
class exposes a subset of theDefaultIssue
public interface, thus the changes are mostly limited to the actual return type ofPostAnalysisIssueVisitor.ComponentIssue#getIssue()
.