Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Freeing COM object from memory.../inetinfo.exe

Status
Not open for further replies.

computergeek

Programmer
May 23, 2001
193
0
0
CA
Hi,

I am having trouble with the releasing of a VB Com object from memory. When I try to unregister & delete the dll file and replace with a newer version it says it's in use? Within the following piece of code I declare objForecast, and then release it from memory using "Set objForecast = Nothing". The recordset, connection, and command objects are declared as global type variables and are closed later in the script. Apparently, Inetinfo.exe is still accessing the object after I have closed the application??! (I looked via a 3rd party tool to see what had the COM open.) The only way to free the object from memory was through brute force by:
1. Stopping the Web server
2. issuing a number of net stop commands at the command prompt
For example: net stop w3svd
See Microsoft Q185382
3. Then starting up services again

------------------------------
Function GetForecastData()
Dim rows
Dim objForecast

'Create and open the Connection object (Connection string defined in Global.asa)
set adoConn = Server.CreateObject("ADODB.Connection")
adoConn.Open Application("Connection2_ConnectionString"), _
Application("Connection2_RuntimeUserName"), _
Application("Connection2_RuntimePassword")

' Create instance of ForecastAndResupply COM object (ForecastAndResupply.dll)
set objForecast = Server.CreateObject("ForecastAndResupply.ForecastGrid")

' Set input parameters for the ForecastAndResupply COM object
''objForecast.SiteID = 1;
''objForecast.StockID = 1;
objForecast.StockID = stockid_inputparam
objForecast.SiteID = siteid_inputparam

' Get the number of rows to be returned
rows = objForecast.FillArray()

' If data exists for current parameters continue retreiving data...
if (rows > 0 ) then
set cmTmp = Server.CreateObject("ADODB.Command")
cmTmp.ActiveConnection = adoConn
set rsForecast = objforecast.ThrowRecordset()
rsForecast.movefirst
end if

' Destroy Com object

Set objForecast = Nothing

' Return number of rows
GetForecastData = rows

end function

MY QUESTIONS:

1..WHY DOESN'T MY COM OBJECT GET FREED FROM MEMORY??
2. WHAT IS INETINFO.EXE?

Thanks,

Computergeek
 
This is a well documented (and annoying) issue! IIS (inetinfo.exe) is the web server. You need to stop and start the server to release any DLL's - and then delete/update the dll's before anyone makes a web request that uses the dll.

Try running the IIS 'Service Manager' application, select your Web, and display the Properties dialog.
Now try clicking the 'Unload' button. This May release the DLL. If this fails, then try changing the Application 'protection' (in Win2000) from in-process to out-of-process/isolated or vica-versa. If both of these fail to release the DLL, then its back to the stop-start of IIS.

NOTE: ASP.Net does not have this problem - it simply detects when a DLL has been updated and starts to use it as soon as possible. You just copy the DLL to the appropriate place - and NO registration needed. Yippee! (Content Management)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top