odbc, dbi modules memory leak???
Victor Muslin
victor at prodigy.net
Thu May 31 11:24:58 EDT 2001
Thank you, Marc! Yes, Microsoft driver for Oracle does not have a
memory leak. However, it appears to be half as fast as the Oracle
driver.
On Sat, 26 May 2001 17:59:05 +0200, "M.-A. Lemburg" <mal at lemburg.com>
wrote:
>Victor Muslin wrote:
>>
>> The program below leaks memory:
>>
>> The offender seems to be the statement:
>>
>> cur = dbconn.cursor()
>>
>> If this statement is moved outside the loop so that the same cursor is
>> re-used, memory leak stops. Why is the cursor not garbage collected
>> properly?? Is there some trick I need to know? Help would be greatly
>> appreciated.
>>
>> I know that explicit deletes should not be necessary, just tried them
>> in desperation :-(
>>
>> I am using ActiveState Python 2.1 build 210 on Windows 2000. I
>> observed the same behavior with BeOpen Python 2.0.
>
>As I already wrote you in private mail, this is not due to Python
>having a leak, but due to the poor implementation of the Oracle
>ODBC you are using.
>
>Please try the MS one for Oracle...
>
>> TIA
>>
>> --------------------------------------------------------
>>
>> import dbi,odbc
>>
>> sql = "SELECT application_instance, parameter_name,"\
>> " parameter_value"\
>> " FROM config_parameters"\
>> " WHERE ((application_type = '%s' AND "\
>> " (application_instance IS NULL OR"\
>> " application_instance = '%s'))"\
>> " AND (parameter_name LIKE '%s'))" % ('ADSERVER', 'ADSERVER_1',
>> '%')
>>
>> cs = 'dbsource_acf/vmuslin/dclk123'
>>
>> dbconn = odbc.odbc(cs)
>> for i in range(2000):
>> cur = dbconn.cursor() # <--- offending statement
>> cur.execute(sql)
>> resultset = cur.fetchall()
>> del(cur)
>> del(resultset)
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>
>--
>Marc-Andre Lemburg
>CEO eGenix.com Software GmbH
>______________________________________________________________________
>Company & Consulting: http://www.egenix.com/
>Python Software: http://www.lemburg.com/python/
>
More information about the Python-list
mailing list