diffix / explorer

Tool to automatically explore and generate stats on data anonymized using Diffix
MIT License
2 stars 1 forks source link

Correctly dispose INestedContainer objects created in ExplorationLauncher #173

Closed AndreiBozantan closed 4 years ago

AndreiBozantan commented 4 years ago

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.

Originally posted by @dandanlen in https://github.com/diffix/explorer/pull/172

AndreiBozantan commented 4 years ago

closed with #181