Community
Participate
Working Groups
When executing the complete test suite, two of the tests in ClientResources_Test (testRegisterResourcesDebug and testRegisteredContentDebug) failed with java.lang.OutOfMemoryError: Java heap space at java.lang.StringCoding$CharsetSE.encode(StringCoding.java:334) at java.lang.StringCoding.encode(StringCoding.java:378) at java.lang.String.getBytes(String.java:812) at org.eclipse.rwt.internal.resources.ResourceUtil.readText(ResourceUtil.java:104) at org.eclipse.rwt.internal.resources.ResourceUtil.read(ResourceUtil.java:44) at org.eclipse.rwt.internal.resources.ResourceManagerImpl.register(ResourceManagerImpl.java:206) at org.eclipse.swt.internal.widgets.displaykit.ClientResources.registerJavascriptLibraryFile(ClientResources.java:379) at org.eclipse.swt.internal.widgets.displaykit.ClientResources.registerJavascriptFiles(ClientResources.java:335) at org.eclipse.swt.internal.widgets.displaykit.ClientResources.registerResources(ClientResources.java:315) at org.eclipse.swt.internal.widgets.displaykit.ClientResources_Test.testRegisteredContentDebug(ClientResources_Test.java:71) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Fixed by adding -Xmx128m VM argument to the RWTAllTestSuite launch configuration. Some theme manager cleanups in the tests added too.
I was able to reproduce the OOM by setting the max heap size to 64M (the default for 32bit Sun VMs, 64bit VMs have 30% more [1]). Looking at the heap dump, we found *a lot of* large Strings, e.g. there are 37 instances of ThemeManager sticking on different ApplicationContexts, each of which keeping references to the contents of all registered appearance files. This can be optimized, see bug 363745. The OOM actually occurs when the ResourceUtil reads the entire content of a large file into memory in order to copy it. This can also be done more efficiently, bug 363747. [1] http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#64bit_heap_defaults