Article View: borland.public.cppbuilder.database.ado
Article #4326Memory Leak using Connection!
From: Stefan Rischard
Date: Mon, 11 Feb 2002 08:13
Date: Mon, 11 Feb 2002 08:13
49 lines
1963 bytes
1963 bytes
I detected a memory leak using ADOConnection and as DataSource an
invalid IP.
Iļæ½m uisng a connection to watch the status of a DB - rasing when it
comes online or offline. If the DB is online the memory is well but if
the source is offline, not reachable or invalid the memory is
increasing.
This simple source show the effect.
The first runs are very slow and are using the timeout before Open( (
returns. Later on ( after 5 - 30 runs ) the Open( )-call returns
immediatly in 99,9%.
I'm using BCB5, SP1, ADOExpress and Update for ADO
void __fastcall openThread::Execute()
{
HRESULT _hr;
_hr = CoInitializeEx( 0, COINIT_MULTITHREADED );
......
ADOConnection1 = new TADOConnection( 0 );
ADOConnection1->ConnectionString = "Provider=SQLOLEDB.1;Persist
Security Info=True;User ID=sa;Initial Catalog=CoFS_Online;Data Source=
127.0.0.1";
ADOConnection1->LoginPrompt = false;
int error = 0;
while( ! Terminated ) {
try {
ADOConnection1->Connected;
ADOConnection1->Close( );
ADOConnection1->Open( );
}
catch(...) {
error++;
_error( this );
}
_done( this );
}
delete ADOConnection1;
ADOConnection1 = 0;
if( _hr == S_OK )
CoUninitialize( );
}
Technical Details
Message-ID:
<MPG.16d19ba397f26894989695@news.cis.dfn.de>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!213.252.152.60!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,465bff4449f81970,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-02-11 00:13:21 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!213.252.152.60!not-for-mail From: Stefan Rischard <sir_ritschi@gmx.de> Newsgroups: borland.public.cppbuilder.database.ado Subject: Memory Leak using Connection! Date: Mon, 11 Feb 2002 09:13:54 +0100 Lines: 49 Message-ID: <MPG.16d19ba397f26894989695@news.cis.dfn.de> NNTP-Posting-Host: 213.252.152.60 X-Trace: fu-berlin.de 1013415197 47163334 213.252.152.60 (16 [39930]) X-Newsreader: MicroPlanet Gravity v2.50