Cargo bench `memory allocation of 4900 bytes failed`

Using the command cargo bench leads to memory allocation of 4900 bytes failed resulting in error: bench failed.

As I am using bench I am using rust nightly.

I have no idea where to even begin looking into this error, any advice or suggestion at all are greatly appreciated.

Code: https://hastebin.com/eruxuyukol.php

Is it running out of RAM? Do you have enough virtual memory setup on your OS?

Maybe the benchmark is keeping memory between runs?

I've diagnosed such things by modifying cap to panic on allocation errors instead of returning null (which then causes abort).