Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
1.00/5 (1 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.

Thanks
Posted

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.
 
Share this answer
 
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900