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

Marco van de Voort marcov at stack.nl
Sat Feb 3 13:34:00 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.

The reallocations at the end hurt the most. So if you guess slightly too low it
still fails.

> It will also speed up the loading of the list.

(not if it is sorted).




More information about the fpc-pascal mailing list