Autor Beitrag
Smartie
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mi 29.06.05 11:34 
Servus!

Also, meine Frage ist sicherlich absolut trivial, ich weiß die Antwort dennoch nicht:

Ihr kennt doch das Prozedere einen Speicher wieder frei zu geben, wenn man Ihn nicht mehr braucht. Tja, das ist bei mir nunmal der Fall, wenn ich meine interne Reset-Funktion auslöse, um alles auf Anfang zu setzen.


Jetzt ist das Problem nunmal, das diese Funktion immer ausführbar sein muß, schon aus Sicherheitsgründen. Ok, wenn der Speicher aber nicht vorhanden ist, und die Funktion wird ausgeführt, tja, dann krieg ich logischer Weise einen süße, kleine Exception.

Das würde ich gerne durch eine Abfrage abfangen so etwa:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
If MySList noch da is then
begin
  MySList.free;
end;


Ok, aber genau beim MySList noch da is haperts bei mir.

Wie stelle ich diese Abfrage?

Herzlichen Gruß und Danke


Smartie
Spaceguide
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 552


(D3/D7/D8) Prof.
BeitragVerfasst: Mi 29.06.05 11:59 
ausblenden Delphi-Quelltext
1:
if Assigned(MyObject) then FreeAndNIL(MyObject);					


Ich glaube aber, dass FreeAndNIL schon intern auf <>NIL abfragt.
Smartie Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 205



BeitragVerfasst: Mi 29.06.05 12:37 
Dankeschön, es funktioniert! *g*

Lieben Gruß

Smartie
Spaceguide
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 552


(D3/D7/D8) Prof.
BeitragVerfasst: Mi 29.06.05 14:40 
Was ich mich frage: Initialisiert Delphi Klassenattribute im Constructor und globale Referenzen bei Programmstart automatisch auf NIL?