-
Sorry for the long question, but I want to cover it from all angles.
After doing a resources check, I am very concerned
I have created a simple COM+ object to check my findings.
The COM+ object was built in VB6 and has one class module. The class module has one function:
Public Function ReturnSomething()
ReturnSomething = "This is from COM+"
End Function
I created myapp.dll and registered it in 'Component Services'
I have called the COM+ object from my asp page using:
Set MyCom = Server.CreateObject("Module.Function")
Response.Write MyCom.ReturnSomething()
Set MyCom = Nothing
As soon as the asp page has loaded, it has returned the string from the COM+ object, but looking through task manager, dllhost.exe appears, and chews up nearly 2mb of resources. I have read that components should terminate automatically after the server has processed the page, but this does not seem to be true.
On my original asp page, I am calling three different COM+ objects which generates three big dllhost.exe entries in the resource viewer.
I am running the COM+ object on Windows 2000 Advanced Server.
Can you force the COM+ object or dllhost.exe to close after the page has finished processing or have I missed something. I have checked a lot of examples and most of them don't even : Set MyCom = Nothing. Please Help!!
-
COM+ objects will run for 3 minutes after being started, and will run in DLLHOST.EXE (they should stop after 3 minutes if not being used), if you want to stop the component you will have to do so manually, sorry but I don't have the code with me offhand - I think it's a one liner though...
hope this helps
-
Thanks Crispin, the com objects do not seem to be pooling - hence a new dllhost.exe per object called is this correct??
-
Yes, it's correct unfortunately. Without free threading this becomes a major problem in VB, I run Windows 2000 Advanced Server at home as well, and have noticed that when I run 6 or 7 components (which could run inside each other) with periodic timer functions in each (they do nothing more than run simple SQL SELECT and UPDATE test transactions) that the performance of my box in general slows down, I have 400mb of RAM and ATA66 IDE with 60% free space on it, and nothing else running except SQL Server 2000 Ent Ed.
This is why MS recommend that your middle tier is a dedicated layer I guess (If you are using VB anyway)
see the following note from MSDN:
Object Pooling
Object Pooling allows you to configure a certain object as a shareable resource. Instead of creating and destroying objects every time, COM+ will keep a pool of instances and provide these as required. You can configure minimum and maximum pool sizes and the creation timeout for pooled objects. Objects need to be thread-neutral to be pooled.
NOTE: Microsoft Visual Basic 6.0 cannot produce this type of object.
ALSO:
http://msdn.microsoft.com/library/ps...oling_2e43.htm