473,729 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ODBC Memory Leak

We are using ODBC connection pooling with SQL Server 2000 v5 on Win 2000 v5
sp4.

Each time we get a connection, SQLConnect, we see the memory usage go
up, about 52K. When we return the connection to the pool,
SQLDisconnect, and after the time that the connection remains in pool
expires we see the memory usage drop by about 28K.

Our basic steps for a select are:
SQLAllocHandle( SQL_HANDLE_DBC, hGblEnv, &hdbc);
SQLSetConnectAt tr(hdbc, SQL_ATTR_LOGIN_ TIMEOUT,
(SQLPOINTER)lLo ginTimeOut, 0);
SQLSetConnectAt tr(hdbc, SQL_ATTR_ACCESS _MODE,
(SQLPOINTER)SQL _MODE_READ_ONLY , SQL_IS_POINTER) ;
SQLConnect(hdbc ,(SQLCHAR *)szDatabase, SQL_NTS,
(SQLCHAR *)szUserId, SQL_NTS,
(SQLCHAR *)szPassword, SQL_NTS);
SQLAllocHandle( SQL_HANDLE_STMT , hdbc, &hstmt);
// Build the select statement
SQLExecDirect(h stmt, (SQLCHAR * )pszSQLStmt, strlen(pszSQLSt mt));
SQLFetch(hstmt) ;
SQLFreeHandle (SQL_HANDLE_STM T, hstmt);
SQLDisconnect(h dbc);

Same memory leak occurs in DB2, but that's another forum.
Jul 20 '05 #1
1 6724
[posted and mailed, please reply in news]

M. Oakley (mo*****@acroso ft.com) writes:
We are using ODBC connection pooling with SQL Server 2000 v5 on Win 2000
v5 sp4.

Each time we get a connection, SQLConnect, we see the memory usage go
up, about 52K. When we return the connection to the pool,
SQLDisconnect, and after the time that the connection remains in pool
expires we see the memory usage drop by about 28K.

Our basic steps for a select are:
SQLAllocHandle( SQL_HANDLE_DBC, hGblEnv, &hdbc);
SQLSetConnectAt tr(hdbc, SQL_ATTR_LOGIN_ TIMEOUT,
(SQLPOINTER)lLo ginTimeOut, 0);
SQLSetConnectAt tr(hdbc, SQL_ATTR_ACCESS _MODE,
(SQLPOINTER)SQL _MODE_READ_ONLY , SQL_IS_POINTER) ;
SQLConnect(hdbc ,(SQLCHAR *)szDatabase, SQL_NTS,
(SQLCHAR *)szUserId, SQL_NTS,
(SQLCHAR *)szPassword, SQL_NTS);
SQLAllocHandle( SQL_HANDLE_STMT , hdbc, &hstmt);
// Build the select statement
SQLExecDirect(h stmt, (SQLCHAR * )pszSQLStmt, strlen(pszSQLSt mt));
SQLFetch(hstmt) ;
SQLFreeHandle (SQL_HANDLE_STM T, hstmt);
SQLDisconnect(h dbc);


There is a known issue with a memory leak in ODBC, described in
http://support.microsoft.com/?id=814410. This fix is included in SP3a,
but *not* in SP3, so you might want to investigate if this could be
the same.

However, I'm not completely sure that this is the same leak. I did get
a repro for the original leak, which lead to the fix in 814410, but not
programming ODBC much myself, I don't remember the details.

In any case, in case SP3a does not resolve the problem, could you compose
a complete repro that demonstrates the problem? That is a program that
I can compile and run? In such case, I should be able to bring it up
with Microsoft.

--
Erland Sommarskog, SQL Server MVP, so****@algonet. se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1386
by: Kong Li | last post by:
Follow up to this thread, the latest Oracle 9i release 2 patchset (9.2.0.5) fixed the handle count leak problem. The problem is in Oracle client component. Thanks. Kong ----- From: Kong Li (likong@email.com)
1
2481
by: M. Oakley | last post by:
We are using ODBC connection pooling with DB2 v 8.1 on Win 2000 v5 sp4. Each time we get a connection, SQLConnect, we see the memory usage go up, about 52K. When we return the connection to the pool, SQLDisconnect, and after the time that the connection remains in pool expires we see the memory usage drop by about 28K. Our basic steps for a select are: SQLAllocHandle(SQL_HANDLE_DBC, hGblEnv, &hdbc);
8
3412
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the Memory Corruption while executing the program ? In nut shell, what is/are the realtion/s between the Memory Leak and Memory Corruption. Juts Theoritical Assumtion below:
17
4809
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is easier to reproduce (e.g.: remote machine not available). After about 1 day, I get a usage of 300MB of memory. I have used .NET Memory Profiler tool to try to see where the leak is located. For all the leaky instances, I can see the following (I...
4
6089
by: Don Nell | last post by:
Hello Why is there a memory leak when this code is executed. for(;;) { ManagementScope scope = new ManagementScope(); scope.Options.Username="username"; scope.Options.Password="password"; scope.Path.Path=@"\\pc\root\cimv2";
20
8115
by: jeevankodali | last post by:
Hi I have an .Net application which processes thousands of Xml nodes each day and for each node I am using around 30-40 Regex matches to see if they satisfy some conditions are not. These Regex matches are called within a loop (like if or for). E.g. for(int i = 0; i < 10; i++) { Regex r = new Regex();
23
4558
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
3
5324
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". Anybody know anything about this? Does *Javascript* leak memeory, or does the *browser* leak memory?
22
9351
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a memory leak someplace. I can not detect the memory leak by running several reports by hand, but when I run tha app as a servrice and process few hundred reports there is significant memory leak. The application can consume over 1GB of memory where it...
0
8921
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9284
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9202
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8151
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.