Yes it was being disposed in LaunchColumnExploration but like you said, this is before the exploration ends (and LaunchColumnExploration was not being called in any case).
I think it's not causing a problem at the moment because we only use the scope to resolve our instances and once they are created, their lifetimes are managed by the runtime, so even if scope is disposed they are tracked by the garbage collector.
However, if we don't dispose the scope at all, we will definitely get a memory leak. If we dispose the scope early (as we currently do) it should be fine as long as (a) we only use the scope to instantiate our components and then never touch it again and (b) none of the components that are tied to the scope are IDisposable, since in this case they will be disposed along with the scope.
I think the safest way to ensure correct behaviour is to tie the lifetime of the scope to the lifetime of the Exploration.
Yes it was being disposed in
LaunchColumnExploration
but like you said, this is before the exploration ends (andLaunchColumnExploration
was not being called in any case).I think it's not causing a problem at the moment because we only use the
scope
to resolve our instances and once they are created, their lifetimes are managed by the runtime, so even ifscope
is disposed they are tracked by the garbage collector.However, if we don't dispose the scope at all, we will definitely get a memory leak. If we dispose the scope early (as we currently do) it should be fine as long as (a) we only use the
scope
to instantiate our components and then never touch it again and (b) none of the components that are tied to the scope areIDisposable
, since in this case they will be disposed along with thescope
.I think the safest way to ensure correct behaviour is to tie the lifetime of the
scope
to the lifetime of theExploration
.Originally posted by @dandanlen in https://github.com/diffix/explorer/pull/172