Subject | Re: [IBO] Problem with resources (DSQL) not being freed |
---|---|
Author | Helen Borrie |
Post date | 2003-04-01T15:22:18Z |
At 02:37 PM 1/04/2003 +0000, you wrote:
prepared and it never opens. So - not much resource use there.
But, errrrrm, take a fresh look at this block of code:
if WCursor.Eof then begin
Log.Lines.Add('No faxes found ....');
Shape.Brush.Color := COLOR_INACTIVE;
Conn.Disconnect;
Exit; <---- WCursor never gets destroyed !!!
end else
The Prepare call does use resources, which will stay in use until Unprepare
is called. You don't actually need to call Unprepare at all, since you are
immediately destroying the cursor object. You only ever need to call it
for objects that you are going to keep on ice for later (occasional) use.
cheers,
Helen
>HiOch aye, if you don't call a First method on your ib_cursor, it's never
>
>Not sure if this is my fault, but I dont think so.
>
>I have an application which runs for weeks without being shut down,
>but eventually crashes. It uses a TIB_Cursor to poll a database for
>new information with the following piece of code:
>
> WCursor := TIB_Cursor.Create(Self);
> try
> WCursor.IB_Connection := Conn;
> WCursor.SQL.Text := 'SELECT * FROM FAXQ WHERE STATUS=0 FOR
>UPDATE';
> WCursor.APIFirst; // This line is causing the problem
> if WCursor.Eof then begin
> Log.Lines.Add('No faxes found ....');
> Shape.Brush.Color := COLOR_INACTIVE;
> Conn.Disconnect;
> Exit;
> end else begin
> ....
> // do some other stuff
> ....
> end;
> finally
> WCursor.Unprepare;
> WCursor.Free;
> Conn.Disconnect;
> end;
>
>When I call APIFirst, resources are being allocated that are not
>unallocated - I am using a program called MemProof to check this, and
>it reports that the API call (isc_dsql_prepare) is not freeing the
>resources as required.
>Is this a IBO issue or a gds32.dll issue, or
>is there something I am not understanding.
>
>I have run the app with the APIFirst commented out and the resources
>are not affected at all.
prepared and it never opens. So - not much resource use there.
But, errrrrm, take a fresh look at this block of code:
if WCursor.Eof then begin
Log.Lines.Add('No faxes found ....');
Shape.Brush.Color := COLOR_INACTIVE;
Conn.Disconnect;
Exit; <---- WCursor never gets destroyed !!!
end else
>Do I need to call WCursor.Prepare explicitly?It won't hurt; but you shouldn't need to.
The Prepare call does use resources, which will stay in use until Unprepare
is called. You don't actually need to call Unprepare at all, since you are
immediately destroying the cursor object. You only ever need to call it
for objects that you are going to keep on ice for later (occasional) use.
cheers,
Helen