try finally block around every Object.Create?
- by max
Hi,
I have a general question about best practice in OO Delphi. Currently, I but a try finally block around everywhere, where I create an object, to free that object after usage (to avoid memory leaks). E.g.:
aObject := TObject.Create;
try
aOBject.AProcedure();
...
finally
aObject.Free;
end;
instead of:
aObject := TObject.Create;
aObject.AProcedure();
..
aObject.Free;
To you think, it is good practice, or too much overhead? And what about the performance?