FWIW, if you close the connection before reassigning the variable to a new
connection, your test script succeeds on my system (RedHat 7.3, MySQLdb
0.9.2, mysql 4.0.13-standard, python 2.2.3). Just add "conn.close()" at the
end of the body of the for loop.

It seems like the __del__ method isn't being called when the conn variable
is reassigned to the new connection. It could be that MySQLdb keeps an
internal reference to the connection so the reference count does drop to 0
when the conn variable is reassigned. I have not reviewed the MySQLdb code
so that's only a guess.

We have had a bunch of issues with memory leaks due to unclosed db
connections using MySQLdb 0.9.2. It's now strict policy in code reviews to
make sure all db connections and cursors are explicitly closed using
<connection>.close().

- Ben

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Chuck
> Esterbrook
> Sent: Friday, November 07, 2003 6:43 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [Webware-devel] MiddleKit & MySQLdb 0.9.2 problem
>
>
> Alright, here we go. The attached program exhibits the problem
> for me on MySQLdb 0.9.2, but not 0.9.1. Admittedly, other
> variables changed too.
>
> Can a couple more people try it and report their results? A Linux
> build of 0.9.3 beta would be especially interesting.
>
> Once I collect a few more data points, then I'll send this on to
> Andy Dustman and see what he says...
>
> -Chuck
> --
> http://ChuckEsterbrook.com/
>




-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to