FIX: Memory Leak with ODBC Driver Manager During Connect

Last reviewed: October 29, 1997
Article ID: Q153797
The information in this article applies to:
  • Microsoft Open Database Connectivity version 2.5

SYMPTOMS

When an ODBC application makes a certain sequence of calls to connect to an ODBC driver, a memory loss on the order of a few hundred bytes may occur due to a memory leak in the Driver Manager. The sequence that results in the memory leak is as follows:

   SQLAllocEnv
   SQLAllocConnect
   SQLConnect or SQLDriverConnect
   SQLDisconnect
   SQLFreeConnect
   SQLFreeEnv

This leak affects only those applications that connect and disconnect frequently without ever exiting the application. For SQL Server replication users, this problem is encountered when a distribution server connects to subscription servers as an ODBC client.

WORKAROUND

An application can share connections. If an application needs to connect and disconnect frequently, you can shut down the application periodically. For example, if an application is running as a Windows NT service, you can periodically shut down and restart the service in order to clean up the memory leak.

Under Windows NT and Windows 95, each application has its own memory address space. After the application is shut down, Windows NT and Windows 95 will clean up the application's memory space, including the memory leak.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Open Database Connectivity version 2.5.x. This problem has been corrected in Microsoft Open Database Connectivity version 3.0.x.


Additional reference words: 2.50 ODBC DM VC++ VB C++ MSVC FoxPro
KBCategory:
KBSubcategory:
Version : 2.50.3006
Platform : WINDOWS
Issue type : kbbug
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.