By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,677 Members | 1,188 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,677 IT Pros & Developers. It's quick & easy.

Hang in Dispose with ActiveX control

P: n/a
Banging my head against the wall trying to figure this out. I have a
'sometimes' hang while disposing a form which contains an ActiveX
control (Flash.ocx version 7). The form's Dispose() method generated by
the form designer

protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

However, it never puts anything in 'components'. Anyway, the hang is
inside the base.Dispose
mscorlib.dll!System.GC.GetTotalMemory(bool forceFullCollection = true) + 0x23 bytes


system.windows.forms.dll!System.Windows.Forms.Appl ication.CollectAllGarbage()
+ 0xd bytes

system.windows.forms.dll!System.Windows.Forms.AxHo st.ReleaseAxControl()
+ 0x2a6 bytes

system.windows.forms.dll!System.Windows.Forms.AxHo st.TransitionDownTo(int
state = 0) + 0x151 bytes

system.windows.forms.dll!System.Windows.Forms.AxHo st.DisposeAxControls()
+ 0x30 bytes

system.windows.forms.dll!System.Windows.Forms.Cont rol.DisposeAxControls()
+ 0x54 bytes
system.windows.forms.dll!System.Windows.Forms.Cont rol.Dispose(bool
disposing = true) + 0x1ce bytes

system.windows.forms.dll!System.Windows.Forms.Cont ainerControl.Dispose(bool
disposing = true) + 0x2b bytes
system.windows.forms.dll!System.Windows.Forms.Form .Dispose(bool
disposing = true) + 0x2b0 bytes
TestDisposeAx.exe!TestDisposeAx.Form2.Dispose(bool disposing = true)
Line 48 C#
The stack trace leaves me with several questions.
1. GetTotalMemory(true). One reference says this will call garbage
collection repeatedly until memory usage stabilizes within 5% - which
sounds like it blocks some indefinite period of time. Other references
say this just means it might wait 'a short time'.
2. Why would ReleaseAxControl call CollectAllGarbage??
3. Why, after I try Controls.Remove(player), does that base.Dispose()
still wind up down in ReleaseAxControl?
4. And of course, what could be blocking that GetTotalMemory? All other
threads which I can see are merely waiting for an event. The form and
the player were created on that main thread, the same one making the
dispose call. I'm not aware that we've coded any of our own finalizers
anywhere.

It doesn't always hang. I do have a repeatable way to get my whole app
to hang, and a repeatable way where it doesn't hang, but at the point
of the call to dispose they aren't any different! My only guess as to
why that would happen is that one way churns more memory than the
other, maybe forces more garbage collections or something.

For reference, we are stuck back on 1.1 and I have little hope of being
able to change that any time soon.

Any suggestions?

May 4 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.