NumPy’s FFT implementation utilizes caches to speedup subsequent FFTs of the same size. This accumulates memory when run for various length FFTs as can readily happen in seismology.

This utility function clears both, full and real-only caches if their size is above the given threshold.

The default 100 MB is fairly generous but we still want to profit from the cache where applicable.