Ryan Joseph <r...@thealchemistguild.com> schrieb am Fr., 25. Mai 2018,
10:24:

>
>
> > On May 25, 2018, at 3:18 PM, Michael Van Canneyt <mich...@freepascal.org>
> wrote:
> >
> > I'm guessing you are not using strings either then, for performance
> reasons ? Because exactly the same happens there.
>
> really? I had a collection class with a dynamic array for the storage and
> that’s when I got the high CPU usage in the thread safe stuff. I replaced
> the storage with a pointer to a block of memory which I managed myself and
> the problem went away. I just wanted to a dynamic array that was fast,
> minimal and could append elements.
>
> I use lots of strings but I never had that problem. Are strings reference
> counted like dynamic arrays? I thought a string was just an array of 255
> chars.
>

ShortString is limited to 255 chars. AnsiString and UnicodeString don't
have that limitation and they are reference counted just like dynamic
arrays.

The type of "String" depends on the current settings:
- $H-: String = ShortString (this is the default for all modes except the
Delphi ones)
- $H+ and "$modeswitch unicodestrings-": String = AnsiString (or
AnsiString(CP_ACP) to be precise) (this is the default for mode Delphi)
- $H+ and "$modeswitch unicodestrings+": String = UnicodeString (this is
the default for mode DelphiUnicode)

If I had to guess you were probably doing something with the arrays they
weren't designed for. :/

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to