And I found those arries who were been resized for around 10 times (the size grow 1 each time) are ok. but others who are resized for more than 40 times (size grow from 0 to 40+), the program throw a memory violation and crushed.
SetLength is fine. You seem to simply run out of memory.
The short answer: Use TStringList (for strings, otherwise TList or similar), instead of array.
The long answer:
If you do "SetLength(MyArray, length(MyArray)+1);" (or any other value instead of +1)
Then the old memory is "freed" That is, the old memory is added to a pool of "memory that can be re-used". So in your OS you will not see memory shrinking (doing so would be slower).
If you do a lot of such "SetLength", then they will all add there old memory to that pool. They will try to re-use memory from that pool too. But that pool can become fragmented. Then it has lots of small bits of memory (summing up to a huge amount), each to small to be re-used.... => And your app keeps using new mem, until there is none left.
So instead of doing 10 times "+1", you should do 1 time "+10". Pre-allocate what you will need later.
TList/TStringList have that build in (it's called capacity).