[python-win32] ADO memory leak?

Jim Vickroy Jim.Vickroy at noaa.gov
Fri Aug 25 17:43:13 CEST 2006


Roger,

Attached are 2 scripts (ado-mem-test-04.py, ado-mem-test-05.py) for 
testing possible ADO memory leak problems.

ado-mem-test-04.py appears to exhibit a steady increase in memory 
requirements with time; ado-mem-test-05.py does not appear to exhibit 
this behavior.

The primary difference between the two scripts is that -04 changes its 
insert value each time via a prepared statement parameter while -05 
simply uses the database table column default value (NULL) for each insert.

I apologize for the length (~65 lines) of each script.

Thanks for taking a look at this.

-- jv

P.S.
The scripts have always been run using python.exe rather than pythonwin, 
and my observations on memory usage come from the Windows Task Manager.



Roger Upole wrote:

>Jim Vickroy wrote:
>  
>
>>I have a "fairly" simple test script that appears to exhibit a memory 
>>leak when using ADO to insert rows in a SQL Server database via a 
>>persistent connection.
>>
>>Memory requirements monotonically increase with time (apparently in 4k 
>>increments).
>>
>>I'm using python 2.4.1,  win32com (pywin32 build 209), and MS Windows XP 
>>with all current updates.
>>
>>Has anyone else seen this behavior?
>>
>>Any thoughts about where the problem may be?
>>
>>Thanks,
>>-- jv
>>
>>P.S.
>>Earlier tests showed that:
>>
>>   * simply maintaining a persistent connection (for 24 hours) is not
>>     the cause
>>   * maintaining an active connection and the insert command object are
>>     not the cause
>>
>>    
>>
>
>Does the script print anything, and are you running from pythonwin or
>python.exe ?  Pythonwin accumulates output indefinitely, whereas
>python.exe eventually starts discarding it once you exceed the output
>buffer size of the console window.
>
>Could you post the script that demonstrates the problem ?
>I'll try to set it up to run for a while in debug mode to see if
>any problems show up with python refcounts or COM interface
>refcounts.
>
>     Roger
>
>_______________________________________________
>Python-win32 mailing list
>Python-win32 at python.org
>http://mail.python.org/mailman/listinfo/python-win32
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20060825/8612c8e2/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ado-mem--test-05.py
Type: application/x-python
Size: 2944 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-win32/attachments/20060825/8612c8e2/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ado-mem--test-04.py
Type: application/x-python
Size: 3040 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-win32/attachments/20060825/8612c8e2/attachment-0001.bin 


More information about the Python-win32 mailing list