Skip to content

Commit

Permalink
Fix memory leak.
Browse files Browse the repository at this point in the history
While repository object is active and code requests commits they are stored in Map.
GHCommit.files contains huge String[]/char[]  amount of data.
The same could be applied to Milestones.
  • Loading branch information
KostyaSha committed Oct 20, 2018
1 parent 425ae2d commit afd2183
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public class GHRepository {
private boolean _private;
private int watchers,forks,open_issues,size,network_count,subscribers_count;
private String created_at, pushed_at;
private Map<Integer,GHMilestone> milestones = new HashMap<Integer, GHMilestone>();
private Map<Integer,GHMilestone> milestones = new WeakHashMap<Integer, GHMilestone>();

private String default_branch,language;
private Map<String,GHCommit> commits = new HashMap<String, GHCommit>();
private Map<String,GHCommit> commits = new WeakHashMap<String, GHCommit>();

private GHRepoPermission permissions;

Expand Down

0 comments on commit afd2183

Please sign in to comment.