Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 MOD Memory Leaks
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 3

@tomic
Senior Member

USA
1790 Posts

Posted - 09 September 2002 :  19:35:30  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
I have gone through MOD after MOD today and in the past tracking down memory leaks. The company that hosts my site contacted me today about a big issue regarding my site and that issue was that I was consuming way too much RAM. So I went through all the MODs and came up with a bunch(US bunch not metric) of unclosed recordsets in a bunch MODs. Some of the ones I can remember off the top of my head are:

Buddy.asp
Content Display
inc_active_users.asp
Active_Users.asp
AllPolls.asp
BookMarks.asp
Complain To Moderator.asp
my.asp
my_theme.asp

Plus some forum pages like:
active.asp(3 recordsets unclosed)
default.asp

Now before anyone gets too upset because they fixed this in their MODs or on the default forum pages I will point out that this forum I found these on is 3.1R4. The new forum code look pretty good in this regard and some of the redone MODs have closed their recordsets. So far for 3.4 Active Users and Private Messages look good. However, the rest still leak some memory. Consider this, the more MODs you add that leak memory mean a slower site, frequent reboots and when your host tracks down the problem you will get some email.

The good news, yes there is good news, is that it's pretty easy to take care of this issue. Just look for where recordsets and other objects are Set such as in Set rs = Server.CreateObject("ADODB.Recordset") and make sure they are closed and set to nothing as in:

rs.Close
Set rs = Nothing

I know this sounds really basic and it is but if you end up with a heavily modified site where the MODs don't free up their resources you could have problems. If you on't know what you are doing do not just go through and add rs.close and rs = Nothing for all your recordsets because this needs to be done at the appropriate spot in the code.

I just hope all MOD creators take the time to go through their code and make them use server resources as efficiently as possible.

@tomic

SportsBettingAcumen.com

alex042
Average Member

USA
631 Posts

Posted - 10 September 2002 :  10:14:17  Show Profile  Send alex042 an AOL message  Send alex042 a Yahoo! Message
quote:
Buddy.asp
Content Display
inc_active_users.asp
Active_Users.asp
AllPolls.asp
BookMarks.asp
Complain To Moderator.asp
my.asp
my_theme.asp



Good catch. I didn't even notice that in my rush to go through code.
Go to Top of Page

Etymon
Advanced Member

United States
2385 Posts

Posted - 10 September 2002 :  15:15:21  Show Profile  Visit Etymon's Homepage

@tomic?

I'd like to keep this topic giong because I have a lot of MODs, and I want to make sure I am doing the right thing ... so, I should have some questions as I am going through them. I am currently learning on 3.3.05 and since, seemingly, many of the MODs were written between 3.0.xx and 3.3.05, I think it would be a great learning vehicle.

Is this ok with you?

Sincerely,

Etymon
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 10 September 2002 :  15:30:53  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
That's fine. Most of the MODs are easy to fix because they are small with little code. Just watch out for the pages with lots of logic and nested if --> then statements because you might close the recordset too early. What I did is this: I went through each page and searched for the word "Set" and made a note of recordsets created. Then I went to see if they were closed and set to nothing. If they weren't I searched for the last line that recordset was accessed and examined the logic to try and find the best place to close. Worst case scenario id you just close them at the bottom of the page. This, however, won't work if RS is re-used throughout the page. Which RS would you be closing??!!

@tomic

SportsBettingAcumen.com
Go to Top of Page

Etymon
Advanced Member

United States
2385 Posts

Posted - 10 September 2002 :  16:04:00  Show Profile  Visit Etymon's Homepage

I am at work right now. When I get home I can tell you better.

Thanks for the help!

Etymon
Go to Top of Page

alex042
Average Member

USA
631 Posts

Posted - 10 September 2002 :  17:00:18  Show Profile  Send alex042 an AOL message  Send alex042 a Yahoo! Message
I've found several MODs that set rs=nothing, but don't rs.close first. I assume, set rs=nothing doesn't automatically close the recordset also. Some MODs that should probably be checked include: account locked email, photo album, smile manager, who viewed this. I also found that some of the MODs I was working on also had the same problem.
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 10 September 2002 :  17:11:45  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
quote:
I've found several MODs that set rs=nothing, but don't rs.close first.


Yes. I found lots of those. I would check every page of every MOD to be safe.

@tomic

SportsBettingAcumen.com
Go to Top of Page

Etymon
Advanced Member

United States
2385 Posts

Posted - 10 September 2002 :  18:34:47  Show Profile  Visit Etymon's Homepage

