Release Memory

Hi all,

suppose I use some dialog object to give user the option to create and adjust some parameter-object. This object is created by that dialog in the load-event and adjusted by various buttons and input boxes.

When dialog is closed that object is used in further code logic.
[code]
someObject x = null;
someDlg dlg = new someDlg( someParameters );
if( dlg.ShowDialog() == DialogResult.OK )
{
x = dlg.SomeObj;
}
[/code]
now that x is referencing the dialog object, what happens to the memory allocated by dialog and all it

Comments

  • The variable x will go out of scope, and then nothing will be referring to the dialog box object. The next time the garbage collector runs, it will find that it is unused and free the memory automatically for you. You don't need to worry about explicit memory deallocation in C#.

    Jonathan
    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
  • Thanks,

    the sample is of course not complete, x is pointing to the dialog.object but is part of some other object. So what I
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories