|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
activeX doesn't disposeHere at work they've got an activeX control which is used on a usercontrol, and this usercontrol is one of the standard controls in the framework, so this user controls get's used a lot on other usercontrols or windows forms. But the problem is the activex control doesn't get disposed. (profiled the app with scitech .net memory profiler 2.5) I added this code to disposing event of the base usercontrol (the one in the framework which contains the activeX): 'Grid is the name of the activeX control 'Toegevoeg door Peter 31/03/2005 If Not Grid Is Nothing Then Grid.Dispose() End If 'einde toevoeging but that doesn't help, I also tried it in the usercontrol's finalize method but also no success. But if I create a sub in the usercontrol: Public sub MyDispose If Not Grid Is Nothing Then Grid.Dispose() End If End sub and then in the form's closing event of the form that hosts the usercontrol call myusercontrol.Mydispose the activex control get's disposed and releases it's memory. But now my question is isn't there a way so I can dispose the activeX control on the usercontrol from within the user control without the extra sub. Greetz Peter Hi,
thnx for the answer but I've always read/heard that you shouldn't use gc.collect, except for in some special cases, is this one of them? Because the form containing the usercontrol get's opened and closed a lot so gc.collect would get executed a lot and doesn't this tend to mess up the gc? Or have I miss understand you? Greetz Peter Show quoteHide quote "Crouchie1998" <crouchie1***@discussions.microsoft.com> schreef in bericht news:Ot#2yheNFHA.1176@TK2MSFTNGP15.phx.gbl... > Use Garbage Collection (GC) > > Peter,
I have no answer, however maybe you can find it on this page. At the bottom. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemidisposableclasstopic.asp I hope this helps, Cor Hi Cor,
thanks for the link Greetz Peter "Cor Ligthert" <notmyfirstn***@planet.nl> schreef in bericht http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/news:#jXJLreNFHA.3420@tk2msftngp13.phx.gbl... > Peter, > > I have no answer, however maybe you can find it on this page. At the bottom. > frlrfsystemidisposableclasstopic.asp Show quoteHide quote > > I hope this helps, > > Cor > > But I forget to mention, it was interesting but it didn't help me out :-)
so I'm still puzzling Greetz Peter Show quoteHide quote "Peter Proost" <pproost@nospam.hotmail.com> schreef in bericht http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/news:eUz8y5eNFHA.3328@TK2MSFTNGP14.phx.gbl... > Hi Cor, > > thanks for the link > > Greetz Peter > > "Cor Ligthert" <notmyfirstn***@planet.nl> schreef in bericht > news:#jXJLreNFHA.3420@tk2msftngp13.phx.gbl... > > Peter, > > > > I have no answer, however maybe you can find it on this page. At the > bottom. > > > Show quoteHide quote > frlrfsystemidisposableclasstopic.asp > > > > I hope this helps, > > > > Cor > > > > > > Try something like this:
Imports System.Runtime.InteropServices Marshal.ReleaseComObject(Grid) Does that help? Hi thanks for the tip and I'll try that but I'm not even sure anymore if it
has to do with the Grid, because if I test it in a test app with the same activex on a usercontrol and that usercontrol on yet another usercontrol and that one on a form there's no problem, so I think that it's some bad coding in some of our classes that causes the whole usercontrol not to be released. So that's going to be some more puzzling... Greetz Peter Show quoteHide quote "Chris Dunaway" <dunaw***@gmail.com> schreef in bericht news:1112277900.299731.197290@z14g2000cwz.googlegroups.com... > Try something like this: > > Imports System.Runtime.InteropServices > > Marshal.ReleaseComObject(Grid) > > Does that help? > |
|||||||||||||||||||||||