Web Session Memory Leak?

Hi everybody
I came across a strange behaviour with a web application I’m developing, is actually quite complex accounting application and there is a procedure that calls and close many web dialogs. I experienced a progressive slow down while testing this application (standalone, dedicated server, fast bandwidth, mac osx) at first I thought was a problem with the database (mysql) but, analysing the server with the activity monitor, I discovered that progressively the application generated more and more threads on the server, funny enough these threads continue to exist and use a lot of processor power (even 100%) even when all the sessions are down and only the application is active on the server…
I tried different things with no avail, looks like the sessions are leaking somewhere… someone got the same experience? any thought?

There are two main ways that a memory leak like this could manifest.

  1. If there’s a leak in our framework somewhere. We’ve had 3 verbal reports of leaks like this since 2014r2.1 was released, but we have not been able to isolate anything without a project that shows the problem yet.

  2. The other way is if there’s a leak in your code somewhere. This can happen if you are storing a reference to the Sessions somewhere else, or a reference to an object stored in a property on the Session. The usual suspect is having a property on the Session for storing a database connection and then also having a reference to that connection on each of your WebPages to make it “easier to code”.

I’m searching for a persistent leak in an app and wondered if #2 above (using a property in the Session to store database info and then referencing it in a webpage). Am I guilty of doing this?

For example, in this routine that updates a particular table, I have the code below:

[code] dim mydb as new MySQLCommunityServer

mydb.Port = Session.mydbport
mydb.DatabaseName = session.mydbdatabasename
mydb.UserName = Session.mydbusername
mydb.Password = session.mydbpassword[/code]

I don’t have variables or properties on the webpage that use the session information. I just declare mydb, get the parameters from the Session variables, do the database work, and then close any recordset and Mydb.

Also, is

rs.close mydb.close

sufficient or do I need to set them equal to nil or anything to free up memory?

No. Those would not cause a leak.

It’s literally when people put a reference to the session (or other shared object) in other places.

Because the framework uses reference counting to know when to release an object, having A point to B and B point to A means that neither class’ references would all go to zero. That is, something else has a reference to each of them.

Gotcha. I was hoping it would be something really simple like that. I’ll keep looking!