Re: Rules to avoid memory leaks?
From: Allen Bauer (abauer_at_spicedham.borland.com)
Date: 10/20/04
- Next message: Kevin Berry: "Re: Stray inquiry about newsgroup population"
- Previous message: Michael Bennett: "Re: What Would Make Me Switch From Delphi 7 to Delphi 9 Win32 Programming In A Flash"
- In reply to: Nico Aragón: "Re: Rules to avoid memory leaks?"
- Next in thread: Nico Aragón: "Re: Rules to avoid memory leaks?"
- Reply: Nico Aragón: "Re: Rules to avoid memory leaks?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 20 Oct 2004 09:28:17 -0700
> Strings are "managed" but even a reference counter has to be updated.
> TObject.Destroy or the "end" of a block does it. But it didn't happen
> for the main block or the finalization block of a unit. I'm pretty
> sure to have read that it caused some RTL leaks, at least in older
> versions. Maybe it's been corrected?
"Managed" types, such as strings, dynamic arrays, variants and interfaces
should be freed automatically when the finalization is called (even if there
is no explicit finalization declared). This is only important for
dynamically loaded packages or dlls. For stand-alone exes, since the
finalization is called during process shutdown and Windows already takes
care of freeing *all* process memory, this actually isn't strictly
nessesary.
-- Allen Bauer Delphi/C#Builder Principal Architect Borland Software Corporation. http://blogs.borland.com/abauer
- Next message: Kevin Berry: "Re: Stray inquiry about newsgroup population"
- Previous message: Michael Bennett: "Re: What Would Make Me Switch From Delphi 7 to Delphi 9 Win32 Programming In A Flash"
- In reply to: Nico Aragón: "Re: Rules to avoid memory leaks?"
- Next in thread: Nico Aragón: "Re: Rules to avoid memory leaks?"
- Reply: Nico Aragón: "Re: Rules to avoid memory leaks?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]