I have developed a silverlight prism project to replicate a memory leak. Just wondering about the lifecycle of a prism module.
If inside a module I register a view does the view get destroyed when the module is no longer in use?
Also does each module share the same dependency container (e.g. unity) or does each module have a separate one?
I have a more in depth question here,
https://stackoverflow.com/questions/4652364/memory-usage-is-suspect-when-loading-prism-modules
I am trying to understand some discrepancies 开发者_StackOverflowwith memory usage when opening and closing prism modules.
1) The point in time the view gets destroyed depends on the way you have registered the view to the container. If you didn't change the object lifecycle during registration, it will be destroyed when the GC finds it without having any object referencing it. If you explicitly specified a lifetime manager during the registration the view gets destroyed depending on the particular lifetime the manager manages. An exmaple: When you are using a Unity container and you registered the view with a ContainerControlledLifetimeManager the view gets destroyed when the container gets destroyed.
2) All modules share one container as long as you don't make a child container for each module on your own.
精彩评论