Click to See Complete Forum and Search --> : Assembly memory limit exception -WHY?


sharong
August 11th, 2005, 10:56 AM
Hi,

I wrote an .NET application that allocate a large byte array.
If the array is of size 700 MByte, it's ok and no error is thrown.
But when I try to allocate a 800 MByte byte array, an OutOfMemory Exception is thrown.

The PC that this application is running on has a 2 Giga bytes RAM and the free memory is 1.3 Giga bytes when the application was trying to allocate the byte array.
The PC has two disks, both are set to use virtual memory (large one).

It's looks like the system is limiting each assembly to use that much memory.
Is there a way to change this settings to allow a larger amount of memory for each assembly.
If so, How do I do that?


--------
Thanks
Sharon

zips
August 11th, 2005, 02:30 PM
FYI, my 2GB RAM system draws the byte[] line at 679,473,084 bytes - not one byte more. That's not any sort of rounded value in hex.

boudino
August 12th, 2005, 03:22 AM
I think that there is something to configure which tell CLR how much memory can allocate. But before looking for it, I would think about the aplication - it is realy good idea to process plai 700mb byte array in C#? You cannot get good performance which .NET if you have not well designed structured object model.

sharong
August 14th, 2005, 02:10 AM
The out of memory excpetion is not a code problem but a system problem, to fix it I found that the system should be changed. How? well read this: http://www.runuo.com/forum/showthread.php?t=38360

At the MSDN forum I found someone that has the exact probelm: http://msdn.microsoft.com/newsgroups/managed/default.aspx?dg=microsoft.public.dotnet.languages.csharp&mid=d05f7a58-f4f2-4bb4-a43f-0c3b9681dd2b (http://msdn.microsoft.com/newsgroups/managed/default.aspx?dg=microsoft.public.dotnet.languages.csharp&mid=d05f7a58-f4f2-4bb4-a43f-0c3b9681dd2b)