Skip to content

Java refactoring leads to OOM #594

@mpiggott

Description

@mpiggott

Was not experiencing this with 3.0.0.xx-201804160310-e47 but after upgrading to 3.0.0.xx-201805301411-e47 and subsequently 3.0.0.xx-201806030023-e47 attempts to refactor in Java code never completes before Eclipse goes OOM.

Checking a heap dump:

org.codehaus.groovy.ast.ClassNode	11.148833683217271	3,516,234 (11.1%)	910,704,606 (37.2%)
org.codehaus.groovy.ast.Parameter	3.743586914372446	1,180,691 (3.7%)	134,598,774 (5.5%)
java.util.ArrayList	13.026979586880131	4,108,583 (13%)	131,474,656 (5.4%)
java.util.HashMap$Node[]	2.4051310392234635	758,555 (2.4%)	120,868,680 (4.9%)
org.codehaus.groovy.ast.GenericsType	4.3356247798362855	1,367,414 (4.3%)	113,495,362 (4.6%)
java.util.LinkedHashMap$Entry	5.063944579145269	1,597,119 (5.1%)	95,827,140 (3.9%)
org.codehaus.groovy.ast.MethodNode	1.9489534078885749	614,681 (1.9%)	95,275,555 (3.9%)
org.codehaus.groovy.ast.ClassNode$MapOfLists	11.149680253324215	3,516,501 (11.1%)	84,396,024 (3.4%)

About twice this number of classes (java string, java collections and groovy classes) trailing down to 1%

Below is the relevant thread, Junit5 isn't on the classpath nor do I believe Groovy code would be affected by the refactoring:

"ModalContext" #157 prio=6 os_prio=0 tid=0x0000000029872800 nid=0xa28 runnable [0x000000003f9dd000]
   java.lang.Thread.State: RUNNABLE
        at java.util.HashMap.putVal(HashMap.java:631)
        at java.util.HashMap.put(HashMap.java:612)
        at org.codehaus.groovy.ast.VariableScope.putDeclaredVariable(VariableScope.java:119)
        at org.codehaus.groovy.ast.MethodNode.setParameters(MethodNode.java:160)
        at org.codehaus.groovy.ast.MethodNode.<init>(MethodNode.java:62)
        at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:405)
        at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:358)
        - locked <0x00000000e4274600> (a java.lang.Object)
        at org.codehaus.groovy.ast.ClassNode.getDeclaredMethods(ClassNode.java:970)
        at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:985)
        at org.eclipse.jdt.groovy.search.CategoryTypeLookup.lookupType(CategoryTypeLookup.java:56)
        at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.lookupExpressionType(TypeInferencingVisitorWithRequestor.java:2371)
        at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.getMethodCallArgumentTypes(TypeInferencingVisitorWithRequestor.java:2068)
        at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.handleSimpleExpression(TypeInferencingVisitorWithRequestor.java:1836)
        at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitConstantExpression(TypeInferencingVisitorWithRequestor.java:978)
        at org.codehaus.groovy.ast.expr.ConstantExpression.visit(ConstantExpression.java:85)
        at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitMethodCallExpression(TypeInferencingVisitorWithRequestor.java:1385)
        at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:123)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:280)
        at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:147)
        at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitConstructorOrMethod(TypeInferencingVisitorWithRequestor.java:1065)
        at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitJDT(TypeInferencingVisitorWithRequestor.java:403)
        at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitJDT(TypeInferencingVisitorWithRequestor.java:277)
        at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitCompilationUnit(TypeInferencingVisitorWithRequestor.java:241)
        at org.codehaus.jdt.groovy.integration.internal.GroovyLanguageSupport.maybePerformDelegatedSearch(GroovyLanguageSupport.java:235)
        at org.codehaus.jdt.groovy.integration.LanguageSupportFactory.maybePerformDelegatedSearch(LanguageSupportFactory.java:114)
        at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1267)
        at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1389)
        at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1506)
        at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:122)
        at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:236)
        at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:583)
        at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:608)
        at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.internalSearch(RefactoringSearchEngine.java:143)
        at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.search(RefactoringSearchEngine.java:130)
        at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor.getOccurrences(RenameMethodProcessor.java:491)
        at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor.doCheckFinalConditions(RenameMethodProcessor.java:388)
        at org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor.doCheckFinalConditions(RenameVirtualMethodProcessor.java:146)
        at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.checkFinalConditions(JavaRenameProcessor.java:48)
        at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:222)
        at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:162)
        at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:81)
        at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
        at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:724)
        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2267)
        at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5680)
        at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:105)
        at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions