Details
-
Bug
-
Resolution: Done
-
Major
-
5.5.0.Final
-
None
-
None
Description
It seems that the memory consumption increases after a session has been unmarshalled. That is to say: an unmarshalled session of size x uses much more memory than if I had started with an empty session and inserted x number of facts.
Digging into a memory profile, I found that after unmarshalling, my ReteooStatefulSession instance holds on to a MarshallerReaderContext instance:
StatefulKnowledgeSessionImpl : session
ReteooStatefulSession : defaultEntryPoint
NamedEntryPoint : objectStore
SingleThreadedObjectStore : identityMap
ObjectHashMap : table
Entry[] : [0]
ObjectHashMap$ObjectEntry : value
DefaultFactHandle : lastLeftTuple
RuleTerminalNodeLeftTuple : object
AgendaItem : context
PropagationContextImpl : readerContext
MarshallerReaderContext : this
The MarshallerReaderContext consumes a lot of memory.
Digging into the unmarshalling code, it seems that the MarshallerReaderContext is a utility class used during unmarshalling of sessions. Intuitively, it seems wrong that a reference to this object should be held after unmarshalling is finished.