We help IT Professionals succeed at work.

ASP & IIS - memory just drains away....

john_jenkins
john_jenkins asked
on
346 Views
Last Modified: 2010-08-05
I have a busy site running IIS4 & using ASP/ADO (quite a bit....).

Over a period of time (4-6 hours) the memory just leaks away - I have reduced my usage of Session variables to an absolute minimum and the site runs faster - but the memory seems to leak away even faster.

It looks as if IIS doesn't garbage collect it's ASP space quickly enough, and the load on memory just builds up more quickly than it is being cleared out (see below - if left alone it DOES eventually clear out).

Running in separate memory space just seems to make it worse.

Response times are OK (20 threads) until memory gets in short supply, then it falls apart quickly.

I have run the site in isolation with test sessions only, and if I let the site go quiescent, the memory comes back after about 50 minutes (20 minutes session timeout + 30 minutes) - this is quite consistent.

If I just drive the site at 'live' speed then I get the same problem. Extra memory on the web server just delays the inevitable.

The question is : How do I fix this...

Is it:
1. Using session variables AT ALL?
2. A tuning issue for IIS (e.g. forcing garbage collect)?
3. More webservers to spread the load?
4. Getting the server to detect the situation and auto-reboot (how?)
5. Something else........

Any advice much appreciated.

John






Comment
Watch Question

Mark FranzProject Manager
CERTIFIED EXPERT

Commented:
What version of VBScript engine are you running?  there was a memeory leak problem associated with Month(date) in IIS 4.0.  First ensure your engine is 3.1 or above.  Run the following code;

<%@ language=VBScript%>

<%
'**Start Encode**
Function GetScriptEngineInfo()
 Dim s
 s = ""                        ' Build string with necessary info.
 s = ScriptEngine & " Version "
 s = s & ScriptEngineMajorVersion & "."
 s = s & ScriptEngineMinorVersion & "."
 s = s & ScriptEngineBuildVersion
 GetScriptEngineInfo = s      ' Return the results.
 
End Function
%>

<%= GetScriptEngineInfo %>

Try running Heap Watch, HW32 lets you view application heaps and monitor them for memory leaks. The Summary-view window shows a list of the heaps for all active Win32-based applications. The Details-view window shows all memory objects in the selected heap. The Object-view window shows the blocks of memory that were allocated for the given object.

Also, make sure you are closing all your ADO/ODBC connections.

Commented:
Every time you
Set obj = CreateObject...
you have to
Set obj = Nothing
afterwards.

In our company, one coded;
Set obj = CreateObject...
in a loop, but nulled it only once, after the loop.
(That was a few MB for each loop...)

Also, we used a C COM object which caused drastic memory leakage.
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Commented:
First you must do is avoid the sentences like Set obj = CreateObject("dsdfsdfd.blabla") because it create the object although there is not to use, you must use the HTML tag <OBJECT RUNAT=Server ...> because it not create the object until one method is called.

Second, you must looking for your load balancing software, perhaps a good idea was to use MTS to register your components

Third, you must avoid de Session_OnStar and Session_OnEnd methods if in your global.asa are empty these ones you must delete.

Fourth, you must work without isolated process, because it is only to debug...

A best solution is work with Windows 2000 server and use IIS 5.0 because it works fine and you can decide whats happend when your IIS crash...

murdok
Mark FranzProject Manager
CERTIFIED EXPERT

Commented:

Author

Commented:
Thanks to all (particularly webmeister) all good stuff. The good news is that we've cracked the problem (Hoorah).


There WAS some minor leakage with COM objects in session variables (fixed now), however the real problem was in Microsoft's ADODB interface which has a big memory hole in it.

We found that using a .close method and then setting the variable to Nothing did not release memory. We tried various methods of Destroy-ing the object and eventually resorted to doing an explicit destruction of the object in our own .DLL - everything is now sweet and the site FLIES.......


Thanks again (living & learning)

John

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.