IIS keeps consuming memory even after the virtual directory is unloaded

I'm running ASP (not ASP.NET) with IIS 5.0 on Windows 2000. (Yes, it's an old system.)

My application's virtual directory is configured in IIS to use "High (Isolated)" application protection. Over time, as people access the site, the Task Manager shows that more and more memory is being used and not being freed (not even after 24 hours). There must be a leak in there somewhere. Eventually, performance is affected. But when I Unload the application (via the IIS management console), the system's memory use remains high, even though the DLLHOST process is stopped. I have to restart IIS entirely in order to free all that memory.

The application uses VB Script which calls a custom DLL. The DLL communicates with a SQL Server. The SQL Server looks like it's freeing connections reasonably well.

Questions:

1. If the virtual directory is using a separate process, why doesn't unloading the virtual directory free all its memory? Does this point to where the memory leak could be?

2. Is there a way I can monitor the memory pool to determine where the leak could be? (I'm [obviously] not an expert in this area!) Remember, I'm using IIS 5.0, so there's no Application Pool item in the IIS console.

3. When I look at the COM+ Application for the virtual directory in Component Services, I see that the Advanced tab has an option for Server Process Shutdown. I'm a little nervous about using it, though. Will it shut down my application only if no one has used it for x minutes? Or is there a risk that if I turn this on, users will lose their sessions?

4. Do you have any suggestions for things for me to try or articles read? (Unfortunately, upgrading to a higher version of IIS isn't an option, at least not in the short term.)

Thank you,

Jeri
jerimorrisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ted BouskillSenior Software DeveloperCommented:
Are you sure you are closing object in sessions correctly?  That is usually where I find memory leaks.
0
jerimorrisAuthor Commented:
I'm pretty sure I'm closingt things properly. I've had (and fixed) problems in the past where I wasn't closing recordsets or connections before ending a request. I've scanned the code pretty carefully, and I think I'm now closing them and setting them to Nothing properly. There's no sign that I can see of problems in the SQL Server.

Even so, can you recommend a way I could determine whether that's what's going on? For example, is there a way I can examine the application pool to see if there are orphaned objects hanging around?

Also, if that were the probllem, would it explain why memory isn't freed when I restart the application? Memory only seems to be freed when i restart alll of IIS -- restarting (unloading) just the application for the virtual directory doesn't seem to do anything. Neither does restarting SQL Server.

Thanks,

Jeri
0
Ted BouskillSenior Software DeveloperCommented:
Based on your response I am now convinced you aren't freeing objects.

Objects in application pool (sessions) memory will only be cleared by reseting IIS not the virtual directory.  Multiple websites can use application pools so the only way to reset the pool is a to either configure the application pool to reset at a specific time or reset IIS.

Restarting SQL server will have no affect on session objects (even SQL ones)
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

jerimorrisAuthor Commented:
I really wish the problem were that I'm not freeing objects, because at least I could do something about it! I've just reviewed all the code that deals with database objects (all of that is inside a custom Visual Basic DLL), and it looks like it is very carefully closing all Recordsets and setting them to Nothing. Same for database connection objects. (BTW, no database objects are stored as session objects -- I know enough not to do that.)

You say, "Objects in application pool (sessions) memory will only be cleared by reseting IIS not the virtual directory." So what does "unloading" the application pool for the virtual directory actually do?

Is there any way to examine what's in the memory pool to find out what objects are taking up various amounts of memory? That might help point me in the right direction.

Thank you!

Jeri
0
Ted BouskillSenior Software DeveloperCommented:
What steps do you do to 'unload' the application pool from a virtual directory?  If it's simply using the 'Remove' and 'Create' it simply detaches and reattaches the pool.  That is like attaching or detaching a database.  It doesn't reset the database and if the database is corrupt it remains corrupt.

Try the following tool: http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1286
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jerimorrisAuthor Commented:
To "unload" the application pool, I bring up the IIS Manager, find the virtual directory, and display its Properties. At the bottom of the Virtual Directory tab, in the Applicaiton Settings section, there's an Unload button. I click that.

According to some articles I've found online, "Synonymous to unloading the application in IIS 5 is the concept of recycling the application pool."

FWIW, in the same tab, Applicaiton Protection is set to "High (Isolated)."

Thank you for the linke to the Debug Diagnostics tool! I'll start looking at it now.
0
jerimorrisAuthor Commented:
I recompiled our DLLs to include symbolic information, then I downloaded and ran the Debug Diagnostics tool. Although it was interesting to see where the DLLHOST.EXE process was calling into our DLLs, I didn't see anything that looked like a rampant memory leak. I also didn't see anything in the IIS process that looked like it was holding onto resources after the DLLHOST.EXE process was restarted. It's certainly possible that an expert with this tool would find something that I didn't, but I didn't see anything suspect.

I've been testing the same application on a Windows 2003 server with IIS 6.0, and I don't see any trace of a memory leak at all! At one point, I ran across an article that said that there are Windows 2000-specific memory leaks that don't occur on higher operating systems. (Unfortunately, I didn't bookmark that page, and I'm having problems finding it again.)

We've done an extensive code walkthrough looking for objects not being freed and extensive testing on Windows 2003, and we haven't found anything amiss. At this point, I'm tempted to call it a Windows 2000-specific problem and leave it at that.
0
Ted BouskillSenior Software DeveloperCommented:
Hmm, if the problem doesn't exist on 2003 then I agree.  It must be a problem specific to 2000.
0
jerimorrisAuthor Commented:
I really appreciate your help! While it didn't lead to determining the exact cause of the problem, the link you posted to the memory dump tool was expecially interesting.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.