Click here to Skip to main content
15,917,953 members
Home / Discussions / C#
   

C#

 
AnswerRe: How reader information directory Pin
senalkan30-May-07 19:46
senalkan30-May-07 19:46 
GeneralRe: How reader information directory Pin
Manoj Kumar Rai30-May-07 21:21
professionalManoj Kumar Rai30-May-07 21:21 
GeneralRe: How reader information directory Pin
senalkan30-May-07 21:33
senalkan30-May-07 21:33 
QuestionDispose doubts Pin
Peterson Luiz30-May-07 4:21
Peterson Luiz30-May-07 4:21 
AnswerRe: Dispose doubts Pin
leppie30-May-07 4:47
leppie30-May-07 4:47 
AnswerRe: Dispose doubts Pin
Martin#30-May-07 5:06
Martin#30-May-07 5:06 
GeneralRe: Dispose doubts Pin
Peterson Luiz30-May-07 6:40
Peterson Luiz30-May-07 6:40 
AnswerRe: Dispose doubts Pin
Martin#30-May-07 8:46
Martin#30-May-07 8:46 
Hello,
peterson@brfree.com.br wrote:
When you say to disconnect a delegate in the dispose method, that includes even the delegates generated by visual studio, like the delegate for a click event of a button?

Good question!
The answer is no!
What you have to worry about is for instance:
You have an Usercontrol.
You have an UserManagementclass which provides an event, lets say "StatusChanged".
At startup you instanciate your management class once. This class will always be in memory till you end the program.
Then your Form will be instanciated with your UserControls on it.
This Usercontrols are getting a reference to this Managementclass in the constructor and connect the event StatusChanged (mymanagementclass.StatusChanged+=...).
In that case your UserControls Dispose method has to implement "mymanagementclass.StatusChanged-=...", otherways there would always be the reference to the Management class and the GC could not free the UserControls memory.
What you also can do to help the GC finding not referenced objects is setting them null after disposing.
In my example you could add "mymanagementclass=null" in the Dispose method of your UserControl.

peterson@brfree.com.br wrote:
And I see a lot of objects listed as undisposed items. That means items that have been collected by the garbage colector whitout beeing properly disposed. This objects are Labels, Buttons, TextBox, Fonts and a few others.
I would also be worried about that!

Looks like you are not Close() complete Forms which are shown with Show(), and always instanciate a new Form.
Is it possible that you are doing so?

Hope it helps!

All the best,

Martin
GeneralRe: Dispose doubts Pin
Peterson Luiz30-May-07 9:25
Peterson Luiz30-May-07 9:25 
AnswerRe: Dispose doubts Pin
Martin#30-May-07 10:17
Martin#30-May-07 10:17 
AnswerRe: Dispose doubts Pin
Jimmanuel30-May-07 6:30
Jimmanuel30-May-07 6:30 
Questionwant to make a folder sharable programatically Pin
devesh_code30-May-07 4:12
devesh_code30-May-07 4:12 
AnswerRe: want to make a folder sharable programatically Pin
Manoj Kumar Rai30-May-07 4:31
professionalManoj Kumar Rai30-May-07 4:31 
QuestionAdvice Pin
wwwlicious30-May-07 4:03
wwwlicious30-May-07 4:03 
AnswerRe: Advice [modified] Pin
Not Active30-May-07 4:12
mentorNot Active30-May-07 4:12 
GeneralRe: Advice Pin
wwwlicious30-May-07 4:32
wwwlicious30-May-07 4:32 
GeneralRe: Advice Pin
Manoj Kumar Rai30-May-07 4:48
professionalManoj Kumar Rai30-May-07 4:48 
QuestionRe: Advice Pin
wwwlicious30-May-07 5:03
wwwlicious30-May-07 5:03 
AnswerRe: Advice Pin
Manoj Kumar Rai30-May-07 5:19
professionalManoj Kumar Rai30-May-07 5:19 
GeneralRe: Advice Pin
wwwlicious30-May-07 6:00
wwwlicious30-May-07 6:00 
GeneralRe: Advice Pin
Not Active30-May-07 9:37
mentorNot Active30-May-07 9:37 
GeneralRe: Advice Pin
wwwlicious30-May-07 22:37
wwwlicious30-May-07 22:37 
GeneralRe: Advice Pin
Not Active31-May-07 2:06
mentorNot Active31-May-07 2:06 
AnswerRe: Advice Pin
wwwlicious31-May-07 2:58
wwwlicious31-May-07 2:58 
Questionreading elements of xml Pin
saqib8230-May-07 3:22
saqib8230-May-07 3: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.