>>70
you really need more information on the problem to make a proper decision.
If non of the strings will escape the body of the function, every single one of them can be allocated on the stack. With this you will have trivial allocation and deallocation, giving good performance, and there will be absolutely no fragmentation, giving good memory use.
If all of the strings will persist throughout the lifetime of the program, and their values are known at compile time, they ought to be statically allocated and constant.
If the strings really need to have dynamic extent, then you have a few options. One is to use the malloc free interface, in which you ask for a block of memory of an arbitrary length, and a search will find and reserve a block for you until you later release it with free. Fragmentation is unavoidable, and will waste memory. The search for large enough blocks can become expensive once the free space is cut up and crowded by many reserved blocks. Another option is to use a garbage collector. With the freedom to move objects around, fragmentation can be eliminated. Usually there is an additional cost and complexity of the garbage collection traversals, but in the case of strings and other data types that contain no references, they can be reference counted. And then there are memory pools, which are more effective when you are allocating many objects of the same size. With memory pools allocation is trivial and fragmentation is avoidable. But the problem is that strings are not fixed length in general, and the generality of the malloc free interface is more appropriate.
>Or would you really have me believe that the best course of action is to allocate room for 1000 strings and only use 10 if needed.
If the application is ever in a state in which it couldn't handle 1000 strings, and it might happen, then the application is insecure. Even if you handle the error and prevent a segfault, it is still a failure if you can do nothing but gracefully halt the application. You have to do everything you can to prevent this from happening on the platform you are targeting.
The dynamic memory allocation functions return error values if they fail. So what excuse do you have to not use them, unless you're a moron who doesn't check?
I can only assume that you are assuming that the memory allocation function will give the same results in performance and memory use regardless of its interface.