Memory Leak Using TMyConnection and TMyQuery
Posted: Tue 09 May 2006 05:58
I am creating a connection and query at runtime. The query fires a lot. There is unquestionably a memory leak in the lower level procedure and I have tested all of the other components for leaks, without success. So I am trying to figure out if TMyQuery is the problem.
I'm a pretty new user of MyDAC so I'm figuring there is something obvious I am missing. I urgently need help on this as it is a key part in a project that needs to be delivered soon.
Thanks
Frank
Here is pseudocode that captures the MyDAC parts of the routine:
[/list]
I'm a pretty new user of MyDAC so I'm figuring there is something obvious I am missing. I urgently need help on this as it is a key part in a project that needs to be delivered soon.
Thanks
Frank
Here is pseudocode that captures the MyDAC parts of the routine:
Code: Select all
ProcedureA(. . .);
var
Connect: TMyConnection;
I: Integer;
begin try
Connect := TMyConnection.Create(Self)
//configure the connection and open it
For I := 0 to 200000 do begin
ProcedureB(Connect, . . . );
//store results of call
end;
finally
Connect.Free;
end;
ProcedureB(Connect: TMyConnection, . . . );
var
Q: TMyQuery;
begin try
Q := TMyQuery.Create(nil);
Q.Connection := Connect;
With Q do begin
//Add strings to the SQL property
Open;
// Store the results in local data structures
Close;
end;
finally
Q.Free
end;
end;