Page 1 of 1

Ibquery create and free memory

Posted: Wed 09 Dec 2009 14:49
by calou
Hello,

I do this code :

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
query: TIBCQuery;
tranc: TIBCTransaction;
begin
  query:= TIBCQuery.Create(self);
  query.AutoCommit:= false;

  tranc:= TIBCTransaction.Create(self);
  tranc.DefaultConnection:= IBCConnection1;

  query.Transaction:= tranc;

  query.Connection:= IBCConnection1;
  query.SQL.Text:= 'SELECT * FROM data_10min';
  query.Open;

  if tranc.Active = true then begin
    tranc.Rollback;
  end;

  tranc.Free;
  query.Free;

end;
My problem is when i click on the button the RAM increase by 1M and when i call the free method the 1M are not freed (seen in the task manager)

Thanks for help

Regards

Posted: Wed 09 Dec 2009 16:12
by uko
Hello,

have you tried to use FastMMs debug options to see if there is a real memory leak? (also for older Delphi versions available).


best regards,
Ulrich

Posted: Fri 11 Dec 2009 08:50
by Plash
This may occur because Delphi memory manager does not return memory to the operating system. When an application frees a memory block, this block is returned to the memory manager and is marked as free. Memory manager may not return this block to the operating system. It reserves this block for the future use.

Posted: Fri 11 Dec 2009 10:38
by calou
Thanks plash for the answer