Enhancement
Critical
Major
Detail
Detail
There is a memory leak that keeps old tl:KnowledgeBase tl:UpdateChainLink objects in memory. In turn, old tl:KBCache objects are attached to these, through which this has been noticed.
Chain of references:
- tl:SimpleKBCacheValue
- tl:UpdateChainLink
- tl:TLContext
- tl:MainLayout
- tl:AdminElementComponent
- tl:AttributeFormContext
- tl:AttributeUpdateContainer
- tl:ObjectEditing (tl:FormObjectOverlay representing a tl:TLObject being currently edited)
- tl:EvalContext (the one from com.top_logic.model.search)
- tl:QueryExecutor
- tl:OptionsByExpression
- tl:GeneratorFactory (module, held in memory by GeneratorFactory.Module.INSTANCE )
Solution
The tl:QueryExecutor no longer stores the tl:EvalContext. Instead, it is only created for the duration of the execution. Additionally, in the framework, it was ensured that the tl:QueryExecutor knows the tl:KnowledgeBase and tl:TLModel for which the expression was compiled. The tl:QueryExecutor passes both to the tl:EvalContext when it creates it. The tl:EvalContext is now only created by the tl:QueryExecutor, and the corresponding methods have been made private. This is to make it less likely that the expression refers to a different tl:KnowledgeBase or tl:TLModel than was passed to the tl:EvalContext.
Test
Run the scripted tests in the demo. Create a [ Dump] just before the last tests are executed. Open it for example with [JavaResources#Profiler:JVisualVM|JVisualVM]. Open the histogram of the classes and filter for the class tl:MainLayout and tl:UpdateChainLink and pay attention to the number of instances. There must be only one tl:MainLayout and only a few tl:UpdateChainLink objects.