Autor Beitrag
dirkil2
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130



BeitragVerfasst: So 05.12.04 23:54 
Ich habe folg. Methode (für die Frage unwichtige Sachen habe ich weggelassen):

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.getValues;
var
  blobField: TBlobField;
  qry: TIBQuery;
begin
  (*
     ...irrelevanter Code ...
  *)

  while not qry.Eof do
  begin
    blobField := qry.FieldByName('FELD1'as TBlobField;
    (*
       ...irrelevanter Code ...
    *)

    qry.Next;
  end;
end;


Muss ich am Ende der Methode blobField.Free aufrufen oder nicht?

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt.
bttb930
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 33



BeitragVerfasst: So 05.12.04 23:58 
nein, mußt du nicht.

wäre sogar ein fehler

Moderiert von user profile iconChristian S.: Zwei Topics mit einem Zeitunterschied < 1min zusammengefasst :roll:
dirkil2 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130



BeitragVerfasst: Mo 06.12.04 00:38 
Und warum? Allokiert FieldByName nicht Speicher dafür? Wer gibt diesen frei?
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Mo 06.12.04 09:09 
Hallo!

Nein, FieldByName belegt überhaupt keinen Speicher. Vielmehr gibt es dir einen Zeiger auf ein Objekt zurück, das bereits existiert, nämlich das geforderte Feld. Das Feld ist Teil des Datasets und wird von diesem zu gegebener Zeit freigegeben.

Cu,
Udontknow
dirkil2 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130



BeitragVerfasst: Mo 06.12.04 09:16 
Ok, das leuchtet mir ein.

Danke für die Erklärung!