Skip to content

Commit

Permalink
[JENKINS-8365] avoid unbounded memory consumption with a massive change.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Jul 12, 2011
1 parent 46a2670 commit 6cfb790
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/hudson/plugins/git/GitChangeLogParser.java
Expand Up @@ -49,8 +49,8 @@ public GitChangeSetList parse(AbstractBuild build, File changelogFile)
lines = new ArrayList<String>();
}

if (lines != null)
lines.add(line);
if (lines != null && lines.size()<THRESHOLD)
lines.add(line); // TODO: if we ignored some lines, tell the user so.
}

if (lines != null) {
Expand All @@ -67,5 +67,9 @@ public GitChangeSetList parse(AbstractBuild build, File changelogFile)
private GitChangeSet parseCommit(List<String> lines, boolean authorOrCommitter) {
return new GitChangeSet(lines, authorOrCommitter);
}


/**
* To control the memory overhead of a large change, we ignore beyond certain number of lines.
*/
private static int THRESHOLD = 1000;
}

0 comments on commit 6cfb790

Please sign in to comment.