[fpc-pascal] Freeing memory with exceptions

Thomas Kurz fpc.2021 at t-net.ruhr
Fri May 26 09:25:09 CEST 2023


I do not think that this discussion is of any value. If you need to care for every byte, you'd better consider using asm. In times of e-mail clients using far more than 100 MB of disk and RAM memory or simple Android apps having several dozens of megabytes because of the included trackers, it seems ridiculous to discuss about 39 bytes!


----- Original Message ----- 
From: Benito van der Zander via fpc-pascal <fpc-pascal at lists.freepascal.org>
To: fpc-pascal at lists.freepascal.org <fpc-pascal at lists.freepascal.org>
Sent: Thursday, May 25, 2023, 22:49:08
Subject: [fpc-pascal] Freeing memory with exceptions

Hi,


> That 99.99% of people does use it, indicates they simply take the 
> overhead because
> of the advantages that the managed types offer. 

Or they simply do not know about the overhead

Like I was writing all my code on Windows 98, and never noticed any 
overhead, until I started running benchmarks on  Linux.

Bye,
Benito
On 25.05.23 07:58, Michael Van Canneyt via fpc-pascal wrote:


> On Thu, 25 May 2023, Hairy Pixels via fpc-pascal wrote:



>>> On May 24, 2023, at 10:11 PM, Sven Barth via fpc-pascal 
>>> <fpc-pascal at lists.freepascal.org> wrote:

>>> You must have $H+ on and those are AnsiStrings? Why is there 
>>> exception handling involved with AnsiString? I guess it needs this 
>>> just in case an exception is thrown somewhere in the call stack?

>>> Because Ansi- and UnicodeString are managed types. *All* managed 
>>> types managed string types, interfaces, Variants, managed records) 
>>> must be finalized correctly even if an exception occurs.


>> That's a problem with exceptions then, they are baked into the language
>> and impose a cost on all managed types now even if we use them or 
>> not. Even disabling the implicit stack frames (forgot what it's 
>> called) doesn't
>> get around this right?

> Why do you insist it is a problem ?

> Simply don't use managed types and don't use exceptions if you don't 
> like the
> overhead they cause. It's still perfectly possible: avoid the sysutils 
> unit
> and you're all set. The system unit does not use exceptions.

> That 99.99% of people does use it, indicates they simply take the 
> overhead because
> of the advantages that the managed types offer.

> Which is not to say that FPC should not strive to minimize the overhead.
> Conceivably there is some gain possible on non-windows platforms.

> Michael.
> _______________________________________________
> fpc-pascal maillist  - fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list