C
cs
if I repeatedly call the following method on my winxp machine (and many
others) the svchost.exe process increases its memory very very quickly, and
doesnt go back donw, I have machines that after a day have svchosts taking 1
gig of ram, thank god I have 3 more to spare!
public static void GetNetworkProperties(String NetConnectionID)
{
try
{
SelectQuery sq = new SelectQuery("select * from Win32_NetworkAdapter where
NetConnectionID=\""+NetConnectionID+"\"");
ManagementObjectSearcher mos = new ManagementObjectSearcher(sq);
foreach(ManagementObject mo in mos.Get())
{
foreach(PropertyData data in mo.Properties)
{
if(data.Name.Equals("Index"))
{
ManagementObjectSearcher query1 = new ManagementObjectSearcher("SELECT
DefaultIPGateway,IPAddress,DNSServerSearchOrder,DHCPEnabled,IPSubnet,MACAddr
ess FROM Win32_NetworkAdapterConfiguration where Index="+data.Value);
ManagementObjectCollection queryCollection = query1.Get();
String[] ips = null;
String[] dns = null;
bool dhcp = false;
String[] subnet = null;
String mac = null;
String[] gateway = null;
foreach(ManagementObject adapter in queryCollection)
{
foreach(PropertyData prop in adapter.Properties)
{
switch(prop.Name)
{
case "IPAddress":
if ( prop.Value != null)
{
ips = (String[])prop.Value;
}
break;
case "DNSServerSearchOrder":
if ( prop.Value != null)
{
dns = (String[])prop.Value;
}
break;
case "DHCPEnabled":
if ( prop.Value != null)
{
dhcp = Convert.ToBoolean(prop.Value);
}
break;
case "IPSubnet":
if ( prop.Value != null)
{
subnet = (String[])prop.Value;
}
break;
case "MACAddress":
if ( prop.Value != null)
mac = prop.Value.ToString();
break;
case "DefaultIPGateway":
if ( prop.Value != null)
{
gateway = (String[])prop.Value;
}
break;
}
}
}
}
}
}
}
catch(Exception exe)
{
}
}
others) the svchost.exe process increases its memory very very quickly, and
doesnt go back donw, I have machines that after a day have svchosts taking 1
gig of ram, thank god I have 3 more to spare!
public static void GetNetworkProperties(String NetConnectionID)
{
try
{
SelectQuery sq = new SelectQuery("select * from Win32_NetworkAdapter where
NetConnectionID=\""+NetConnectionID+"\"");
ManagementObjectSearcher mos = new ManagementObjectSearcher(sq);
foreach(ManagementObject mo in mos.Get())
{
foreach(PropertyData data in mo.Properties)
{
if(data.Name.Equals("Index"))
{
ManagementObjectSearcher query1 = new ManagementObjectSearcher("SELECT
DefaultIPGateway,IPAddress,DNSServerSearchOrder,DHCPEnabled,IPSubnet,MACAddr
ess FROM Win32_NetworkAdapterConfiguration where Index="+data.Value);
ManagementObjectCollection queryCollection = query1.Get();
String[] ips = null;
String[] dns = null;
bool dhcp = false;
String[] subnet = null;
String mac = null;
String[] gateway = null;
foreach(ManagementObject adapter in queryCollection)
{
foreach(PropertyData prop in adapter.Properties)
{
switch(prop.Name)
{
case "IPAddress":
if ( prop.Value != null)
{
ips = (String[])prop.Value;
}
break;
case "DNSServerSearchOrder":
if ( prop.Value != null)
{
dns = (String[])prop.Value;
}
break;
case "DHCPEnabled":
if ( prop.Value != null)
{
dhcp = Convert.ToBoolean(prop.Value);
}
break;
case "IPSubnet":
if ( prop.Value != null)
{
subnet = (String[])prop.Value;
}
break;
case "MACAddress":
if ( prop.Value != null)
mac = prop.Value.ToString();
break;
case "DefaultIPGateway":
if ( prop.Value != null)
{
gateway = (String[])prop.Value;
}
break;
}
}
}
}
}
}
}
catch(Exception exe)
{
}
}