clarify logic
reduce # of calls to realloc by using mongo-c-array for power-of-2 allocations