Open mottosso opened 8 years ago
This can be solved by storing a weak reference to the Context
in each instance.
I think another consequence of this is that the result
dictionaries stored within the context
during and after publishing would also never get garbage collected, resulting in ever-increasing memory use per reset and publish. Take a moment to think about how much data that can actually, every plug-in and log message is included there. Kilobytes per result, at least, multiplied by tens if not hundreds of results per publish.
Guessing this is the source of the constant memory increase we have been reporting?
Possibly. I've managed to plug this particular hole for now so it's likely we'll experience whether or not that's what it was. I'll be doing some proper memory hunting next.
At this point, the Context holds a reference to
MyInstance
as a child of itself, andMyInstance
holds a reference toContext
throughinstance.parent
andinstance.context
.This means that neither can ever be freed from memory, causing a linear increase in memory use per added instance.