Project: JDT
Bug 131069 OutOfMemoryError running refactoring tests
Reported: 2006-03-09 06:52:05 | Status: verified fixed

I20060307-1315 Run e.g. InlineTempTests with a fresh (default) launch configuration. On my machine, I get the OOME in InlineTempTests.test19(). The problem is the StringBuffer buffer in RefactoringHistoryManager.addIndexEntry(IFileStore, RefactoringDescriptor, IProgressMonitor) line: 147 which is > 15MB (and then converted to a String and a byte[]). Without looking too deep into the code, 2 questions arise: 1) Why is the buffer that big? 2) If the buffer has to be that big, could it be avoided by processing streams in a pipeline? Thread [main] (Suspended (exception OutOfMemoryError)) StringCoding$CharsetSE.encode(char[], int, int) line: 334 StringCoding.encode(String, char[], int, int) line: 378 String.getBytes(String) line: 812 RefactoringHistoryManager.addIndexEntry(IFileStore, RefactoringDescriptor, IProgressMonitor) line: 147 RefactoringHistoryManager.addRefactoringDescriptor(RefactoringDescriptor, boolean, IProgressMonitor) line: 760 RefactoringHistorySerializer.processHistoryNotification(IFileStore, RefactoringHistoryEvent, String) line: 114 RefactoringHistorySerializer.historyNotification(RefactoringHistoryEvent) line: 76 RefactoringHistoryService$3.run() line: 240 SafeRunner.run(ISafeRunnable) line: 37 RefactoringHistoryService$RefactoringDescriptorStack.push(RefactoringDescriptor) line: 233 RefactoringHistoryService$RefactoringDescriptorStack.access$0(RefactoringHistoryService$RefactoringDescriptorStack, RefactoringDescriptor) line: 225 RefactoringHistoryService$RefactoringOperationHistoryListener.historyNotification(OperationHistoryEvent) line: 401 DefaultOperationHistory.notifyListeners(OperationHistoryEvent) line: 879 DefaultOperationHistory.notifyDone(IUndoableOperation) line: 943 DefaultOperationHistory.closeOperation(boolean, boolean, int) line: 1338 UndoManager2.changePerformed(Change, boolean) line: 149 PerformChangeOperation$1.run(IProgressMonitor) line: 239 Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1736 Workspace.run(IWorkspaceRunnable, IProgressMonitor) line: 1718 PerformChangeOperation.executeChange(IProgressMonitor) line: 280 PerformChangeOperation.run(IProgressMonitor) line: 192 Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1736 Workspace.run(IWorkspaceRunnable, IProgressMonitor) line: 1718 InlineTempTests(RefactoringTest).executePerformOperation(PerformChangeOperation, IWorkspace) line: 221 InlineTempTests(RefactoringTest).performRefactoring(Refactoring, boolean) line: 204 InlineTempTests(RefactoringTest).performRefactoring(Refactoring) line: 174 InlineTempTests.helper1(ICompilationUnit, ISourceRange) line: 78 InlineTempTests.helper1(int, int, int, int) line: 91 InlineTempTests.test19() line: 204 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 585 InlineTempTests(TestCase).runTest() line: 154 InlineTempTests(TestCase).runBare() line: 127 TestResult$1.protect() line: 106 TestResult.runProtected(Test, Protectable) line: 124 TestResult.run(TestCase) line: 109 InlineTempTests(TestCase).run(TestResult) line: 118 TestSuite.runTest(Test, TestResult) line: 208 TestSuite.run(TestResult) line: 203 RefactoringTestSetup(TestDecorator).basicRun(TestResult) line: 22 TestSetup$1.protect() line: 19 TestResult.runProtected(Test, Protectable) line: 124 RefactoringTestSetup(TestSetup).run(TestResult) line: 23 RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String) line: 478 RemotePluginTestRunner(RemoteTestRunner).run() line: 344 RemotePluginTestRunner.main(String[]) line: 57 UITestApplication$1.run() line: 105 RunnableLock.run() line: 35 UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 123 Display.runAsyncMessages(boolean) line: 3317 Display.readAndDispatch() line: 2963 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 1924 Workbench.runUI() line: 1888 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 422 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 143 IDEApplication.run(Object) line: 107 UITestApplication.run(Object) line: 45 PlatformActivator$1.run(Object) line: 78 EclipseAppLauncher.runApplication(Object) line: 92 EclipseAppLauncher.start(Object) line: 68 EclipseStarter.run(Object) line: 374 EclipseStarter.run(String[], Runnable) line: 169 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 585 Main.invokeFramework(String[], URL[]) line: 338 Main.basicRun(String[]) line: 282 Main.run(String[]) line: 977 Main.main(String[]) line: 952

Files changed in fix:
org.eclipse.ltk.core.refactoring/src/org/eclipse/ltk/internal/core/refactoring/history/RefactoringHistoryManager.java