Re: Is this correct? (TADOConnection)
- From: "Frederico Pissarra" <me@xxxxxxxxxxx>
- Date: Mon, 23 Oct 2006 10:40:04 -0300
<danielk1@xxxxxxxxx> escreveu na mensagem
news:1161379473.609229.42860@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Not sure what you are asking, the code is from the unit ADODB. Are you
wondering if your connection/object is free at this point?
Precisely.... Notice that connection object is created in the constructor in
CreateADOObject() function - wich calls CoCreateInstance with the proper
CLSID.
CoCreateInstance will call AddRef() IUnknown's member, but at the destructor
FConnectionObject is simply set to nil without calling Release()!
This means any connection object will remain in memory until the processes
dies... or am I wrong?
[]s
Fred
Frederico Pissarra wrote:
Hello!!!
Taking a look at ADODB unit in $(DELPHI)\Source\VCL (I'm using D7 here),
you
can see the following code:
-------------%<------------cut
here -------------%<------------------------
destructor TADOConnection.Destroy;
begin
Destroying;
Close;
ClearRefs;
FreeAndNil(FCommands);
if FConnEventsID > 0 then
OleCheck(ConnectionPoint.UnAdvise(FConnEventsID));
FConnEventsID := 0;
FConnectionObject := nil;
inherited Destroy;
end;
-------------%<------------cut
here -------------%<------------------------
Notice that FConnectionObject is not released (calling IUnknown.Release),
but the reference simply will point to nil.
Is this correct?
[]s
Fred
.
- References:
- Is this correct? (TADOConnection)
- From: Frederico Pissarra
- Re: Is this correct? (TADOConnection)
- From: danielk1
- Is this correct? (TADOConnection)
- Prev by Date: Re: ADO vs dbExpress
- Next by Date: Re: Is this correct? (TADOConnection)
- Previous by thread: Re: Is this correct? (TADOConnection)
- Next by thread: Re: Is this correct? (TADOConnection)
- Index(es):