At my company, we have a windows service, built in C#, that makes automatic modifications to Active Directory groups. This process use the function call “FindAll()” from the System.DirectoryServices.DirectorySearcher class.
It seems that the SearchResultCollection returned by the FindAll method can’t release it’s unmanaged resources by itself, so you need to call explicitly the Dispose() method.
Due to implementation restrictions, the SearchResultCollection class cannot release all of its unmanaged resources when it is garbage collected. To prevent a memory leak, you must call the Dispose method when the SearchResultCollection object is no longer needed.