[fpc-pascal] Question on how to avoid memory trouble using FindFirst(), FindNext() and FindClose()

Marco van de Voort marcov at stack.nl
Fri Feb 2 22:23:45 CET 2007

> Can anyone recommend a method to search a whole drive, of arbitrary
> size, without running out of memory.

I don't know seen SysTools, but I worked analysing logfiles for a year. All
containertypes (TList TObjectList and TstringList included) that have a
single array as internal datastructure become prone to fragmentation or
slowdowns when the number of elements get bigger.

A rule of thumb border is 50k-500k elements. 

So a simple plan would be:

- analyse what functionality is really used of TStringlist, since there is a
  lot of functionality there. 
- Take a more scalable containertype and graft it into SysTools.
- Avoid TStringList in own code, or at least mark such code in documentation
and memory as scalability risk :-)

More information about the fpc-pascal mailing list