Board index » cppbuilder » Re: Limits on TStringList and SaveToFile

Re: Limits on TStringList and SaveToFile


2006-03-14 02:01:25 PM
cppbuilder72
"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote

"JD" < XXXX@XXXXX.COM >wrote in message
news:44131fef$ XXXX@XXXXX.COM ...

>The original question was:
>
>Is there any limit on maximum number of strings
>in a TStringList
>
>According to your description, that is correct.

You said that the limit is the maximum value that the Count property can
hold. That is not correct. The true limit is less than that.
What is the actual number for max Count?
If all of the Strings were a single character, how many
strings could it have?
~ JD
 
 

Re:Re: Limits on TStringList and SaveToFile

"JD" < XXXX@XXXXX.COM >wrote in message
Quote
What is the actual number for max Count?
Please re-read my earlier replies. I already explained that.
Quote
If all of the Strings were a single character, how
many strings could it have?
If every string only held 1 character, each string in the TStringList would
take a minimum of 22 bytes per string - 8 bytes for the TStringItem
structure that TStringList holds, 12 bytes for AnsiString's internal data,
and 2 bytes for the character data (the single character plus the null
terminator). Now take into account that TStringList can only allocate up to
2GB of contigious memory for just its array of TStringItem entries, so you
get 268,435,455 items maximum (2GB divided by 8). Now take into account the
additional memory allocated for each individual string being pointed to by
those entries, and that limit lowers to a maximum of 97,612,893 items (2GB
dividied by 22). Now take into account all of the memory already being used
for everything else in the application, and every other application running,
and the OS in general, and that limits drops further.
Gambit