Hi, * Mutt wrote:
Perhaps you can waste some memory with a geometric progression compared to an arithmetic progression (but this is not obvious, as the fragmentation may be lower), but the time complexity should be better. I'd say O(n) instead of O(n^2^). See [http://en.wikipedia.org/wiki/Dynamic_array]. But all this depends on the malloc routine and how blocks are allocated.
Even 2000 files in a directory you browse with mutt are quite a lot, and that would be 1 calloc() and 7 realloc() calls. I think there're areas in mutt where memory management needs to be improved first than this one... what gains do you expect from such an optimization?
Rocco