Click here to Skip to main content
13,250,453 members (52,534 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi ,

I am getting an exception in C# " System.outOfMemory Exception".

Is there is any way to overcome these Exceptiom?

Please help.

Posted 5-Nov-12 7:13am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you are getting into an infinite loop of some kind, you could get rid of this error by fixing this loop.
Also look at other aspects of code, example, large image size etc that you might be working with.

If its a genuine memory issue, then increasing the memory of the system might be one way (although not guaranteed way) to fix the problem.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You've not enough memory to do your operation.
I think you do something with large arrays.
You can try to:

  1. Set objects to null if you don't longer need them.
  2. Try what you do with a smaller array! It's possible that you don't need a large array.
  3. If you've array with a large datatype, try a smaller datatype. If you've an array with longs, try it also with integers. If it doesn't work with integers, then you need to create long. Try to choose the smallest datatype!

Hope this helps.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 5 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100