CToken[] public allMarkets; in contract ComptrollerV3Storage is an array where there are just pushes. No upper bound, no pop.
As this array can grow quite large, the transactions gas cost could exceed the block gas limit and make it impossible to call this function at all here:
Consider introducing a reasonable upper limit based on block gas limits and adding a method to remove elements in the array.
