[553390] Tolerate much more memory use.
diff --git a/org.eclipse.modisco.java.composition.discoverer.tests/src/org/eclipse/modisco/java/composition/discoverer/tests/TestMemoryUsage.java b/org.eclipse.modisco.java.composition.discoverer.tests/src/org/eclipse/modisco/java/composition/discoverer/tests/TestMemoryUsage.java
index f520c5e..5fc894b 100644
--- a/org.eclipse.modisco.java.composition.discoverer.tests/src/org/eclipse/modisco/java/composition/discoverer/tests/TestMemoryUsage.java
+++ b/org.eclipse.modisco.java.composition.discoverer.tests/src/org/eclipse/modisco/java/composition/discoverer/tests/TestMemoryUsage.java
@@ -48,7 +48,7 @@
 

 public class TestMemoryUsage {

 

-	private static final long MAX_MEM_AWAITED = 180;

+	private static final long MAX_MEM_AWAITED = 360;	// See Bug 553390

 	private static final int KILO = 1024;

 	private static final String PROJECT_NAME = JUnitPlugin.PLUGIN_ID

 			+ "_test001"; //$NON-NLS-1$

@@ -62,7 +62,9 @@
 	@Before

 	public void initResource() throws CoreException, IOException,

 			InterruptedException, DiscoveryException {

-		final long totalMemory = Runtime.getRuntime().totalMemory();

+		Runtime runtime = Runtime.getRuntime();

+		runtime.gc();

+		long oldTotalMemory = runtime.totalMemory();

 		this.project = ResourcesPlugin.getWorkspace().getRoot()

 				.getProject(TestMemoryUsage.PROJECT_NAME);

 		if (this.project.exists()) {

@@ -88,8 +90,11 @@
 				TestMemoryUsage.model = (JavaApplication) eobject;

 			}

 		}

-		final long deltaMem = Runtime.getRuntime().totalMemory() - totalMemory;

+		runtime.gc();

+		long newTotalMemory = runtime.totalMemory();

+		final long deltaMem = newTotalMemory - oldTotalMemory;

 		this.memoryUsed = deltaMem / KILO / KILO;

+		System.out.println("Memory used: " + deltaMem + " = " + newTotalMemory + " - " + oldTotalMemory);

 	}

 

 	@After

diff --git a/org.eclipse.modisco.jee.jsp.discoverer.tests/src/org/eclipse/modisco/jee/jsp/discoverer/tests/TestMemory.java b/org.eclipse.modisco.jee.jsp.discoverer.tests/src/org/eclipse/modisco/jee/jsp/discoverer/tests/TestMemory.java
index 5bd1209..07e1486 100644
--- a/org.eclipse.modisco.jee.jsp.discoverer.tests/src/org/eclipse/modisco/jee/jsp/discoverer/tests/TestMemory.java
+++ b/org.eclipse.modisco.jee.jsp.discoverer.tests/src/org/eclipse/modisco/jee/jsp/discoverer/tests/TestMemory.java
@@ -29,11 +29,13 @@
 public class TestMemory {

 

 	private static final String RESOURCES_TEST_MEMORY = "/resources/memory.jsp"; //$NON-NLS-1$

-	private static final long EXPECTED_MEM_MAXIMUM = 200;

+	private static final long EXPECTED_MEM_MAXIMUM = 360;	// See Bug 553390

 

 	@Test

 	public void memoryTest() throws Exception {

-		final long totalMemory = Runtime.getRuntime().totalMemory();

+		Runtime runtime = Runtime.getRuntime();

+		runtime.gc();

+		long oldTotalMemory = runtime.totalMemory();

 

 		IProject oldProject = ResourcesPlugin.getWorkspace().getRoot()

 				.getProject(Activator.PLUGIN_ID);

@@ -60,9 +62,12 @@
 		Resource targetModel = discoverer.getTargetModel();

 		assertNotNull(targetModel);

 

-		final long memoryUsed = (Runtime.getRuntime().totalMemory() - totalMemory) / 1024 / 1024;

+		runtime.gc();

+		long newTotalMemory = runtime.totalMemory();

+		final long deltaMem = newTotalMemory - oldTotalMemory;

+		final long memoryUsed = deltaMem / 1024 / 1024;

 

-		System.out.println("Memory Used :" + memoryUsed);

+		System.out.println("Memory used: " + deltaMem + " = " + newTotalMemory + " - " + oldTotalMemory);

 

 		Assert.assertTrue(

 				"Abnormal memory use for TestMemory.java\n " + memoryUsed //$NON-NLS-1$