Memory issue, process termineted

by prakashdehury@gmail.com on 10/31/2007 7:04:00 PM Hi,


I have a c# console exe
Based on input it consumes arround 1-3 gb of memory
I am trying to run it on win2003 box with 8GB of ram.

Once the consumed memory goes beyound 1 GM the process get termonated.
Am not sure if it is terminated by OS or by something security
settings of .Net.

Can anybody suggest what could be the reason.

Thanks in advance.
Dev

 

Re: Memory issue, process termineted

by Marc Gravell on 10/31/2007 7:13:00 PM Well, there is a 2GB limit on the size of a process in Win32. You can
up this slightly using the /3GB switch
http://blogs.msdn.com/oldnewthing/archive/2004/08/13/214117.aspx

However, another big issue is what you memory looks like inside the
process - i.e. are you trying to allocate huge arrays? If so,
fragmentation will be a major issue, that could trigger an
OutOfMemoryException, presumably crashing your app.

Another consideration is: are you using your memory effectively? Hard
to tell without a /lot/ of info, though.

You could switch to Win64, but note that this changes the equation;
each reference has a larger footprint. If you have a huge array of
structs this is probably fine. If you have a huge array of objects (or
just a lot of references generally) your memory consumption will jump
yet further. But the process will have more space, so it is a double-
edged sword.

Marc

 

Re: Memory issue, process termineted

by Marc Gravell on 10/31/2007 7:16:00 PM Oh, and you'd need to tweak the exe; Willy explains it here:

http://www.thescripts.com/forum/thread275030.html

 

Re: Memory issue, process termineted

by Marc Gravell on 10/31/2007 7:24:00 PM Another discussion, again with Willy Denoyette at the helm:
http://www.thescripts.com/forum/thread586209.html

 

Re: Memory issue, process termineted

by Willy Denoyette [MVP] on 11/1/2007 11:29:00 AM <prakashdehury@gmail.com> wrote in message
news:1193907858.269296.173110@t8g2000prg.googlegroups.com...
> Hi,
>
>
> I have a c# console exe
> Based on input it consumes arround 1-3 gb of memory
> I am trying to run it on win2003 box with 8GB of ram.
>
> Once the consumed memory goes beyound 1 GM the process get termonated.
> Am not sure if it is terminated by OS or by something security
> settings of .Net.
>
> Can anybody suggest what could be the reason.
>
> Thanks in advance.
> Dev
>


Seems like you are running on W2K3 32 bit, that means that the maximum
amount of memory available to a process is ~2GB. The largest contiguous area
of free memory in such process space is ~1.5GB, so whenever you try to
allocate an array of that size you are at risk to get an out-of-memory
exception thrown on you.
The question is why do you allocate that much memory, in the first place?

Willy.


 

Re: Memory issue, process termineted

by Marc Gravell on 10/31/2007 7:56:00 PM For the OP's benefit - note also that the CLR places a 2GB limit on a
single object, which again limits the size of (for example) huge
arrays. And for an array of object-references (not structs) note that
of course the maximum number of items will shrink as the size of each
reference goes up (using 64bit over 32bit). But in most cases these
limits [process and object] are purely academic - it is quite rare for
an app to need more than this.

Marc

 

Re: Memory issue, process termineted

by Willy Denoyette [MVP] on 11/1/2007 2:34:00 PM "Marc Gravell" <marc.gravell@gmail.com> wrote in message
news:1193910938.102755.157610@v3g2000hsg.googlegroups.com...
> For the OP's benefit - note also that the CLR places a 2GB limit on a
> single object, which again limits the size of (for example) huge
> arrays. And for an array of object-references (not structs) note that
> of course the maximum number of items will shrink as the size of each
> reference goes up (using 64bit over 32bit). But in most cases these
> limits [process and object] are purely academic - it is quite rare for
> an app to need more than this.
>
> Marc
>


Absolutely, note that the object size limit is also applicable on 64-bit
Windows, and even with the extremely large VAS on 64-bit, one can run into
OOM exceptions. You can never allocate more memory than the available free
virtual memory space (free RAM space + free pagefile space).

Willy.

 

Re: Memory issue, process termineted

by Ignacio Machin ( .NET/ C# MVP ) on 11/1/2007 7:03:00 AM Hi,


What are you trying to do?



--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
<prakashdehury@gmail.com> wrote in message
news:1193907858.269296.173110@t8g2000prg.googlegroups.com...
> Hi,
>
>
> I have a c# console exe
> Based on input it consumes arround 1-3 gb of memory
> I am trying to run it on win2003 box with 8GB of ram.
>
> Once the consumed memory goes beyound 1 GM the process get termonated.
> Am not sure if it is terminated by OS or by something security
> settings of .Net.
>
> Can anybody suggest what could be the reason.
>
> Thanks in advance.
> Dev
>