<div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr">Ryan Joseph <<a href="mailto:ryan@thealchemistguild.com">ryan@thealchemistguild.com</a>> schrieb am Fr., 25. Mai 2018, 10:24:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
> On May 25, 2018, at 3:18 PM, Michael Van Canneyt <<a href="mailto:michael@freepascal.org" target="_blank" rel="noreferrer">michael@freepascal.org</a>> wrote:<br>
> <br>
> I'm guessing you are not using strings either then, for performance reasons ? Because exactly the same happens there.<br>
<br>
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.<br>
<br>
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.<br></blockquote></div><div dir="auto"><br></div><div dir="auto">ShortString is limited to 255 chars. AnsiString and UnicodeString don't have that limitation and they are reference counted just like dynamic arrays.</div><div dir="auto"><br></div><div dir="auto">The type of "String" depends on the current settings:</div><div dir="auto">- $H-: String = ShortString (this is the default for all modes except the Delphi ones) </div><div dir="auto">- $H+ and "$modeswitch unicodestrings-": String = AnsiString (or AnsiString(CP_ACP) to be precise) (this is the default for mode Delphi) </div><div dir="auto">- $H+ and "$modeswitch unicodestrings+": String = UnicodeString (this is the default for mode DelphiUnicode) </div><div dir="auto"><br></div><div dir="auto">If I had to guess you were probably doing something with the arrays they weren't designed for. :/</div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><br></div><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div>