We are allocating here, here and here.
We should be reusing the capacity of these data structures rather than dropping and reallocating them every time we solve. I was too tired to implement this initially, but eventually we should do it.