Francois Piette wrote: >> Fastream Technologies wrote: >>> Interesting. Well I am using classes with string properties and I >>> thought the destructor of the AnsiString class cleans up the memory >>> before releasing it. >> >> Correct, in classes you don't need to release memory allocated for >> strings. But you need to finalize records containing dynamic strings, >> FreeMem or Dispose won't do this job. > > I don't agrre with you. > New/Dispose will do the job if they have the correct pointer datatype. > For example if you have a TList with pointers to record, doing: > Dispose(MyList[I]); won't correctly finalize dynamic members (long string > and others) in the record. Doing: > Dispose(TMyRecord(MyList[I])); will correctly finalize the record.
In fact, it works, however correct cast is PMyRecord(MyList[I]); I saw some leaks in older Delphi versions when I didn't finalize (may be due a mistake I made when I was a beginner?). Since this time I don't really on Delphi and free dynamic record members manually. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be