Until now I would have used things like Web.ParentWeb and then forgotten about them. As I was not "Opening" them manually I was not disposing them either.
Now I usually do things like this:
I haven't had the time to check whether this is reducing the memory leaks or just making my application more unstable (if I close the web while I am using it somewhere else it could cause an exception it the other part of the code)using (SPWeb web = anotherWeb.ParentWeb){//Do Whatever you need here with the parent web}
Do you think when you dispose a web it automatically disposes every parent web automatically?
It could be...
I need to test this and once I do it I'll post about it.
No comments:
Post a Comment