How can we determine where a memory leak is coming from?

How can we determine where a memory leak is coming from?

We have a Web application running. We believe there is a memory leak -- the server locks up and users cannot use the system. A reboot is the only solution. How do you recommend we pinpoint this problem? Is there a product you can recommend to capture where the memory leak is coming from? Thank you.

    Requires Free Membership to View

    By submitting your registration information to SearchWinIT.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchWinIT.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

The product you'll use to track it down depends on how you built the Web application. Most questions of this type come from users who have built ASP 3.0 applications in VBScript, and the reason memory leaks and repetitive failure is so common is that it's an inherent problem with that development environment.

While it's possible to write ASP 3.0 code that doesn't have memory leaks, it's very difficult to track them down. In a nutshell, on any given ASP page, your code should destroy any objects that it has created and close any connections that are opened (pay particular attention to database connections). Verify that all branches in the code allow for objects to be cleaned up properly.

Rather than putting the energy into tracking down those bugs, I would recommend you port the application to ASP.NET. ASP.NET applications are much less likely to have memory leaks. If they do, they won't cause the entire system to crash -- ASP.NET automatically and transparently cleans out its memory without affecting users of your site.

This was first published in April 2003

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.