OutOfMemoryException when allocation large memory blocks
Dear Softwaredevelopers,
In my application I have to allocate a huge amount of memory but the following C# console programm creates an OutOfMemoryException when I try to allocate memory >512 MB. and I wonder why.
My System:
Intel Core2 Quad CPU 3GB
Windows XP 32-Bit
Visual Studio 2008
available free memory 2.3GB
Can anybody help?
Greetings Christian
using System;
using System.Collections.Generic;
using System.Text;
namespace MemoryAllocation
{
class Program
{
static void Main(string[] args)
{
int size = 2;
while (size > 0)
{
Byte[] b = new Byte[size];
for (int i = 0; i<size; ++i)
b[i] = 13;
size *= 2;
}
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.