|
|
|
date: Thu, 5 Jun 2008 13:59:00 -0700,
group: microsoft.public.win32.programmer.wmi
back
RE: WMI Win32_process create memory limitation
Here is what I ended up using:
UInt64 RAMcount=GetTotalPhysicalMemoryBytes(IP, co);
int updated = 0;
//***********************************************
//In order not to crash WMI, use [0.1]GB less than the max
available on the machine!
UInt64 maxmemallprocess = (UInt64)(RAMcount-(0.1*1024*1024*1024));
//In order not to crash WMI, use [1.6]GB per process. Larger
might be possible but 2.0GB causes a crash!
UInt64 maxmemperprocess = 1717986918;
//***********************************************
//ManagementScope ms = new ManagementScope(@"\\" + IP +
@"\root", co);
ManagementScope ms = new ManagementScope(@"\\" + IP + @"\root",
co);
//ManagementScope ms = new ManagementScope(@"\\" + IP +
@"\root\CIMV2", co);
ms.Connect();
ObjectQuery oq = new ObjectQuery("SELECT * FROM
__ProviderHostQuotaConfiguration");
ManagementObjectSearcher mos = new ManagementObjectSearcher(ms,
oq);
ManagementObjectCollection moc = mos.Get();
//string info = "";
foreach (ManagementObject m in moc)
{
m.Get();
PropertyDataCollection pdc = m.Properties;
foreach (PropertyData pd in pdc)
{
string pdname=pd.Name;
string pdvalue = pd.Value.ToString();
if (pdname == "MemoryPerHost")
{
pd.Value = maxmemperprocess;
updated++;
}
if (pdname == "MemoryAllHosts")
{
pd.Value = maxmemallprocess;
updated++;
}
}
if (updated == 2)
m.Put();
//info += ShowProperties(m) + "\r\n";
}
bool success = false;
if (updated == 2) success = true;
return (success);
"Nerik" wrote:
> It is fine to know that we can enlarge allocated memory to a WMI created
> Process with __ProviderHostQuotaConfiguration , but does any one has piece of
> .NET (C#) code as sample ?
> Thanks.
>
> "jothaxe" wrote:
>
> > After some searching, it seems to be a setting for WMI on the server that can
> > be found here:
> >
> > __ProviderHostQuotaConfiguration Class
> >
> > http://msdn.microsoft.com/en-us/library/aa394671(VS.85).aspx
> >
> > "jothaxe" wrote:
> >
> > > When I use WMI to launch a piece of code remotely on a server I am running
> > > into a memory limitation of just over 100MB. After my code allocates more
> > > than 100MB of RAM the System.OutOfMemoryException is thrown.
> > >
> > > This is odd because when I run the same piece of code locally on that same
> > > server (remote desktop) I am able to allocate approximately 1700MB or RAM
> > > before throwing the same exception!
> > >
> > > Note that the executed code is written in C# and running on the .NET
> > > framework 2.0. I am launching the process using the WMI Win32_Process create
> > > method in code written in C# also (System.Management class.)
> > >
> > > Is this supposed to be happening, or is it a bug? How can I work around
> > > this limitation so that I can use more than 100MB of RAM when the process is
> > > launched programatically?
date: Tue, 2 Sep 2008 14:32:01 -0700
author: jothaxe
|
|