Search code examples
comvbscriptcom+

VBScript for starting queued COM+ apps - leaking memory


I have a simple VBScript that's iterating through all COM+ apps and starting the ones that are queued. This runs every half hour. My server has 2.5gb of memory. Then after about 3 full days of this, I get an "Out of memory" error from Windows Script Host. However, it seems the server memory is fine. Around 1gb free.

This is what my script looks like;

dim cat 
Dim apps
Dim app

set cat = CreateObject ("COMAdmin.COMAdminCatalog") 

set apps = cat.getcollection("Applications")
apps.populate

for each app in apps
  if app.Value("QueuingEnabled") then
    cat.StartApplication (app.name) 
  end if
next

Last time I got this error it reported line #7; set apps = cat.getcollection("Applications") as the place it ran out of memory. Does anyone have any suggestions on how to fix this problem? I have very little experience with COM+, so it's hard for me to see what's consuming memory here. There are only about 8 COM+ apps running on the server, and they are not at all large.

Any help here would be greatly appreciated.


Solution

  • I think you need:

    Set app = Nothing
    Set apps = Nothing
    Set cat = Nothing
    

    at the end of your script.

    See http://support.microsoft.com/kb/304713 for an example of how to use the COMAdmin.COMAdminCatalog object.