In addition to the rs problems causing the leaks, are there any other possibilities?


Edited by - Etymon on 10 September 2002 18:36:19
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 10 September 2002 :  18:48:30  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
You do know that I don't just mean recordsets called "rs" specifically right? I mean any and all recordsets and other objects instantiated in the script.

For example:
<%
dim fs,fname
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fname=fs.CreateTextFile("c:\test.txt",true)
fname.WriteLine("Hello World!")
fname.Close
set fname=nothing
set fs=nothing
%>


This is the general rule:

If you develop your websites using Microsoft ASP (Active Server Pages), please remember to Destroy all Objects after using them.

Failure to do this can cause Server Memory Leaks and may crash the Web Service.

Destroy objects after use (for example, ADO recordsets) by using the following statement:

Set ObjName = Nothing

@tomic

SportsBettingAcumen.com
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 10 September 2002 :  19:11:03  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
Everyone should read this page top to bottom!

While a lot of it is SQL server specific, there is a lot that applies to ALL ASP-database applications. This page covers a lot of extremely important issues.

http://www.sql-server-performance.com/asp_sql_server.asp

@tomic

SportsBettingAcumen.com
Go to Top of Page

joatham
Junior Member

United Kingdom
169 Posts

Posted - 10 September 2002 :  20:50:51  Show Profile  Visit joatham's Homepage
Some good advice on that page @tomic, it covers many tips I've seen, all in one place. Thanks for the info!
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 10 September 2002 :  20:55:51  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
No problem. Here's another list of tips for ADO from that same site:

http://www.sql-server-performance.com/bl_asp_ado.asp

Whoops, not a list. Just some testing and results.

@tomic

SportsBettingAcumen.com

Edited by - @tomic on 10 September 2002 20:58:43
Go to Top of Page

DJ5A
Junior Member

163 Posts

Posted - 11 September 2002 :  08:21:44  Show Profile
Hello Everybody:

Is there a Chance that These Errors have Been Taken care of in the Latest .zip Files for Downloading? Say Since this Past Sunday Morning on the 8th of this Month?

The Reason I'm Asking is I have these 4 Pages that I downloaded this Past Sunday & Installed:

////////////////////
inc_active_users.asp
Active_Users.asp
active.asp
default.asp
///////////////////

I've Read What is Posted here, But I'm Still a Little Lost as to which Lines of Code to Check & What to do?

Thankl You For Your Time!!!!!
DJ5A

Thank You for Your Time!!!!!
DJ5A
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 11 September 2002 :  11:45:50  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
active_users.asp is fine IF it's 4.0
active.asp should be fine if it's 3.4+
default.asp should be fine if it's 3.4+

@tomic

SportsBettingAcumen.com
Go to Top of Page

Etymon
Advanced Member

United States
2385 Posts

Posted - 11 September 2002 :  15:10:09  Show Profile  Visit Etymon's Homepage

You know how some people can play an instrument by ear but can't read nearly a note on paper? When it comes to ASP that would be me!

I have played enough with the v3.3.05 Snitz forum code (my present learning base) that I know how mix and match a few things without breaking the forum and still achieve the effect I am after, but what the technology is doing as it applies to Snitz and database language, I am nearly clueless.

I've just started reading the "Performance Tuning ASP Pages Using SQL Server". Thanks for the link!

Oh, by the way, Doug G wrote a very nice article on Databases, Web Servers, ADO, and Snitz that made something in my mind click, and I felt like I was actually getting closer to being competent. His article is at http://www.pe.net/~dgorin/snitz/files/20001216_INFO_lengthy_ado_asp_database_explanation.html

I was struggling so long with some of the most basic terminologies as they applied to Snitz like ADO, Jet, and database logic. Then as I was searching in the archives here at Snitz for some answers, I happened upon Doug's article. It was such a relief!

When I can't grasp something logically, I become dependent on becoming a visual learner. An article written in the style like Doug wrote, even if with no graphics, helps greatly in creating that mental picture I need.

Well, *sigh!*, that's where I am at currently.


Thanks again,

Etymon

Edited by - Etymon on 11 September 2002 15:12:59
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 11 September 2002 :  15:44:55  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
I recommend subscribing to www.asptoday.com($20 for 3 months) and reading Wrox Press books. Wrox has the easiest to understand explanations i have ever seen.

@tomic

SportsBettingAcumen.com
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.29 seconds. Powered By: Snitz Forums 2000 Version 3.4.07