Skip to content

Commit

Permalink
Merge pull request #7959 from MarcusDenker/7955-ASTCache-can-cause-hu…
Browse files Browse the repository at this point in the history
…ge-leaks

Do not add DoIts to the cache for now. fixes #7955
  • Loading branch information
MarcusDenker committed Dec 22, 2020
2 parents 4f35722 + 2e36488 commit 51be131
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/AST-Core/ASTCache.class.st
Expand Up @@ -75,9 +75,12 @@ ASTCache class >> shutDown [

{ #category : #accessing }
ASTCache >> at: aCompiledMethod [
^ self
at: aCompiledMethod
ifAbsentPut: [ self class cacheMissStrategy getASTFor: aCompiledMethod ]
"for doit methods, the ast is stored in the method propery"
^ aCompiledMethod propertyAt: #ast ifAbsent: [
self
at: aCompiledMethod
ifAbsentPut: [
self class cacheMissStrategy getASTFor: aCompiledMethod ] ]
]

{ #category : #initialization }
Expand Down
3 changes: 2 additions & 1 deletion src/OpalCompiler-Core/OpalCompiler.class.st
Expand Up @@ -360,7 +360,8 @@ OpalCompiler >> compileDoit [
ast := RBParser parseMethod: ast formattedCode.
ast compilationContext: self compilationContext.
self doSemanticAnalysis.
ASTCache default at: cm put: ast.
"we store the ast in the doit method so that the debugger can read variables from the requestor"
cm propertyAt: #ast put: ast.
^cm
]

Expand Down

0 comments on commit 51be131

Please sign in to comment.