There's no need to use Assigned() since FreeAndNil() performs a similar test...
-Andreas -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Peter Speden Sent: Monday, 3 March 2003 08:19 To: Multiple recipients of list delphi Subject: RE: [DUG]: Freeing Stringlists. Try If Assigned (includelist) then FreeAndNil (includelist); Etc Or If includelist <> nil then FreeAndNil (includelist); They are not freed elsewhere are they. Peter Speden -----Original Message----- From: Alistair George [mailto:[EMAIL PROTECTED] Sent: Saturday, 1 March 2003 1:17 p.m. To: Multiple recipients of list delphi Subject: [DUG]: Freeing Stringlists. Hi all. I have a lot of trouble freeing string list. they are created in formcreate: procedure TMainform.FormCreate(Sender: TObject); var fversion: string; begin Appath := IncludeTrailingBackSlash(ExtractFilePath(Application.EXEName)); mainform.HelpFile := appath + 'back4winxp.hlp'; VCLzip1.DoProcessMessages := true; VCLzip1.FileOpenMode := fmOpenRead or fmShareDenyNone; TheReasonSummary := Tstringlist.Create; IncludeList := Tstringlist.Create; ZIPfiles := Tstringlist.Create; But in either case below, they cause a memory error when I close the form if they have not been used (below are in FormClose): try IncludeList.Free; except end; try ZIPfiles.Free; except end; try TheReasonSummary.Free; except end; try if sizeof(includelist) > 0 then IncludeList.Free; if sizeof(ZIPfiles) > 0 then ZIPfiles.Free; if sizeof(TheReasonSummary) > 0 then TheReasonSummary.Free; except end; The only working way I find is as follows: IncludeList:=nil; ZIPfiles:=nil; TheReasonSummary:=nil; Comments???? ------------------------------------------------------------------------ --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
