on macOS (/ OS X), if someone else is having trouble with the OS apparently leaking memory:
- https://github.com/phvu/cuda-smi is useful for quickly checking free memory
- Quitting applications seems to free the memory they use. Quit everything you don't need, or quit applications one-by-one to see how much memory they used.
- If that doesn't cut it (quitting about 10 applications freed about 500MB / 15% for me), the biggest consumer by far is WindowServer. You can Force quit it, which will also kill all applications you have running and log you out. But it's a bit faster than a restart and got me back to 90% free memory on the cuda device.