Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#4

Re: How to: Dynamic array auto resize

  Alt 13. Jan 2010, 16:44
Why do you ask, if you already know it?

Resizing an array inside a loop is not recommended because of the internal memory management. If you resize a dynamic array the new memory is allocated and then the contents of the old array is copied into the new allocated memory. This takes time and wastes memory because the old memory is not freed.

It is better if you estimate the space needed and resize the array once if you need more entries. If you have finished you truncate the array to its entries.
Michael
Ein Teil meines Codes würde euch verunsichern.