Quote Originally Posted by Super Vegeta View Post
or maybe do something like NewLength := OldLength * 1.5.
I strongly recommend against using of this approach. Why? Because it leads to exponential growth of the array and could therefore become a great memory hog.
Imagine next scenario. You have an arrays with 100k items. Each item is 10KB in size. Which means that your array would be roughly 1GB in size. So following your approach adding 1 additional item would increase its size from roughly 1GB to 1.5GB in size. Or in other hand you would be wasting about 500MB of memory just because you had to increase the size of the array to hold additional item.
So I would rather suggest increasing the array in fixed increments instead.

Quote Originally Posted by Tomi View Post
Wow, thanks, Super Vegeta! I didn't know this technique about dynamic arrays. But using of it are not recommended because the resizing is complicated?
While dynamic arrays do allow you to change their size at any time you don't have to do this. If you want you can set their size at the start based on your expected requirement and don't update their size later on.
One instance of this would be using dynamic arrays to store game map. You know the map dimensions upon level loading so you set the size of dynamic array to be big enough to hold that data and you don't resize them until you decide to load different level.
So unless you are concerned about your game to be using as little memory as possible the whole time you don't need to be to much concerned about resizing of dynamic arrays you would probably do it rarely.