Niall,
If you want the control to be collected, you'll need to sever all
references to it. In this case, unbinding it. Although not required, the
Dispose method is the recommended place for this.
This isn't a memory leak in the Framework. The developer must put in the
unbinding code, so that when Dispose gets called, the object is cleaned up.
-Chris
--------------------
>From: "Niall" <asdf@me.com>
>Subject: Clear bindings on dispose of a control to allow GC to collect?
[quoted text clipped - 6 lines]
>Message-ID: <#Ber46cQDHA.1072@TK2MSFTNGP10.phx.gbl>
>Newsgroups:
microsoft.public.dotnet.framework.clr,microsoft.public.dotnet.framework.wind
owsforms.databinding
>NNTP-Posting-Host: 64.215.221.9
>Path: cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
>Xref: cpmsftngxa09.phx.gbl
microsoft.public.dotnet.framework.windowsforms.databinding:1157
microsoft.public.dotnet.framework.clr:1332
>X-Tomcat-NG: microsoft.public.dotnet.framework.clr
>
[quoted text clipped - 20 lines]
>
>Niall

Signature
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
Niall - 31 Jul 2003 00:49 GMT
Chris,
Thank you for your reply. The reason why I asked is that while memory
profiling, I have discovered a few times references to our objects being
held by static hashtables in the Framework. Sometimes it's not clear to know
exactly what responsibilities you have when cleaning up your object in these
cases, because you're not aware there is even a reference being held from a
static object until you run a memory profile and see your object being
referenced from within the framework. I've had a similar case where
MenuItems were being cached in a static hashtable in the Framework...
Are these kind of things documented? I haven't seen anything before your
post which said I had to make sure I cleared the bindings as the control was
being disposed.
Thanks,
Niall
> Niall,
>
[quoted text clipped - 18 lines]
> >Message-ID: <#Ber46cQDHA.1072@TK2MSFTNGP10.phx.gbl>
> >Newsgroups:
microsoft.public.dotnet.framework.clr,microsoft.public.dotnet.framework.wind
> owsforms.databinding
> >NNTP-Posting-Host: 64.215.221.9
[quoted text clipped - 29 lines]
> >
> >Niall