Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Thu, 5 Jun 2008 13:59:00 -0700,    group: microsoft.public.win32.programmer.wmi        back       


WMI Win32_process create memory limitation   
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: Thu, 5 Jun 2008 13:59:00 -0700   author:   jothaxe

RE: WMI Win32_process create memory limitation   
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: Thu, 5 Jun 2008 14:49:00 -0700   author:   jothaxe

RE: WMI Win32_process create memory limitation   
"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: Wed, 6 Aug 2008 01:10:01 -0700   author:   Nerik

RE: WMI Win32_process create memory limitation   
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: Wed, 6 Aug 2008 01:13:00 -0700   author:   Nerik

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

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us