Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2016-06-10 12:44:04 -0400
committerJeff Johnston2016-06-10 13:56:16 -0400
commite2eb5208b5590414d2a75371f0c75a0ae4f36cdc (patch)
tree65050462b4bbc1e4649665c92bdebfa0162ea2f8
parenta946fadeba344f6590bd1b9f77684f2726c7a194 (diff)
downloadorg.eclipse.linuxtools-e2eb5208b5590414d2a75371f0c75a0ae4f36cdc.tar.gz
org.eclipse.linuxtools-e2eb5208b5590414d2a75371f0c75a0ae4f36cdc.tar.xz
org.eclipse.linuxtools-e2eb5208b5590414d2a75371f0c75a0ae4f36cdc.zip
Bug 495840 - Memory leak if Docker Views left open for long periodv5.0.0b
- additional fixes where images are not being disposed of properly in Docker Change-Id: I06ae37c7ebd21217ca70cc8d1b1b081b55b9df95 Reviewed-on: https://git.eclipse.org/r/75088 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageShortcut.java7
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/RunDockerImageLaunchConfigurationDelegate.java7
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/RunImageVolumesTab.java21
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerLabelProvider.java55
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageRunResourceVolumesVariablesPage.java21
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageSearchPage.java6
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/NewDockerConnectionPage.java7
7 files changed, 101 insertions, 23 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageShortcut.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageShortcut.java
index 246137c96e..3c44115c28 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageShortcut.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageShortcut.java
@@ -197,6 +197,10 @@ public class BuildDockerImageShortcut implements ILaunchShortcut {
private class ConnectionSelectionLabelProvider implements ILabelProvider {
+
+ private Image CONNECTION_IMAGE = SWTImagesFactory.DESC_REPOSITORY_MIDDLE
+ .createImage();
+
@Override
public void removeListener(ILabelProviderListener listener) {
}
@@ -208,6 +212,7 @@ public class BuildDockerImageShortcut implements ILaunchShortcut {
@Override
public void dispose() {
+ CONNECTION_IMAGE.dispose();
}
@Override
@@ -221,7 +226,7 @@ public class BuildDockerImageShortcut implements ILaunchShortcut {
@Override
public Image getImage(Object element) {
- return SWTImagesFactory.DESC_REPOSITORY_MIDDLE.createImage();
+ return CONNECTION_IMAGE;
}
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/RunDockerImageLaunchConfigurationDelegate.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/RunDockerImageLaunchConfigurationDelegate.java
index 0eae69b1af..8b013db39e 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/RunDockerImageLaunchConfigurationDelegate.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/RunDockerImageLaunchConfigurationDelegate.java
@@ -269,6 +269,10 @@ public class RunDockerImageLaunchConfigurationDelegate
}
private class ConnectionSelectionLabelProvider implements ILabelProvider {
+
+ private Image CONNECTION_IMAGE = SWTImagesFactory.DESC_REPOSITORY_MIDDLE
+ .createImage();
+
@Override
public void removeListener(ILabelProviderListener listener) {
}
@@ -280,6 +284,7 @@ public class RunDockerImageLaunchConfigurationDelegate
@Override
public void dispose() {
+ CONNECTION_IMAGE.dispose();
}
@Override
@@ -293,7 +298,7 @@ public class RunDockerImageLaunchConfigurationDelegate
@Override
public Image getImage(Object element) {
- return SWTImagesFactory.DESC_REPOSITORY_MIDDLE.createImage();
+ return CONNECTION_IMAGE;
}
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/RunImageVolumesTab.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/RunImageVolumesTab.java
index 0aa86e02b1..4822502638 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/RunImageVolumesTab.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/RunImageVolumesTab.java
@@ -355,24 +355,37 @@ public class RunImageVolumesTab extends AbstractLaunchConfigurationTab {
private static final class DataVolumesLabelProvider
extends ObservableMapLabelProvider {
+ private Image CONTAINER_IMAGE = SWTImagesFactory.DESC_CONTAINER
+ .createImage();
+ private Image FOLDER_CLOSED_IMAGE = SWTImagesFactory.DESC_FOLDER_CLOSED
+ .createImage();
+ private Image FILE_IMAGE = SWTImagesFactory.DESC_FILE.createImage();
+
public DataVolumesLabelProvider(final IObservableMap[] attributeMaps) {
super(attributeMaps);
}
@Override
+ public void dispose() {
+ CONTAINER_IMAGE.dispose();
+ FOLDER_CLOSED_IMAGE.dispose();
+ FILE_IMAGE.dispose();
+ super.dispose();
+ }
+
+ @Override
public Image getColumnImage(Object element, int columnIndex) {
final DataVolumeModel dataVolume = ((DataVolumeModel) element);
if (dataVolume.getMountType() != null && columnIndex == 1) {
switch (dataVolume.getMountType()) {
case CONTAINER:
- return SWTImagesFactory.DESC_CONTAINER.createImage();
+ return CONTAINER_IMAGE;
case HOST_FILE_SYSTEM:
final File hostFile = new File(dataVolume.getMount());
if (!hostFile.exists() || hostFile.isDirectory()) {
- return SWTImagesFactory.DESC_FOLDER_CLOSED
- .createImage();
+ return FOLDER_CLOSED_IMAGE;
} else {
- return SWTImagesFactory.DESC_FILE.createImage();
+ return FILE_IMAGE;
}
default:
return null;
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerLabelProvider.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerLabelProvider.java
index b1cf26fa63..ebb2784b03 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerLabelProvider.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerLabelProvider.java
@@ -45,6 +45,26 @@ import org.eclipse.swt.graphics.Image;
public class DockerExplorerLabelProvider implements IStyledLabelProvider, ILabelProvider {
private static final String UNNAMED_CONNECTION = "Connection.unnamed"; //$NON-NLS-1$
+ private Image OPEN_CONNECTION_IMAGE = SWTImagesFactory.DESC_REPOSITORY_MIDDLE
+ .createImage();
+ private Image UNOPEN_CONNECTION_IMAGE = SWTImagesFactory.DESC_REPOSITORY_MIDDLED
+ .createImage();
+ private Image CATEGORY_IMAGE = SWTImagesFactory.DESC_DB_GROUP.createImage();
+ private Image IMAGE_IMAGE = SWTImagesFactory.DESC_IMAGE.createImage();
+ private Image STARTED_CONTAINER_IMAGE = SWTImagesFactory.DESC_CONTAINER_STARTED
+ .createImage();
+ private Image PAUSED_CONTAINER_IMAGE = SWTImagesFactory.DESC_CONTAINER_PAUSED
+ .createImage();
+ private Image STOPPED_CONTAINER_IMAGE = SWTImagesFactory.DESC_CONTAINER_STOPPED
+ .createImage();
+ private Image CONTAINER_LINK_IMAGE = SWTImagesFactory.DESC_CONTAINER_LINK
+ .createImage();
+ private Image CONTAINER_VOLUME_IMAGE = SWTImagesFactory.DESC_CONTAINER_VOLUME
+ .createImage();
+ private Image CONTAINER_PORT_IMAGE = SWTImagesFactory.DESC_CONTAINER_PORT
+ .createImage();
+ private Image LOADING_IMAGE = SWTImagesFactory.DESC_SYSTEM_PROCESS
+ .createImage();
@Override
public void addListener(ILabelProviderListener listener) {
@@ -52,6 +72,17 @@ public class DockerExplorerLabelProvider implements IStyledLabelProvider, ILabel
@Override
public void dispose() {
+ OPEN_CONNECTION_IMAGE.dispose();
+ UNOPEN_CONNECTION_IMAGE.dispose();
+ CATEGORY_IMAGE.dispose();
+ IMAGE_IMAGE.dispose();
+ STARTED_CONTAINER_IMAGE.dispose();
+ PAUSED_CONTAINER_IMAGE.dispose();
+ STOPPED_CONTAINER_IMAGE.dispose();
+ CONTAINER_LINK_IMAGE.dispose();
+ CONTAINER_VOLUME_IMAGE.dispose();
+ CONTAINER_PORT_IMAGE.dispose();
+ LOADING_IMAGE.dispose();
}
@Override
@@ -67,38 +98,38 @@ public class DockerExplorerLabelProvider implements IStyledLabelProvider, ILabel
public Image getImage(final Object element) {
if(element instanceof IDockerConnection) {
if (((IDockerConnection) element).isOpen()) {
- return SWTImagesFactory.DESC_REPOSITORY_MIDDLE.createImage();
+ return OPEN_CONNECTION_IMAGE;
} else {
- return SWTImagesFactory.DESC_REPOSITORY_MIDDLED.createImage();
+ return UNOPEN_CONNECTION_IMAGE;
}
} else if(element instanceof DockerImagesCategory) {
- return SWTImagesFactory.DESC_DB_GROUP.createImage();
+ return CATEGORY_IMAGE;
} else if(element instanceof DockerContainersCategory) {
- return SWTImagesFactory.DESC_DB_GROUP.createImage();
+ return CATEGORY_IMAGE;
} else if(element instanceof IDockerImage) {
- return SWTImagesFactory.DESC_IMAGE.createImage();
+ return IMAGE_IMAGE;
} else if(element instanceof IDockerContainer) {
final IDockerContainer container = (IDockerContainer) element;
final EnumDockerStatus containerStatus = EnumDockerStatus
.fromStatusMessage(container.status());
if (containerStatus == EnumDockerStatus.RUNNING) {
- return SWTImagesFactory.DESC_CONTAINER_STARTED.createImage();
+ return STARTED_CONTAINER_IMAGE;
} else if (containerStatus == EnumDockerStatus.PAUSED) {
- return SWTImagesFactory.DESC_CONTAINER_PAUSED.createImage();
+ return PAUSED_CONTAINER_IMAGE;
} else {
- return SWTImagesFactory.DESC_CONTAINER_STOPPED.createImage();
+ return STOPPED_CONTAINER_IMAGE;
}
} else if (element instanceof DockerContainerLinksCategory
|| element instanceof DockerContainerLink) {
- return SWTImagesFactory.DESC_CONTAINER_LINK.createImage();
+ return CONTAINER_LINK_IMAGE;
} else if (element instanceof DockerContainerVolumesCategory
|| element instanceof DockerContainerVolume) {
- return SWTImagesFactory.DESC_CONTAINER_VOLUME.createImage();
+ return CONTAINER_VOLUME_IMAGE;
} else if (element instanceof DockerContainerPortMappingsCategory
|| element instanceof IDockerPortMapping) {
- return SWTImagesFactory.DESC_CONTAINER_PORT.createImage();
+ return CONTAINER_PORT_IMAGE;
} else if(element instanceof LoadingStub) {
- return SWTImagesFactory.DESC_SYSTEM_PROCESS.createImage();
+ return LOADING_IMAGE;
}
return null;
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageRunResourceVolumesVariablesPage.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageRunResourceVolumesVariablesPage.java
index c24ca50811..b467435f6b 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageRunResourceVolumesVariablesPage.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageRunResourceVolumesVariablesPage.java
@@ -745,24 +745,37 @@ image);
private static final class DataVolumesLabelProvider
extends ObservableMapLabelProvider {
+ private Image CONTAINER_IMAGE = SWTImagesFactory.DESC_CONTAINER
+ .createImage();
+ private Image FOLDER_CLOSED_IMAGE = SWTImagesFactory.DESC_FOLDER_CLOSED
+ .createImage();
+ private Image FILE_IMAGE = SWTImagesFactory.DESC_FILE.createImage();
+
public DataVolumesLabelProvider(final IObservableMap[] attributeMaps) {
super(attributeMaps);
}
@Override
+ public void dispose() {
+ CONTAINER_IMAGE.dispose();
+ FOLDER_CLOSED_IMAGE.dispose();
+ FILE_IMAGE.dispose();
+ super.dispose();
+ }
+
+ @Override
public Image getColumnImage(Object element, int columnIndex) {
final DataVolumeModel dataVolume = ((DataVolumeModel) element);
if (dataVolume.getMountType() != null && columnIndex == 1) {
switch (dataVolume.getMountType()) {
case CONTAINER:
- return SWTImagesFactory.DESC_CONTAINER.createImage();
+ return CONTAINER_IMAGE;
case HOST_FILE_SYSTEM:
final File hostFile = new File(dataVolume.getMount());
if (!hostFile.exists() || hostFile.isDirectory()) {
- return SWTImagesFactory.DESC_FOLDER_CLOSED
- .createImage();
+ return FOLDER_CLOSED_IMAGE;
} else {
- return SWTImagesFactory.DESC_FILE.createImage();
+ return FILE_IMAGE;
}
default:
return null;
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageSearchPage.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageSearchPage.java
index 321b5d5d73..3c0a0e2dd7 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageSearchPage.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageSearchPage.java
@@ -452,6 +452,12 @@ public class ImageSearchPage extends WizardPage {
}
}
+ @Override
+ public void dispose() {
+ ICON.dispose();
+ super.dispose();
+ }
+
abstract boolean doPaint(final Object element);
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/NewDockerConnectionPage.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/NewDockerConnectionPage.java
index 6df8d3e208..35433fb99d 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/NewDockerConnectionPage.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/NewDockerConnectionPage.java
@@ -977,6 +977,10 @@ public class NewDockerConnectionPage extends WizardPage {
}
private class ConnectionSelectionLabelProvider implements ILabelProvider {
+
+ private Image CONNECTION_IMAGE = SWTImagesFactory.DESC_REPOSITORY_MIDDLE
+ .createImage();
+
@Override
public void removeListener(ILabelProviderListener listener) {
}
@@ -988,6 +992,7 @@ public class NewDockerConnectionPage extends WizardPage {
@Override
public void dispose() {
+ CONNECTION_IMAGE.dispose();
}
@Override
@@ -1001,7 +1006,7 @@ public class NewDockerConnectionPage extends WizardPage {
@Override
public Image getImage(Object element) {
- return SWTImagesFactory.DESC_REPOSITORY_MIDDLE.createImage();
+ return CONNECTION_IMAGE;
}
}

Back to the top