Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2011-04-28 20:45:46 -0400
committerIgor Fedorenko2011-04-28 22:04:08 -0400
commitd14848a6661818c0eb3e1f81177ec7b8526acf38 (patch)
tree38c4ca2bedc386dc6235484cceac74ca316709c3
parent83f58b5342cbb102eced34d13a3c988676295f4f (diff)
downloadm2e-core-d14848a6661818c0eb3e1f81177ec7b8526acf38.tar.gz
m2e-core-d14848a6661818c0eb3e1f81177ec7b8526acf38.tar.xz
m2e-core-d14848a6661818c0eb3e1f81177ec7b8526acf38.zip
Plugged bad memory leak in project registry
Detach from maven session MavenProject instances associated with LifecycleMappingMetadataSource, which are stored in project registry and thus are very long lived. This reduced heap used by registry from ~520M to ~100M for a test workspace with ~60 projects all using same parent to define lifecycle mapping configuration. Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java
index 2c37468e..9c2dd401 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java
@@ -513,6 +513,7 @@ public class LifecycleMappingFactory {
LifecycleMappingMetadataSource embeddedSource = getEmbeddedMetadataSource(project);
if(embeddedSource != null) {
+ maven.detachFromSession(project); // don't cache maven session
embeddedSource.setSource(project);
sources.add(embeddedSource);
}
@@ -521,6 +522,8 @@ public class LifecycleMappingFactory {
sources.add(referencedSource);
}
+ // TODO ideally, we need to reuse the same parent MavenProject instance in all child modules
+ // each instance takes ~1M, so we can easily safe 100M+ of heap for larger workspaces
MavenExecutionRequest request = newMavenExecutionRequest(templateRequest);
project = maven.resolveParentProject(request, project, monitor);
} while(project != null);

Back to the top