diff options
author | Stefan Lay | 2012-05-09 15:04:43 +0000 |
---|---|---|
committer | Matthias Sohn | 2012-05-11 22:24:06 +0000 |
commit | 62f7bfff93f5a53e2281af52eaa479c4998e1db6 (patch) | |
tree | 363d8c25226b723647d809397a66e8131bf72165 /org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java | |
parent | 2513d3008c301a6011f1d631b60035aa43ae9c72 (diff) | |
download | egit-62f7bfff93f5a53e2281af52eaa479c4998e1db6.tar.gz egit-62f7bfff93f5a53e2281af52eaa479c4998e1db6.tar.xz egit-62f7bfff93f5a53e2281af52eaa479c4998e1db6.zip |
Fix memory leak in GitHistoryPage
When a GenerateHistoryJob was cancelled because a new input was set the
SWTCommitList was not deregistered as DisposeListener. The List held
references to all SWTCommits which could consume several hundreds of MB
for large repos.
Change-Id: I95b3f79ce883bb65cc168d7288040826d6fde514
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java')
-rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java index 0be7d35bb0..1d0197521d 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java @@ -947,7 +947,7 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener, for (IWorkbenchAction action : actions.actionsToDispose) action.dispose(); actions.actionsToDispose.clear(); - cancelRefreshJob(); + releaseGenerateHistoryJob(); if (popupMgr != null) { for (final IContributionItem i : popupMgr.getItems()) if (i instanceof IWorkbenchAction) @@ -1079,7 +1079,6 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener, if (this.input != null) return true; - cancelRefreshJob(); Object o = super.getInput(); if (o == null) { setErrorMessage(UIText.GitHistoryPage_NoInputMessage); @@ -1413,7 +1412,7 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener, if (trace) GitTraceLocation.getTrace().traceEntry( GitTraceLocation.HISTORYVIEW.getLocation(), - new Object[] { list, asArray }); + new Object[] { list.size()}); if (job != j || graph.getControl().isDisposed()) return; @@ -1459,8 +1458,6 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener, GitTraceLocation.getTrace().traceEntry( GitTraceLocation.HISTORYVIEW.getLocation()); - cancelRefreshJob(); - if (input == null) return; Repository db = input.getRepository(); @@ -1480,6 +1477,8 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener, .getFileList(), db); if (forceNewWalk || shouldRedraw(db, headId, paths)) { + releaseGenerateHistoryJob(); + SWTWalk walk = createNewWalk(db, headId); setWalkStartPoints(walk, db, headId); @@ -1856,9 +1855,11 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener, } } - private void cancelRefreshJob() { - if (job != null && job.getState() != Job.NONE) { - job.cancel(); + private void releaseGenerateHistoryJob() { + if (job != null) { + if (job.getState() != Job.NONE) + job.cancel(); + job.release(); job = null; } } |