Board index » delphi » I think I hit the limit on the number of strings in a TStringList ?

I think I hit the limit on the number of strings in a TStringList ?

I am using a TStringList, and I think I hit the capacity limit on
the number of strings, I get a "List index out of bound" exception
by executing the TStringList.Add() method, a large number of time.

my question is :

  Is it possible? is it really not a dynamic data structure, as
 the word LIST suggests?

   Maxime Levesque

 

Re:I think I hit the limit on the number of strings in a TStringList ?


On Sat, 28 Dec 1996 23:22:34 -0500, Maxime <leve...@jsp.umontreal.ca>
wrote:

Quote
>I am using a TStringList, and I think I hit the capacity limit on
>the number of strings, I get a "List index out of bound" exception
>by executing the TStringList.Add() method, a large number of time.

>my question is :

>  Is it possible? is it really not a dynamic data structure, as
> the word LIST suggests?

Nothing is infinite. It is simply a question of which limit one
encounters first. TStringList in Delphi 1 has a limit of slightly
under 16K items. In Delphi 2, the limit is much higher, so you will
run out of memory before running out of list items. Secrets of Delphi
2 tells you how to define a string list class that uses LongInt
indexes, so the limit is available memory, as in Delphi 2.
--
Ray Lischner, Tempest Software, Inc., Corvallis, Oregon, USA
Author of Secrets of Delphi 2 (http://www.tempest-sw.com/secrets/)

Re:I think I hit the limit on the number of strings in a TStringList ?


On Sat, 28 Dec 1996 23:22:34 -0500, Maxime <leve...@jsp.umontreal.ca>
wrote:

Quote
>I am using a TStringList, and I think I hit the capacity limit on
>the number of strings, I get a "List index out of bound" exception
>by executing the TStringList.Add() method, a large number of time.

>my question is :

>  Is it possible? is it really not a dynamic data structure, as
> the word LIST suggests?

>   Maxime Levesque

Take a look at Delphi's help for the capacity property. It states that
the upper limit for the number of items in a list is 16,380 (2^14-4).
This is because each item has a 4-byte pointer, and all the pointers
must fit in a 64k memory block.

Re:I think I hit the limit on the number of strings in a TStringList ?


In article <32c8ce78.14453...@news.proaxis.com>,
   li...@tempest-sw.com (Ray Lischner) wrote:

Quote
>On Sat, 28 Dec 1996 23:22:34 -0500, Maxime

<leve...@jsp.umontreal.ca>

Quote
>wrote:

>Nothing is infinite. It is simply a question of which limit
one
>encounters first. TStringList in Delphi 1 has a limit of
slightly
>under 16K items. In Delphi 2, the limit is much higher, so
you will
>run out of memory before running out of list items. Secrets
of Delphi
>2 tells you how to define a string list class that uses
LongInt
>indexes, so the limit is available memory, as in Delphi 2.

Just one question. Is TStringList implemented as a resizable
array of pointers, or as a traditional linked list? It seems
to me that the first choice is more likely. In this
case, each TStringList would require its own selector. The
apps I have been written use TStringList heavily (for all
kind of lists). Does it mean that if I have too many
TStringList, I may run out of selectors in D1/Win3.1?

Quoc Thang NGUYEN
Laboratory of Cellular and
Molecular Neurobiology
Dept. of Psychobiology
University of California, Irvine
Irvine, CA92717 USA
Ph: (714) 824-4730
Fx: (714) 824-3522

Re:I think I hit the limit on the number of strings in a TStringList ?


On Mon, 30 Dec 96 16:32:26 GMT, qngu...@parker.bio.uci.edu (Quoc Thang

Quote
Nguyen) wrote:
>Just one question. Is TStringList implemented as a resizable
>array of pointers, or as a traditional linked list? It seems
>to me that the first choice is more likely. In this
>case, each TStringList would require its own selector. The
>apps I have been written use TStringList heavily (for all
>kind of lists). Does it mean that if I have too many
>TStringList, I may run out of selectors in D1/Win3.1?

TList and TStringList are implemented as arrays that grow as needed.
Delphi 1 uses a suballocator for dynamic memory requests, reducing the
number of global memory blocks allocated from Windows. I would not
worry about running out of selectors, but if you do, you can adjust
the suballocator parameters to cause Delphi to allocate fewer, larger
global blocks. See the online help for System unit variables and typed
constants. Read about HeapLimit and HeapBlock.
--
Ray Lischner, Tempest Software, Inc., Corvallis, Oregon, USA
Author of Secrets of Delphi 2 (http://www.tempest-sw.com/secrets/)

Other Threads