[fpc-pascal] try..finally vs interfaces performance

Marcos Douglas md at delfire.net
Thu Apr 14 15:15:18 CEST 2016


On Thu, Apr 14, 2016 at 5:19 AM, Mazola Winstrol <mazofeifer at gmail.com> wrote:
> Recently i did some maintenance in a code of a colleague. I realized that he
> designed several classes with interface support so he do not need to protect
> the code blocks with try..finally to ensure that the instances are released
> from memory.
>
> Theoretically, which solution has higher performance? The traditional
> approach (code protected try..finally) or classes with interfaces (no need
> to protect the code. by otherside, classes with interfaces support have lock
> operations)?

Hi,

I don't know the answer but I think should be exactly the same.
Even if not, I strongly recommend you to use interfaces instead
"try-finally" approach
because you gain more than just automatic memory release.

Regards,
Marcos Douglas

PS. I have a blog about Object Pascal. I write about real
object-oriented approach.
The blog is written in Portuguese but using Google Translate I guess
you won't have
problems to translate.

http://objectpascalprogramming.com/



More information about the fpc-pascal mailing list