.NET

Reply
New Member
atin_dhamija
Posts: 2
Registered: ‎10-18-2006
Message 1 of 3 (97 Views)

Garbage collection

97 Views, 2 Replies
10-18-2006 06:17 PM
Hi,
I have a COM component developed in Visual C++ 6 (Say COM_SDK6), and a VB.net client is calling this component.

VB.net client program is specifically calling gc.collect method from its code. Due to this, the order in which destructors of COM_SDK6 is getting called gets random. That is, destructors(of different objects exposed by COM_SDK6) get called in any sequence.

Is it a known feature/limitation of .Net? Or I am making some blunder in the code?

Pl share your views.

Regards.
Distinguished Contributor
dmarcotte4
Posts: 195
Registered: ‎04-02-2005
Message 2 of 3 (97 Views)

Re: Garbage collection

10-18-2006 07:27 PM in reply to: atin_dhamija
From what I understand you should never call GC from your code, Its expensive and it probably won’t give you the results your looking for. Take a look at Marshal.ReleaseComObject & Marshal.FinalReleaseComObject
New Member
atin_dhamija
Posts: 2
Registered: ‎10-18-2006
Message 3 of 3 (97 Views)

Re: Garbage collection

10-19-2006 01:07 AM in reply to: atin_dhamija
Hi Danielm,

Thanks a lot for your suggestion. You are right we can control object deletion by calling FinalReleaseComObject.

One more suggestion, in case you can help:
For using COM_SDK6 component, I am doing "Add Reference" for tlb of Say COM_SDK6 in VB.Net. I have neither done any TLBImp nor written any RCW. Is this right?

Thanks again.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.