ok, but there still a problem.
I've just tried with last release 5.4 under Delphi XE7 and Windows 8.1
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
begin
IBCQuery1.SQL.Text := 'SELECT COUNT(*) FROM MYTABLE';
IBCQuery1.Execute;
ProgressBar1.Max := IBCQuery1.Fields[0].AsInteger;
ProgressBar1.Step := 1;
ProgressBar1.Position := 0;
IBCQuery1.SQL.Text := 'SELECT * FROM MYTABLE';
IBCQuery1.Execute;
while not IBCQuery1.Eof do
begin
ProgressBar1.StepIt;
Application.ProcessMessages;
IBCQuery1.Next;
end;
ShowMessage('Done1');
IBCQuery1.Close;
ShowMessage('Done2');
end;
the memory consumption still growing until the close without any memory leak.
In my case I went to an Out of Memory error before the end.
DeferredBlobRead partially resolve the problem, but there still a abnormal memory consumption when I do access the blob stream
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
blob: TField;
stream: TStream;
begin
IBCQuery1.SQL.Text := 'SELECT COUNT(*) FROM MYTABLE';
IBCQuery1.Execute;
ProgressBar1.Max := IBCQuery1.Fields[0].AsInteger;
ProgressBar1.Step := 1;
ProgressBar1.Position := 0;
IBCQuery1.SQL.Text := 'SELECT * FROM MYTABLE';
IBCQuery1.Execute;
blob := IBCQuery1.FieldByName('MYBLOB');
while not IBCQuery1.Eof do
begin
ProgressBar1.StepIt;
Application.ProcessMessages;
stream := IBCQuery1.CreateBlobStream(blob, TBlobStreamMode.bmRead);
AllocConsole;
WriteLn(Stream.Size); // without this, the stream seems to do nothing
stream.Free;
IBCQuery1.Next;
end;
ShowMessage('Done1');
IBCQuery1.Close;
ShowMessage('Done2');
end;
you probably have a kind of garbage collector for Blob streams that avoid memory leaks after the close, but I think that you should explicitly release things before that.
Regards