469,963 Members | 1,344 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

Releasing Resources

1
Hi All,
Thank you in advance. I am having trouble releasing resources when I open a child form. Please see the code below.
Expand|Select|Wrap|Line Numbers
  1. Form f;
  2. private void button1_Click(object sender, EventArgs e)
  3. {
  4.     f = new Form2();
  5.     f.FormClosed += new FormClosedEventHandler(childForm_FormClosed);
  6.     f.Show();
  7. }
  8.  
  9. private void childForm_FormClosed(object sender, FormClosedEventArgs e)
  10. {
  11.     f.Dispose();
  12.     f = null;
  13. }
  14.  
  15.  
When I use ANTS profiler, it appears references to form2 are still active after I close form2. The live object count goes down but not as much as I would expect. The type of objects that are "living" are things like decimal, string, size, color, ..... Even if I force a GC they are "live".

Am I missing something here.

Thanks again.
Jan 2 '08 #1
0 760

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by lebo | last post: by
7 posts views Thread by trialproduct2004 | last post: by
5 posts views Thread by Michael Tissington | last post: by
reply views Thread by Naved Ahmed | last post: by
2 posts views Thread by Pete Smith | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.