Microsoft KB Archive/313883

= BUG: Memory Leak When You Load and Unload the SQL Server ODBC Driver or OLE DB Provider =

Article ID: 313883

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft OLE DB Provider for SQL Server 2000 2000.80.194
 * Microsoft OLE DB Provider for SQL Server 2000 2000.80.380.0
 * Microsoft OLE DB Provider for SQL Server 2000 2000.81.7713.0
 * Microsoft ODBC Driver for SQL Server 2000 2000.80.194
 * Microsoft ODBC Driver for SQL Server 2000 2000.80.380
 * Microsoft ODBC Driver for SQL Server 2000 2000.81.7713.0
 * Microsoft Windows NT 4.0
 * Microsoft Windows NT 4.0 Service Pack 6a

-



This article was previously published under Q313883



SYMPTOMS
An approximately 4-kilobyte (KB) memory leak is encountered when you use Microsoft Windows NT 4.0 Service Pack 6a (SP6a) to load and unload Microsoft SQL Server client components (the ODBC driver or OLE DB provider). The following Visual Basic code produces this behavior: Public Sub Main Dim cn as ADODB.Connection

While (1) Set cn = New ADODB.Connection cn.Open &quot;Driver={SQL Server};SERVER=myserver;DATABASE=mydb;UID=GuestAccount&quot; cn.Close Set cn = Nothing Wend End Sub



CAUSE
This behavior is caused by a low-level system leak. It occurs only during the loading and unloading of the Dbnetlib.dll file.



RESOLUTION
If you must run your application on Windows NT 4.0 SP6a, it is recommended that you ensure that one of the following conditions is true:
 * An open connection is maintained for the duration of the application.

-or-
 * You call the Win32 API LoadLibrary function to load Dbnetlib.dll, and keep it loaded for the duration of the application.

NOTE: When you turn on ODBC connection pooling or OLE DB resource pooling for the application, this lessens the amount of leakage, because connections are pooled and left open even though the application has closed the connection.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
This issue does not occur on Microsoft Windows 2000 or Microsoft Windows XP-based systems.

Keywords: kbbug KB313883

-

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

© Microsoft Corporation. All rights reserved.