There are memory leaks after a sql query exception occured.
Posted: Mon 21 Jan 2008 12:00
Hi, Please help! I turned on memory leak detection option from D2007 with the following syntax:
I have created both TMyConnection and TMyQuery at TForm.Create event and freed them at TForm.Destroy. It will report memory leak if TMyQuery.Execute method runs a bad sql statement and raised an EMySqlException. In the other hand, if the sql statement is correct, there was no problem at all.
The leak message is:

I tried to prevent the code breaking up by catching exceptions, but this didn't help:
What should I do? thanks!
Code: Select all
ReportMemoryLeaksOnShutDown := true;The leak message is:

I tried to prevent the code breaking up by catching exceptions, but this didn't help:
Code: Select all
....
Query.SQL.Clear;
Query.SQL.Add(Sql);
try
Query.Connection.Connect;
Query.Execute;
except
on e: Exception do
LogToFile(e.Message);
end;
....