Click here to Skip to main content
15,916,692 members
Home / Discussions / Database
   

Database

 
Generalsimple sample of ADO + Access + VC++ Pin
slomoman30-Oct-03 7:12
slomoman30-Oct-03 7:12 
Generaldate Pin
Anonymous30-Oct-03 6:30
Anonymous30-Oct-03 6:30 
GeneralRe: date Pin
andyharman3-Nov-03 11:26
professionalandyharman3-Nov-03 11:26 
GeneralIDbCommand.CommandTimeOut Pin
yyf30-Oct-03 4:21
yyf30-Oct-03 4:21 
GeneralRe: IDbCommand.CommandTimeOut Pin
Mike Dimmick30-Oct-03 4:59
Mike Dimmick30-Oct-03 4:59 
GeneralRe: IDbCommand.CommandTimeOut Pin
yyf30-Oct-03 8:07
yyf30-Oct-03 8:07 
QuestionProblem in connection string??? Pin
d meenakshi29-Oct-03 18:53
d meenakshi29-Oct-03 18:53 
GeneralRows Pin
Anonymous29-Oct-03 9:17
Anonymous29-Oct-03 9:17 
GeneralUpdate and select in same procedure with a dataadapter Pin
MrDanJordan29-Oct-03 5:49
MrDanJordan29-Oct-03 5:49 
GeneralHelp, why sql server is pending..... Pin
yyf29-Oct-03 4:09
yyf29-Oct-03 4:09 
GeneralRe: Help, why sql server is pending..... Pin
Jeff Varszegi3-Nov-03 15:07
professionalJeff Varszegi3-Nov-03 15:07 
Generalabout connection pooling Pin
yyf28-Oct-03 10:12
yyf28-Oct-03 10:12 
QuestionThe functions in ADO.NET are asynchronism or synchronism? Pin
yyf28-Oct-03 9:14
yyf28-Oct-03 9:14 
GeneralDebugging a Stored Proc Pin
Dave S28-Oct-03 3:10
Dave S28-Oct-03 3:10 
GeneralRe: Debugging a Stored Proc Pin
Mike Dimmick28-Oct-03 3:15
Mike Dimmick28-Oct-03 3:15 
GeneralRe: Debugging a Stored Proc Pin
Jörgen Sigvardsson30-Oct-03 9:33
Jörgen Sigvardsson30-Oct-03 9:33 
GeneralDataTable.Select Pin
Ryan_Roberts28-Oct-03 2:41
Ryan_Roberts28-Oct-03 2:41 
GeneralPlease point me in the right direction... Pin
frank2127-Oct-03 9:00
frank2127-Oct-03 9:00 
GeneralRe: Please point me in the right direction... Pin
Aryo Handono31-Oct-03 3:15
professionalAryo Handono31-Oct-03 3:15 
Generalconnection pooling Pin
yyf27-Oct-03 7:59
yyf27-Oct-03 7:59 
GeneralRe: connection pooling Pin
Jörgen Sigvardsson30-Oct-03 9:38
Jörgen Sigvardsson30-Oct-03 9:38 
GeneralProcess SQL Transactions?? Easy Question :) Pin
mittalpa27-Oct-03 6:41
mittalpa27-Oct-03 6:41 
GeneralRe: Process SQL Transactions?? Easy Question :) Pin
Mike Dimmick28-Oct-03 2:13
Mike Dimmick28-Oct-03 2:13 
GeneralRe: Process SQL Transactions?? Easy Question :) Pin
mittalpa28-Oct-03 3:17
mittalpa28-Oct-03 3:17 
GeneralMemory Leak! Pin
Kevin Gutteridge27-Oct-03 0:36
Kevin Gutteridge27-Oct-03 0:36 
Hi All!

Can anyone help me with this? It's driving me crazy!
I've reduced a problem application down to the following lines of code.

void TestFunc()
{
::CoInitialize(NULL);

char strTEST[1024];

_ConnectionPtr spConn(__uuidof(Connection));
spConn->Open( "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=;Initial Catalog=TEST_DP;Data Source=(local)", OLESTR(""), OLESTR(""), -1 );

for ( int i = 0; i < 50000; i++ ){

strcpy( strTEST, "SELECT COUNT(*) FROM KGTEST WHERE COL1 = '" );
itoa( i, &strTEST[strlen(strTEST)], 10 );
strcat( strTEST, "'");

_RecordsetPtr spRS(__uuidof(Recordset));
spRS->CursorLocation = adUseClient;
spRS->Open( strTEST, spConn.GetInterfacePtr(), adOpenForwardOnly, adLockBatchOptimistic, -1);
spRS->Close();
spRS = NULL;

}
spConn->Close();
spConn = NULL;

::CoUninitialize();
}

This leaks memory like no tommorrow. It appears to be related to a known Microsoft problem, (Q312575) and the way that memory is cached in MDAC. However this was reported as fixed and does not occur with MDAC 2.7 (According to Microsoft, and this is running with 2.8, and I've re-installed just in case!)

The critical bit seems to be the SQL statement, if it is a constant (For example: SELECT COUNT(*) FROM KGTEST WHERE COL1 = '1' ) - everything is OK, however if the statement is constantly changing then the memory just leaks!

Can anyone shed any light on this?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.