Click here to Skip to main content
15,891,748 members
Home / Discussions / Database
   

Database

 
GeneralRe: Beginner OLE question Pin
ThomasH14-Oct-04 13:04
ThomasH14-Oct-04 13:04 
GeneralRe: Beginner OLE question Pin
errenden5-Oct-04 3:59
errenden5-Oct-04 3:59 
GeneralTransaction SQL help (SQL Server 2000) Pin
Matt Newman30-Sep-04 6:31
Matt Newman30-Sep-04 6:31 
GeneralRe: Transaction SQL help (SQL Server 2000) Pin
Colin Angus Mackay30-Sep-04 7:19
Colin Angus Mackay30-Sep-04 7:19 
GeneralRe: Transaction SQL help (SQL Server 2000) Pin
Matt Newman30-Sep-04 7:27
Matt Newman30-Sep-04 7:27 
GeneralRe: Transaction SQL help (SQL Server 2000) Pin
Colin Angus Mackay30-Sep-04 9:51
Colin Angus Mackay30-Sep-04 9:51 
GeneralRe: Transaction SQL help (SQL Server 2000) Pin
Matt Newman30-Sep-04 10:31
Matt Newman30-Sep-04 10:31 
GeneralADO memory leak Pin
Droiddr29-Sep-04 23:47
Droiddr29-Sep-04 23:47 
Hi people.

I am using ADO 2.5 type library in C++BUilder 5, I have a memory leak, and need to find a solution.

Basically I open a connection in a thread, keep it open, and make regular queries to the connection to get data. After I am done with each record set, I close the record set. Even if I end the thread and restart another, memory is not freed and keeps climbing. I will include relevant code here:

I have confirmed that the queries are one of the sources of the leak, because if I increase the frequency of the queries, the memory leak accelerates accordingly.

CoInitialize(NULL);
cn = CoConnection::Create();
rs = CoRecordset::Create();
cm = CoCommand::Create();
AnsiString ConnString = TagService->GetSetupConnectString();
// setup connection parameters
cn->ConnectionString = WideString(ConnString.c_str()).Detach();
cn->CommandTimeout = 15;
cn->CursorLocation = Adodb_tlb::adUseClient;
// open connection
cn->Open(NULL,NULL,NULL,adConnectUnspecified);

while(....)
{
cn->Errors->Clear();
rs->Open(WideString(Query.c_str()).Detach(), (IDispatch*)cn, Adodb_tlb::adOpenStatic, Adodb_tlb::adLockOptimistic,0);
// do stuff with the data here.
dummy2Var = 0;
p1 = rs->Fields->get_Item(dummy2Var);
PrinterName = (AnsiString)p1->get_Value();
rs->Close();
Sleep(....);

}
cn->Close();
cn->Release();
CoUninitialize();

Any help would be very appreciated
Best wishes to all!

André
GeneralRe: ADO memory leak Pin
sreejith ss nair7-Oct-04 0:53
sreejith ss nair7-Oct-04 0:53 
GeneralRunning SQL Agent from VB.NET and getting execution status Pin
Emilio Crespo29-Sep-04 6:53
Emilio Crespo29-Sep-04 6:53 
Generalvery strange behaviour Pin
ricardojb29-Sep-04 5:54
ricardojb29-Sep-04 5:54 
GeneralRe: very strange behaviour Pin
sreejith ss nair7-Oct-04 0:51
sreejith ss nair7-Oct-04 0:51 
GeneralStored Procedures and Return Values Pin
Ryan@SalamanderTechnologies29-Sep-04 3:53
sussRyan@SalamanderTechnologies29-Sep-04 3:53 
GeneralRe: Stored Procedures and Return Values Pin
Colin Angus Mackay29-Sep-04 4:41
Colin Angus Mackay29-Sep-04 4:41 
GeneralStored procedure / query optimization Pin
Vagif Abilov28-Sep-04 7:47
professionalVagif Abilov28-Sep-04 7:47 
GeneralRe: Stored procedure / query optimization Pin
Steven Campbell28-Sep-04 8:19
Steven Campbell28-Sep-04 8:19 
GeneralRe: Stored procedure / query optimization Pin
Vagif Abilov28-Sep-04 8:52
professionalVagif Abilov28-Sep-04 8:52 
GeneralRe: Stored procedure / query optimization Pin
Steven Campbell28-Sep-04 9:48
Steven Campbell28-Sep-04 9:48 
GeneralRe: Stored procedure / query optimization Pin
Vagif Abilov28-Sep-04 9:55
professionalVagif Abilov28-Sep-04 9:55 
GeneralRe: Stored procedure / query optimization Pin
Colin Angus Mackay28-Sep-04 23:12
Colin Angus Mackay28-Sep-04 23:12 
GeneralRe: Stored procedure / query optimization Pin
Bill Dean29-Sep-04 6:31
Bill Dean29-Sep-04 6:31 
GeneralRe: Stored procedure / query optimization Pin
Steven Campbell29-Sep-04 8:30
Steven Campbell29-Sep-04 8:30 
GeneralRe: Stored procedure / query optimization Pin
Colin Angus Mackay29-Sep-04 13:24
Colin Angus Mackay29-Sep-04 13:24 
GeneralRe: Stored procedure / query optimization Pin
Bill Dean30-Sep-04 2:21
Bill Dean30-Sep-04 2:21 
GeneralRe: Stored procedure / query optimization Pin
Jeremy Oldham29-Sep-04 13:50
Jeremy Oldham29-Sep-04 13:50 

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.