Subj : Re: largest memory block To : borland.public.cpp.borlandcpp From : Mohsen Date : Thu Mar 24 2005 01:32 am >Have you determined that this is a problem in an application of yours, >or are you afraid it may become one in the future? It is a proplem for an application of mine right now. I have to deal with huge arrays say of 1000000 elements or more. Using an array of the following type makes the growing process slow: TArray Nodes(100, 0, 100); Because, the application has to make 9999 reallocations to accomodate 1000000 elements. Consider another example: TArray Nodes(100000, 0, 100000); When reallocating, the occupied memory is 300000, because it needs to keep the original array and also allocate a new block of 200000 elements to deposit the previous array into it. And if it cannot do that the program crashes. > > > >I don't understand this. What is less efficient than what here? Comparing previous examples show what is less efficient than the other. Reducing the array size and its growth delta increases the number of reallocations, while reversing the process reduces the number of reallocations and increases the possibility of crashing. I think I could clarify what my problem is. In my mind allocating the largest possible value for the array size can be more efficent if we now the value in advance. Mohsen .