[yunqa.de] TDISQLite3Statement memory leak?

I have a database with a  table that has "memo" type fields (variable length 
text that average out to about 4000 characters per record)

I am using TDISQLite3Statement to access the data, but the memory in my 
application keeps increasing and never returns.

The following example procedure is contrived but illustrates the code I am 
using to duplicate

I create a procedure called leak (dbs is a database opened previously), then 
run it multiple times as in:

for x := 1 to 10000 do leak;

I can't seem to find examples on the correct use of TDISQLite3Statement so 
perhaps there is something wrong with my code?

Interestingly if I substitute stmt2.close with stmt.free I don't get the memory 
leak, but I have never seen any examples that explicitly call the free method 
like this and am concerned this may cause other issues.

However from my reading of the list stmt.close is the correct way to finish off

Should the close method finalize things and free up memory?

Is this a bug, or is there a problem in my code?

Thanks
Clyde


  procedure leak;
    var
      stmt : TDISQLite3Statement;
      i : integer;
      data : string;
    begin
      stmt := dbs.prepare16('select longdescription from cmemo limit 1');
      i := stmt.step;
      while i = sqlite_row do
      begin
          data := stmt.Column_Str16(0);
           i := stmt.step;
      end;
      stmt.close;
  end;



_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
http://www.freelists.org/list/yunqa



Other related posts: