I saw the fix below in one of the MIcrosoft articles for MainMenu (they
apparently can also have the same memory leak problems as Context Menus so I
would assume this fix would also apply them them as well but not sure)
For any forms that have MainMenu components, add the following code to make
sure the components are disposed of correctly:
Protected Override Sub Dispose(disposing as boolean)
If disposing
If not components is Nothing
components.Dispose()
components = Nothing
If not mainMenu1 is Nothing
‘Code to add
mainMenu1.Dispose()
mainMenu1 = Nothing
base.Dispose(disposing)
End If
End If
End If
--
Dennis in Houston
"Boni" wrote:
[color=blue]
> The 3-d party provider is Microsoft :). I am speeking about a memory leak
> when I create a context menue items dynamically
> (
http://weblogs.asp.net/pwilson/archi...20/77451.aspx). They are not
> disposed until the form is disposed.
> It is documented bug and there is a workaround for that (using reflection).
> But in general, somehow I don't see the reason of garbadge collection.
> Before I started with it I was sure that it completely solve all memory leak
> problems. But it seems, that it creates a new class of memory leak problems,
> where you must think very much about all your references. And even then
> there is no insurance that something went wrong because of 3-d party bugs.
> I mean, .NET is a perfect libruary, easy to use. But the memory leak problem
> should be revised once more. Currently there is even no appropriate software
> which can automatically check those bug's (a-la bounds checker). For me
> there was no problem to kill all created objects myself in c++. There are
> coding guidlines and problem is quite managable. But in .NET I spend all my
> time by looking for memory leaks, it is even more time then debugging. And I
> am still not sure, when the debug level is acceptable.
> Is it only my problem or all of you have it too?
>
>
>
> "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> schrieb im Newsbeitrag
> news:u4L9Zzt6FHA.3752@tk2msftngp13.phx.gbl...[color=green]
> > "Boni" <oilia@nospam> wrote in message
> > news:%23rqn3wt6FHA.3048@TK2MSFTNGP10.phx.gbl...[color=darkred]
> >>I use 3-d party component. In this component I must pass a reference to my
> >>object. The problem is that this component has an ugly bug.When this
> >>component is disposed, it incorrectly don't delete the reference to my
> >>object from one of its shared lists.And since the operation repeats many
> >>times the leak is huge.
> >> Is there a way to kill my object anyway?
> >> Thanks a lot,
> >> Boni[/color]
> >
> > You should contact that 3rd party provider.... have you tried passing a
> > reference to Nothing? Depending on how that 3rd party component works,
> > passing a ref to Nothing may clear the circular dependency.... then again,
> > it may raise an error (which you should be able to trap)
> >
> > --
> > Ken Halter - MS-MVP-VB (visiting from VB6 world) -
http://www.vbsight.com
> > Please keep all discussions in the groups..
> >[/color]
>
>
>[/color]