Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
1.00/5 (5 votes)
See more:
Hi,

I am getting an Out of memory exception in C# coding. How to handle it?
Posted
Comments
[no name] 26-Jul-13 11:31am    
code? LOL
wolfmanncsu2000 26-Jul-13 11:32am    
Have you run the code through a debugger? Do you have a stack trace or anything to share?

This is not enough information.
Ron Beyer 26-Jul-13 11:43am    
You are going to have to post some code where it is happening and the code that is using the memory. There are a thousand things that could be going on and two thousand ways to fix it, but without seeing what you are doing we can't help. Use the Improve Question link to add some code.
ridoy 26-Jul-13 12:53pm    
where is your code?

1 solution

It depends on what you are doing at the time - there are so many things that could cause it, from a recursive function that doesn't end, to trying to load an HTML file as an image.

So use the debugger: look on the menu under "Debug" and you will see "Exceptions".
In the dialog this brings up, make sure there is a tick in every box under both "Thrown" and "USer Unhandled" columns.
Press OK, then run your code through the debugger. When the problem happens, the code will stop executing and show you which line it happened on.
You should be able to use that and the Call Stack pane to isolate 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