This project has moved and is read-only. For the latest updates, please go here.

Memory leaks

Apr 21, 2011 at 10:58 PM


Really enjoyed Jounce. Starting writing my own MEF-based MVVM framework and then decided to just go with Jounce :). One thing I noticed though is that non-shared resources don't get GC-ed. This is because MEF holds a reference to them in the container. I resolved that and, while at it, made the shared/non-shared simply follow the part creation policy indicated by the part rather than requiring a seperate method call to create a non-shared part. I have the mods here but they are pretty have mods (changes some of the contracts radically). I do think though that the mod to fix the memory leak can be made without directly breaking contracts. Would like to suggest that as a future feature.

Thanks for all the hardwork on Jounce!


Apr 22, 2011 at 9:47 AM


Did you call CompositionInitializer.SatisfyImports  from any element linked  with the Non shared resources.

I met a similar problem because i was calling this method from some control I binded to a non shared item.

Apr 28, 2011 at 3:04 PM

Yes, I do think that was the issue. I switched it now to where MEF is used for creating all instances, and the part creation policy attribute determines if it shared or non-shared. Per MEF guidance, the non-shared items are created through a child container that is immediately disposed. It's trickier, but I think it is cleaner. Don't have to make special calls if the component is non-shared. Several of the other calls in Jounce are also at a 'view tag' level, which makes working with non-shared components (where you can have multiple instances for the same view tag) more difficult. So, I really like Jounce, but it's support for non-shared components can be improved upon :).