----- Original Message ----- From: "DrDiettrich" <[EMAIL PROTECTED]>
To: "FPC developers' list" <fpc-devel@lists.freepascal.org>
Sent: Tuesday, February 15, 2005 4:11 AM
Subject: Re: [fpc-devel] Bug in PWidechar and refcounting



Alexey Barkovoy wrote:
PAnsiChar, PChar are just pointers and not garbage collected by compiler. But
AnsiString and WideString are compiler managed types. So, as Peter mentioned,
behaviour you are seeing is by design.

In Delphi WideString is not reference counted at all. The layout of the string prefix is dictated by the Windows API (BSTR type), and AFAIK Windows also doesn't use reference counting with this type, or with OLEVariants containing wide strings.

In e-mail above I've not said anywhere about reference-counting, I've said WideString are managed by compiler. For example if you declare WideString local variable in procedure it will be automatically freed at the end of procedure in compiler generated "try ... finally" block. And if you declare PWideChar, allocate memory for it, when it's up to you to free this memory after you no longer need it.



_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to