Allocations are slow.

The trick is to use a fixed-size buffer and only use as many elements as you need per run.

Incidentally, the maximum number of contracts available at any given run is MAX_CONTRACTS, so use MAX_CONTRACTS for your number of fixed buffer elements.