Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2008-10-25 19:32:49 +0000
committerPascal Rapicault2008-10-25 19:32:49 +0000
commitcffbb17052c687cf56f267cee36d9dd904387033 (patch)
tree8db43f8d83b68755709aab150a20547eebc687e8
parent09acc71c2907e1dcf2f4cd1780827263ad07a264 (diff)
downloadrt.equinox.p2-cffbb17052c687cf56f267cee36d9dd904387033.tar.gz
rt.equinox.p2-cffbb17052c687cf56f267cee36d9dd904387033.tar.xz
rt.equinox.p2-cffbb17052c687cf56f267cee36d9dd904387033.zip
Bug 251913 - [planner] High memory use in projectorv20081027_2115v20081027-2115
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java80
1 files changed, 52 insertions, 28 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
index ffa6d8764..1ec41ba81 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java
@@ -427,23 +427,29 @@ public class Projector {
if (optionalityExpression == null)
optionalityExpression = " -1 " + iuVar + " 1 " + getNoOperationVariable(iu); //$NON-NLS-1$ //$NON-NLS-2$
StringBuffer comment = new StringBuffer();
- comment.append("* "); //$NON-NLS-1$
- comment.append(iu.toString());
- comment.append(" requires optionaly either "); //$NON-NLS-1$
+ if (DEBUG) {
+ comment.append("* "); //$NON-NLS-1$
+ comment.append(iu.toString());
+ comment.append(" requires optionaly either "); //$NON-NLS-1$
+ }
int countMatches = 0;
for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
IInstallableUnit match = (IInstallableUnit) iterator.next();
if (isApplicable(match)) {
countMatches++;
expression += " 1 " + getVariable(match); //$NON-NLS-1$
- comment.append(match.toString());
- comment.append(' ');
+ if (DEBUG) {
+ comment.append(match.toString());
+ comment.append(' ');
+ }
}
}
countOptionalIUs += countMatches;
if (countMatches > 0) {
- dependencies.add(comment.toString());
- commentsCount++;
+ if (DEBUG) {
+ dependencies.add(comment.toString());
+ commentsCount++;
+ }
dependencies.add(impliesNo(getNoOperationVariable(iu), abstractVar));
dependencies.add(expression + " >= 0;"); //$NON-NLS-1$
optionalityExpression += " 1 " + abstractVar; //$NON-NLS-1$
@@ -460,23 +466,29 @@ public class Projector {
if (optionalityExpression == null)
optionalityExpression = " -1 " + getVariable(iu) + " 1 " + getNoOperationVariable(iu); //$NON-NLS-1$ //$NON-NLS-2$
StringBuffer comment = new StringBuffer();
- comment.append("* "); //$NON-NLS-1$
- comment.append(iu.toString());
- comment.append(" requires optionaly either "); //$NON-NLS-1$
+ if (DEBUG) {
+ comment.append("* "); //$NON-NLS-1$
+ comment.append(iu.toString());
+ comment.append(" requires optionaly either "); //$NON-NLS-1$
+ }
int countMatches = 0;
for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
IInstallableUnit match = (IInstallableUnit) iterator.next();
if (isApplicable(match)) {
countMatches++;
expression += " 1 " + getVariable(match); //$NON-NLS-1$
- comment.append(match.toString());
- comment.append(' ');
+ if (DEBUG) {
+ comment.append(match.toString());
+ comment.append(' ');
+ }
}
}
countOptionalIUs += countMatches;
if (countMatches > 0) {
- dependencies.add(comment.toString());
- commentsCount++;
+ if (DEBUG) {
+ dependencies.add(comment.toString());
+ commentsCount++;
+ }
dependencies.add(impliesNo(getNoOperationVariable(iu), abstractVar));
dependencies.add(expression + " " + value + ";"); //$NON-NLS-1$ //$NON-NLS-2$
optionalityExpression += " 1 " + abstractVar; //$NON-NLS-1$
@@ -490,23 +502,29 @@ public class Projector {
String expression = varIu;
Collector matches = picker.query(new CapabilityQuery(req), new Collector(), null);
StringBuffer comment = new StringBuffer();
- comment.append("* "); //$NON-NLS-1$
- comment.append(iu.toString());
- comment.append(" requires either "); //$NON-NLS-1$
+ if (DEBUG) {
+ comment.append("* "); //$NON-NLS-1$
+ comment.append(iu.toString());
+ comment.append(" requires either "); //$NON-NLS-1$
+ }
int countMatches = 0;
for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
IInstallableUnit match = (IInstallableUnit) iterator.next();
if (isApplicable(match)) {
countMatches++;
expression += " +1 " + getVariable(match); //$NON-NLS-1$
- comment.append(match.toString());
- comment.append(' ');
+ if (DEBUG) {
+ comment.append(match.toString());
+ comment.append(' ');
+ }
}
}
if (countMatches > 0) {
- dependencies.add(comment.toString());
- commentsCount++;
+ if (DEBUG) {
+ dependencies.add(comment.toString());
+ commentsCount++;
+ }
dependencies.add(expression + " " + value + ";"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
result.add(new Status(IStatus.WARNING, DirectorActivator.PI_DIRECTOR, NLS.bind(Messages.Planner_Unsatisfied_dependency, iu, req)));
@@ -521,23 +539,29 @@ public class Projector {
String expression = "-1 " + varIu; //$NON-NLS-1$
Collector matches = picker.query(new CapabilityQuery(req), new Collector(), null);
StringBuffer comment = new StringBuffer();
- comment.append("* "); //$NON-NLS-1$
- comment.append(iu.toString());
- comment.append(" requires either "); //$NON-NLS-1$
+ if (DEBUG) {
+ comment.append("* "); //$NON-NLS-1$
+ comment.append(iu.toString());
+ comment.append(" requires either "); //$NON-NLS-1$
+ }
int countMatches = 0;
for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
IInstallableUnit match = (IInstallableUnit) iterator.next();
if (isApplicable(match)) {
countMatches++;
expression += " +1 " + getVariable(match); //$NON-NLS-1$
- comment.append(match.toString());
- comment.append(' ');
+ if (DEBUG) {
+ comment.append(match.toString());
+ comment.append(' ');
+ }
}
}
if (countMatches > 0) {
- dependencies.add(comment.toString());
- commentsCount++;
+ if (DEBUG) {
+ dependencies.add(comment.toString());
+ commentsCount++;
+ }
dependencies.add(expression + " >= 0;"); //$NON-NLS-1$
} else {
result.add(new Status(IStatus.WARNING, DirectorActivator.PI_DIRECTOR, NLS.bind(Messages.Planner_Unsatisfied_dependency, iu, req)));

Back to the top