6
votes
Creating multiple objects using try-finally
Olaf Monien
– One of the most used object-oriented patterns is probably this one: foo := TFoo.create; try //do something with foo finally foo.free; end; It basically means, that if you create an instance of some class and if there is no “owner” who takes care of the new instance’s life cycle, then it is your responsibility to destroy the instance again, as soon as you are done with it. If you don’t care about freeing the objects you created, then you will get “memory leaks”, i.e. you app will use (possibly a lot) more memory as it should. The technique above is ...
Statistics
|
Visits by Source |
User Actions |



