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

Michael Van Canneyt michael at freepascal.org
Sat Feb 3 12:13:46 CET 2007



On Fri, 2 Feb 2007, Marco van de Voort wrote:

> > 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.

If you approximately know the number of elements in advance, you can
reduce the fragmentation to nearly zero if you set the capacity of the 
list before filling it. It will also speed up the loading of the list.

Michael.



More information about the fpc-pascal mailing list