#1 2023-06-08 01:17:36

zhangguichao
Member
Registered: 2023-03-21
Posts: 29

ISQLDBRows always causes memory leaks in lazarus

ISQLDBRows always causes memory leaks in lazarus(fpc3.2.2)

When executed
The ReleaseRows method  and then set it to nil  sad

Offline

#2 2023-06-08 06:33:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,355
Website

Re: ISQLDBRows always causes memory leaks in lazarus

I am not able to reproduce it.
Create a gist with a minimal reproducible sample of this.

Ensure you read and follow https://synopse.info/files/html/Synopse … l#TITL_195 advices.

Offline

#3 2023-06-08 07:35:46

zhangguichao
Member
Registered: 2023-03-21
Posts: 29

Re: ISQLDBRows always causes memory leaks in lazarus

this is  my code :

var
  stmt: ISQLDBRows;
  oledbP: TOleDBMSSQLConnectionProperties;
begin
   oledbP := TOleDBMSSQLConnectionProperties.Create(oleServer, oleDB, oleUser, olePwd);
  try
    stmt := oledbP.Execute('select * from test ', []);
    while stmt.Step do
    begin
      //do something
    end;
  finally
    stmt.ReleaseRows;
    stmt := nil;  -------> call   memory leaks   (Use Heaptrc Unit check for mem-leaks)(-gh)
    oledbP.Free;
  end;
end; 

lazarus --2.2.0
fpc --3.2.2

Last edited by zhangguichao (2023-06-08 07:36:34)

Offline

#4 2023-06-08 08:33:18

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,355
Website

Re: ISQLDBRows always causes memory leaks in lazarus

What is leaked?

Try to debug a little more and report if you find the root cause.

Offline

#5 2023-06-08 08:49:30

zhangguichao
Member
Registered: 2023-03-21
Posts: 29

Re: ISQLDBRows always causes memory leaks in lazarus

I'll look into the compiler again, and thank you.

Offline

Board footer

Powered by FluxBB