Calling COM EXE from VB.NET Service leaves COM EXE in Memory 
Author Message
 Calling COM EXE from VB.NET Service leaves COM EXE in Memory

Problem:
--------
Calling COM EXE from VB.NET Service leaves COM EXE in Memory long
after the Service has stopped.

Description:
------------
I have created a Windows Service in VB.NET that will call a COM EXE,
written in Visual Basic 6.0.  Before calling the COM EXE I first
create a new thread and then call a method that calls the COM EXE.
Reason for creating the thread are two-folds (1) Windows Service main
thread does not get block (2) The COM EXE may takes up to 2 minutes to
run.

COM EXE:
"Single Use" Instancing (object of this class that a client creates
starts a new instance of the component)

Incorrect Behaviour:
--------------------
When I tell the service to stop, the COM EXE stays in memory for over
15 minutes before being released (observed in task manager).  I even
call System.GC.Collect() to force the disposal of the .NET COM wrapper
objects, during the "OnStop" event of the service.

I am doing doing something wrong?

Thanks,
Kam Mistry



Mon, 11 Oct 2004 02:44:39 GMT  
 Calling COM EXE from VB.NET Service leaves COM EXE in Memory
Kam,

Quote:
>Calling COM EXE from VB.NET Service leaves COM EXE in Memory long
>after the Service has stopped.

Try calling System.Runtime.InteropServices.Marshal.ReleaseComObject()
on any COM object references to explicitly release them.

Mattias

===
Mattias Sj?gren (VB MVP)

http://www.msjogren.net/dotnet/



Mon, 11 Oct 2004 06:58:50 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Call VB DLL or COM object from within VB COM object or EXE

2. passing byte stream to/from COM server and DLL vs EXE COM server

3. Com.exe or Com.dll

4. COM Object-Out of stack space on executing/shell exe from com object

5. Identifying an EXE file as a COM EXE server

6. Where can i find Com+ Services type library or Component services com+ 1.0 for Win98

7. error 53 (file not found) with external DLLs called from COM or EXE

8. Communication between Vb EXE and VB.NET EXE

9. VB EXE to VB.NET EXE

10. Call to Java COM inside VB COM

11. com object will not read registry when com object called from asp (vb works fine)

12. VB using COM crashed in IDE, exe is fine

 

 
Powered by phpBB® Forum Software