Click here to Skip to main content
15,907,328 members
Home / Discussions / C#
   

C#

 
AnswerRe: OutOfMemory exception Pin
Ravi Bhavnani22-Feb-07 7:28
professionalRavi Bhavnani22-Feb-07 7:28 
GeneralRe: OutOfMemory exception Pin
Saira Tanwir22-Feb-07 7:30
Saira Tanwir22-Feb-07 7:30 
GeneralRe: OutOfMemory exception Pin
Ravi Bhavnani22-Feb-07 7:34
professionalRavi Bhavnani22-Feb-07 7:34 
GeneralRe: OutOfMemory exception Pin
Saira Tanwir22-Feb-07 7:40
Saira Tanwir22-Feb-07 7:40 
AnswerRe: OutOfMemory exception Pin
Luc Pattyn22-Feb-07 7:37
sitebuilderLuc Pattyn22-Feb-07 7:37 
GeneralRe: OutOfMemory exception Pin
Saira Tanwir22-Feb-07 7:44
Saira Tanwir22-Feb-07 7:44 
GeneralRe: OutOfMemory exception Pin
Luc Pattyn22-Feb-07 8:15
sitebuilderLuc Pattyn22-Feb-07 8:15 
GeneralRe: OutOfMemory exception Pin
Dave Kreskowiak22-Feb-07 9:00
mveDave Kreskowiak22-Feb-07 9:00 
You've been using various object and not disposing of them properly when you're done. You can get the OutOfMemory exception when the Windows handle pool is exhausted. Restart your machine and it'll clear itself up.

Checking for handle leaks is pretty easy. Open TaskManager (Ctrl-Shift-Esc) and click on the Processes tab. Click the View menu and Select Columns... Turn on the Handle Count option and click OK.

Now, widen up the Task Manager window so you can see the Handles column. Start your application and find it in the Task Manager Processes window. Look at the handle count. Exercise your application. Do everything you can in it, repeatedly, and watch the Handles count. If it just keeps climbing, your app is allocating various unmanaged resources, like window handles, brushes, pens, fonts, file handles, graphics object, ... and not freeing them properly when your code is done using them. This will eventually lead to the OutOfMemory exception that you got.

A code review is in order. Any graphics-oriented object must be Disposed when your done using it. Any forms displayed with a call to .ShowDialog() must be Disposed. Any file object you use must be Disposed. The list goes on, but those are the most common problems...


Dave Kreskowiak
Microsoft MVP - Visual Basic


AnswerRe: OutOfMemory exception Pin
malharone22-Feb-07 7:51
malharone22-Feb-07 7:51 
Answer[Message Deleted] Pin
Saira Tanwir22-Feb-07 7:55
Saira Tanwir22-Feb-07 7:55 
GeneralRe: OutOfMemory exception Pin
Luc Pattyn22-Feb-07 8:14
sitebuilderLuc Pattyn22-Feb-07 8:14 
GeneralRe: OutOfMemory exception Pin
Saira Tanwir22-Feb-07 8:23
Saira Tanwir22-Feb-07 8:23 
GeneralRe: OutOfMemory exception Pin
malharone22-Feb-07 8:15
malharone22-Feb-07 8:15 
GeneralRe: OutOfMemory exception Pin
Saira Tanwir22-Feb-07 8:20
Saira Tanwir22-Feb-07 8:20 
QuestionAsymmetric Encryption of File Pin
Vasudevan Deepak Kumar22-Feb-07 7:07
Vasudevan Deepak Kumar22-Feb-07 7:07 
QuestionWebBrowser Control Pin
zaboboa22-Feb-07 6:22
zaboboa22-Feb-07 6:22 
AnswerRe: WebBrowser Control Pin
Ravi Bhavnani22-Feb-07 6:32
professionalRavi Bhavnani22-Feb-07 6:32 
GeneralRe: WebBrowser Control Pin
zaboboa22-Feb-07 7:16
zaboboa22-Feb-07 7:16 
GeneralRe: WebBrowser Control Pin
Ravi Bhavnani22-Feb-07 7:27
professionalRavi Bhavnani22-Feb-07 7:27 
GeneralRe: WebBrowser Control Pin
zaboboa22-Feb-07 7:32
zaboboa22-Feb-07 7:32 
GeneralRe: WebBrowser Control Pin
Ravi Bhavnani22-Feb-07 7:38
professionalRavi Bhavnani22-Feb-07 7:38 
QuestionDataTableReader is invalid for current DataTable Pin
bemahesh22-Feb-07 5:50
bemahesh22-Feb-07 5:50 
QuestionBig html string. How to store them? [modified] Pin
Scripter4722-Feb-07 5:28
Scripter4722-Feb-07 5:28 
AnswerRe: Big html string. How to store them? Pin
Ravi Bhavnani22-Feb-07 6:32
professionalRavi Bhavnani22-Feb-07 6:32 
GeneralRe: Big html string. How to store them? Pin
Scripter4722-Feb-07 7:22
Scripter4722-Feb-07 7:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.