Resize the memory cache before entering the loop.
Resize the memory cache before entering the loop.

This prevents the vector to be reallocated if the size exceeds the capacity of
the vector causing invalid pointer accesses.

Fixes ROOT-7749.

karies/cling,karies/cling,root-mirror/cling,root-mirror/cling,karies/cling,karies/cling,root-mirror/cling,karies/cling,root-mirror/cling,root-mirror/cling,karies/cling,root-mirror/cling