PRB: Memory Leaks in SQL Srv Driver During Connect/Disconnect

ID: Q132494

2.00.1912 2.50.0121
WINDOWS
kbprb kbprg
The information in this article applies to:
  • Microsoft Open Database Connectivity, versions 2.0, 2.5


SYMPTOMS

The following sequence of calls:

SQLAllocEnv, SQLAllocConnect, SQLConnect (or SQLDriverConnect), SQLDisconnect, SQLFreeConnect, and SQLFreeEnv
can lead to a 4K memory leak in the following Microsoft SQL Server drivers:

  • 16-bit SQL Server Driver 2.00.1912, ships with SQL Server version 4.21a


  • 32-bit SQL Server Driver 2.00.1912, ships with SQL Server version 4.21a


  • 16-bit SQL Server Driver 2.50.0121, ships with SQL Server version 6.0



CAUSE

STEPS TO CHECK 32-BIT SQL SERVER DRIVER MEMORY LEAKS:

Start the Process Viewer in the NT Resource Kit. Start the 32-bit ODBC Test application.

  1. Inside P-Viewer, select ODBCTE32, click Refresh, and write down the number of "Heap Usage."


  2. Inside 32-bit ODBC Test:

    1. From the Connect menu, select SQLAllocEnv.


    2. From the Connect menu, select SQLAllocConnect.


    3. From the Connect menu, select SQLConnect and connect to SQL Server data source. Alternatively, you can select SQLDriverConnect instead of SQLConnect.


    4. From the Connect menu, select SQLDisconnect, SQLFreeConnect, and SQLFreeEnv.




  3. Go back to P-Viewer, click Refresh, again write down the number of "Heap Usage."


Process Viewer will show 4K memory leaks in the SQL Server Drivers mentioned above. Every time you repeat steps 2.a through 2.d, another 4K of memory stays allocated.

NOTE: There is no memory leakage in the 32-bit SQL Server driver 2.50.0121 that ships with SQL Server version 6.0.


WORKAROUND

Share ODBC connections as much as possible in the application.

Additional query words: 2.00.1912 2.50.0121 sql6 6.00 4.21a

Keywords :
Version : WINDOWS:2.0,2.5
Platform : WINDOWS
Issue type :


Last Reviewed: August 24, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.