[DUG] Related try..finally question
Paul Heinz
paul at accredo.co.nz
Fri Jul 21 16:17:38 NZST 2006
Leigh wrote:
> I have done some coding and found that current issues for most programming
> is resource management i.e. memory allocation, TCP/IP connection
> allocation.
> If an application can manage resource well, the application will run very
> good. I am very relucant to give up this control to someone else to manage
> it. Delphi 7 gives me reasonable control over this sorts of issue. ;-)
I assume this is in reference to 'using' and .NET references implying
garbage collection.
Firstly, 'using' as a C# language semantic is distinct from garbage
collection.
using (a = new blah)
{
a.stuff
a.stuff
a.stuff
}
is purely syntactic sugar and equivalent to:
a = new blah
try
{
a.stuff
a.stuff
a.stuff
}
finally
{
a.dispose;
}
Manual (i.e. Delphi style) memory management (which is what garbage
collection resolves - other resources must still be managed as usual) is
overrated in my opinion. A well designed precise generational garbage
collector does just as good a job overall of managing memory as a developer
manually coding it, likely better if your object lifetimes and
interrelationships are complicated and your developer didn't miss anything.
In fact, in anything like the SQL parser, optimiser, and execution engine we
built, you end up spending a goodly chunk of your engineering and debugging
time writing fiddly lifetime management code i.e. a domain specific mini-
garbage collector anyway.
TTFN,
Paul.
More information about the Delphi
mailing list