EDN Admin
Well-known member
I have a C# console application. this is pertaining to AD. the purpose
of the application is to display the child objects inside a container.
the container has around 50000 objects.
i get the details of the container using the DirectoryEntry class. the
dirEntry.Children gives the details of the children inside the
container.
the program snippet is as follows.
AD_Display.cs with System.DirectoryServices added as a reference
namespace AD_Display
{
Class program
{
[STAThread]
Static void Main(string []args)
{
DirectoryEntry
dirEntry = new
DirectoryEntry(“LDAP://localhost/CN=xyz,DC=<domain>,DC=com”);
foreach (DirectoryEntry childEntry in dirEntry.Children)
{
Console.WriteLine(childEntry.Properties[“distinguishedName”][0]);
}
}
}
}
If we do not specify [STAThread], no memory build-up happens. But if we
specify [STAThread], a huge memory build-up happens as the loop is
getting executed.
so the question is
1. what is the relevance of STAThread?
2. why is it that we see a huge memory build-up when we use STAThread?
3. when do we have to use STAThread?
4. what are the performance issues that we might see if we remove STAThread?
Looking forward to the reply
View the full article
of the application is to display the child objects inside a container.
the container has around 50000 objects.
i get the details of the container using the DirectoryEntry class. the
dirEntry.Children gives the details of the children inside the
container.
the program snippet is as follows.
AD_Display.cs with System.DirectoryServices added as a reference
namespace AD_Display
{
Class program
{
[STAThread]
Static void Main(string []args)
{
DirectoryEntry
dirEntry = new
DirectoryEntry(“LDAP://localhost/CN=xyz,DC=<domain>,DC=com”);
foreach (DirectoryEntry childEntry in dirEntry.Children)
{
Console.WriteLine(childEntry.Properties[“distinguishedName”][0]);
}
}
}
}
If we do not specify [STAThread], no memory build-up happens. But if we
specify [STAThread], a huge memory build-up happens as the loop is
getting executed.
so the question is
1. what is the relevance of STAThread?
2. why is it that we see a huge memory build-up when we use STAThread?
3. when do we have to use STAThread?
4. what are the performance issues that we might see if we remove STAThread?
Looking forward to the reply
View the full article