Why is the memory blowing up in this multi-threaded code?

The RES memory in htop increases and doesn’t go back to what it was before I ran the function. I’m not seeing this in Numba.