Magnesium saves me too. I've had persistent leg cramps since my teens. If I look at my right calf the wrong way, it seizes up, especially after a night of drinking. All of that went away when I started taking 200mg supplements daily. Big, big difference.
Do you find a certain type works better? Last time I looked into it there were various types like malate and glycinate and I got a bit of analysis paralysis. I also get the leg cramps at night!
Citrate and oxide are laxatives. amazon basic is decent. Threonate is thought to be able to be best absorbed and available to brain. Also very expensive. For bulk, I buy at nootropics depot for Threonate or just Amazon basics.