Click here to Skip to main content
15,882,055 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionWorks but any known memory leak? Pin
nlarson1128-Nov-07 9:21
nlarson1128-Nov-07 9:21 
AnswerRe: Works but any known memory leak? Pin
Luc Pattyn28-Nov-07 9:28
sitebuilderLuc Pattyn28-Nov-07 9:28 
GeneralRe: Works but any known memory leak? Pin
nlarson1128-Nov-07 9:30
nlarson1128-Nov-07 9:30 
GeneralRe: Works but any known memory leak? Pin
Luc Pattyn28-Nov-07 9:55
sitebuilderLuc Pattyn28-Nov-07 9:55 
AnswerRe: Works but any known memory leak? Pin
Christian Graus28-Nov-07 9:30
protectorChristian Graus28-Nov-07 9:30 
GeneralRe: Works but any known memory leak? Pin
nlarson1128-Nov-07 9:35
nlarson1128-Nov-07 9:35 
GeneralRe: Works but any known memory leak? Pin
Luc Pattyn28-Nov-07 9:43
sitebuilderLuc Pattyn28-Nov-07 9:43 
AnswerRe: Works but any known memory leak? Pin
sgorozco28-Nov-07 10:30
sgorozco28-Nov-07 10:30 
Hi Nathan,

There's no memory leak in your code. After your code leaves the With block, there are no live references to the Form1 instance, so eventually the garbage collector will kick-in and release both memory & native windows resources associated with the form (.net forms and controls are actually wrappers of native windows resources).

When this collection actually happens, is not under your control, unless you call GC.Collect(); however this is not something recommended since it prevents the garbage collector to self-tune adequately to your application's memory consumption rate - in simpler words - even though by calling GC.Collect() all "releasable" memory is reclaimed and released *at your request*, this is a very expensive operation and in the end you might hurt your application's performance very badly.

However, I would suggest calling .Dispose() before leaving the with block. This way you will be releasing the form's wrapped native windows resources early (something advisable since windows resources are limited). Keep in mind that even if you call Dispose(), the memory held by the Form1 instance will not be freed until the garbage collector runs and reclaims it.

Sincererly I hope I have clarified your doubt and not confused you more. Laugh | :laugh:

Gerardo

GeneralRe: Works but any known memory leak? Pin
nlarson1128-Nov-07 10:41
nlarson1128-Nov-07 10:41 
QuestionCommandbutton blink in VB 2005 Pin
DCAUB28-Nov-07 8:56
DCAUB28-Nov-07 8:56 
AnswerRe: Commandbutton blink in VB 2005 Pin
nlarson1128-Nov-07 9:05
nlarson1128-Nov-07 9:05 
AnswerRe: Commandbutton blink in VB 2005 Pin
Paul Conrad28-Nov-07 12:34
professionalPaul Conrad28-Nov-07 12:34 
QuestionChart in Visual Basic 6 Pin
leaveu28-Nov-07 8:34
leaveu28-Nov-07 8:34 
AnswerRe: Chart in Visual Basic 6 Pin
Paul Conrad28-Nov-07 12:34
professionalPaul Conrad28-Nov-07 12:34 
QuestionFloor Maps Pin
alexfromto28-Nov-07 8:33
alexfromto28-Nov-07 8:33 
AnswerCross post Pin
pmarfleet28-Nov-07 8:46
pmarfleet28-Nov-07 8:46 
AnswerRe: Floor Maps Pin
pmarfleet28-Nov-07 9:54
pmarfleet28-Nov-07 9:54 
GeneralRe: Floor Maps Pin
alexfromto28-Nov-07 10:01
alexfromto28-Nov-07 10:01 
QuestionMUTEX - TCP Channel - Disconnecting For Unknown Reason [modified] Pin
nlarson1128-Nov-07 8:12
nlarson1128-Nov-07 8:12 
QuestionSaving data before using X to exit form Pin
Wolfpacker28-Nov-07 7:43
Wolfpacker28-Nov-07 7:43 
AnswerRe: Saving data before using X to exit form Pin
Luc Pattyn28-Nov-07 8:01
sitebuilderLuc Pattyn28-Nov-07 8:01 
GeneralRe: Saving data before using X to exit form Pin
Wolfpacker28-Nov-07 8:39
Wolfpacker28-Nov-07 8:39 
GeneralRe: Saving data before using X to exit form Pin
Luc Pattyn28-Nov-07 9:13
sitebuilderLuc Pattyn28-Nov-07 9:13 
QuestionHow do I play audio files in vb.net Pin
Wun'nam28-Nov-07 7:05
Wun'nam28-Nov-07 7:05 
AnswerRe: How do I play audio files in vb.net Pin
Paul Conrad28-Nov-07 12:36
professionalPaul Conrad28-Nov-07 12:36 

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.