I found what I believe to be a bug and figured I’d pass along my findings. If you’re working with the
SPLimitedWebPartManager object and call
Dispose() on it there’s a minor problem – the
Dispose() method does not dispose of the
SPWeb object that gets loaded up – if you’re only using one instance this isn’t much of a problem but if you’re doing a lot of looping then you’ll eventually run out of memory on the server.
I have an stsadm command that I created which replaces content within web parts throughout a site – eventually the command fails because there’s not enough memory – I solved my issues by calling
manager is an
SPLimitedWebPartManager object) right before calling
manager.Dispose(). I also noticed that it doesn’t dispose of the web parts in the
SPLimitedWebPartCollection object though this didn’t seem to be causing me any problems but I think it’s because I was already disposing of them when I was finished processing.