Last winter I started having horrible problems with leg and foot cramps. I mean I would get them in both legs at the same time while sleeping - two Charley Horses at once. Talk about pain. Then for a while, if I moved my feet the wrong way I would get horrible foot cramps. I still get them but not as much.
I asked the physical therapist and she said Gatorade and stretching are a good combination to get rid of them. However the theory of potassium lack and dehydration as causes of leg cramps is not true - no research has proven dehydration or lack of potassium are causes. Meaning if you eat a banana, it will make your leg cramps go away. They are considered a real cause of sleep deprivation and get more common as you age.
They can be caused by medications and some more serious conditions such as "akathisia, myelopathy, peripheral neuropathy and disorders of calcium imbalance". Other diseases including diabetes can cause them as well. But there is a group of benign, idiopathic leg cramps that they have no idea what causes them and they will make it difficult for you to sleep. With my luck I think that's what I have. And they don't really know what causes them. Research has not proven that dehydration or low potassium have anything to do with them.
Although they have been better they are not gone. The best thing I do for them is stretch a lot when I go to the gym. This week I am not going to the gym, so I will look forward to benign, idiopathic, sleep wrecking leg cramps.