Microsoft KB Archive/132494

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

Article ID: 132494

Article Last Modified on 6/12/2001

-

APPLIES TO


 * Microsoft Open Database Connectivity 2.0
 * Microsoft Open Database Connectivity 2.5

-



This article was previously published under Q132494



2.00.1912 2.50.0121

WINDOWS

kbprb kbprg



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.

 Inside P-Viewer, select ODBCTE32, click Refresh, and write down the number of "Heap Usage." Inside 32-bit ODBC Test:

 From the Connect menu, select SQLAllocEnv. From the Connect menu, select SQLAllocConnect. From the Connect menu, select SQLConnect and connect to SQL Server data source. Alternatively, you can select SQLDriverConnect instead of SQLConnect. From the Connect menu, select SQLDisconnect, SQLFreeConnect, and SQLFreeEnv.</li></ol> </li> Go back to P-Viewer, click Refresh, again write down the number of "Heap Usage."</li></ol>

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.

<div class="workaround_section">

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: KB132494

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.