グループ列挙コードへのリークを突き止めました。テスト ルーチンを作成し、すべてを破棄しようとしていますが、それでもリークします。
誰かが私が間違っていることを見ていますか? 私のテストでは、100 回続けて呼び出すと、私の小さなドメインでは、メモリ フットプリントが 32MB から 150MB 以上になりました。
private void EnumGroups()
{
try
{
using (PrincipalContext context = new PrincipalContext(ContextType.Domain, "domainname.com"))
{
using (PrincipalSearcher srch = new PrincipalSearcher())
{
srch.QueryFilter = new UserPrincipal(context);
// do the search
using (PrincipalSearchResult<Principal> results = srch.FindAll())
{
// enumerate over results
foreach (UserPrincipal up in results)
{
using (PrincipalSearchResult<Principal> groups = up.GetGroups())
{
foreach (GroupPrincipal gp in groups)
gp.Dispose();
}
up.Dispose();
}
}
}
}
}
catch (Exception exc)
{
Trace.WriteLine(exc);
}
}