Vakul's .NET Realm

My journey towards .NET World…

  • Details

    Vakuls MCPD Certification Vakuls MCTS Certification Author's Pic



OutOfMemoryException in .NET (on 32 bit)

Posted by Vakul Kumar More on July 29, 2009


When I got an out of memory exception in my early days of programming, I believed that there is no memory for the program or process to use.

Now, when I started using High end PCs with 4 gigabytes of RAM, I am facing the same problem.
I realize now that memory is not the case but the common language runtime(CLR) throws an OutOfMemoryException error if it cannot allocate physical memory or reserve sufficient virtual memory to fulfill allocation request.

I tried to understand two concepts before further going into the explanation, the operating system manages processes, and the operating system manages files on disk.

Each process can access as much as data storage it wants. It asks the operating system to create for it a certain amount of data storage, and the operating system does so.

I understand that even if we have 512 MB of memory of 8 GB when running a 32 bit operating system no one process is going to get more than 2GB of RAM. 

Eric Lippert has written a blog post on “Out Of Memory” Does Not Refer to Physical Memory. Click  here for the blog post.

Robert L. Bogue has written in more detail in his post , What does an OutOfMemoryException in .NET (on 32 bit) really mean? Click here for the post.

Happy Coding !!

Advertisements

One Response to “OutOfMemoryException in .NET (on 32 bit)”

  1. free ebook said

    free ebook…

    […]OutOfMemoryException in .NET (on 32 bit) « Vakul's .NET Realm[…]…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: