On Sun, 9 Nov 2003 01:56:40 -0800, Ben Parker wrote:
>�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
                       ^ not
>�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().

In my real application, the method that creates the connection lives in a library and 
returns the connection so that it can be optionally reused. So I don't know if there 
is a straightforward fix in my situation. For now, I'm using 0.9.1.


-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