My husband dug up this info off of uptodate:
Stretching exercises – Posterior leg muscle stretching exercises are usually performed in the weightbearing position. The posterior leg muscles are stretched by leaning forward with the legs kept straight and the feet kept flat on the floor; the position is held for 10 to 20 seconds and stretches are repeated three to five times in succession, four times daily for the first week, then twice daily in the evening, and again before retiring thereafter (picture 1 <
https://www.uptodate.com/contents/image?imageKey=RHEUM%2F70744&topicKey=RHEUM%2F5177&rank=1%7E150&source=see_link&search=leg+cramps>) [https://www.uptodate.com/contents/nocturnal-leg-cramps/abstract/28]. Stretching before going to bed at night may be sufficient for some patients.
Evidence supporting the efficacy of stretching was provided by a randomized trial, involving 80 patients over 55 years of age with a mean of 3.2 to 3.4 cramps nightly [https://www.uptodate.com/contents/nocturnal-leg-cramps/abstract/29]. In the trial, a six-week program of calf and hamstring muscle stretching before sleep significantly decreased the frequency of nocturnal leg cramps compared with not stretching (mean difference of -1.2 cramps nightly, 95% CI -0.6 to -1.8). Additionally, cramp severity was decreased in the treatment group but not in the controls. Another clinical trial failed to confirm the benefit of this approach, although all of the trial patients were on quinine <
https://www.uptodate.com/contents/quinine-drug-information?source=see_link> at baseline, and many continued the drug during the trial [https://www.uptodate.com/contents/nocturnal-leg-cramps/abstract/28,30].
Other preventive measures that may be beneficial include nonpharmacologic physical measures and avoidance of potential triggers:
In generally sedentary patients, riding a stationary bicycle for a few minutes before retiring.
Using long-countered shoes and other proper foot gear. (See "Joint protection program for the lower limb" <
https://www.uptodate.com/contents/joint-protection-program-for-the-lower-limb?source=see_link>.)
Keeping the bed covers at the foot of the bed loose and not tucked in.
Patients may benefit from avoiding dehydration, particularly older adults and patients on diuretics; avoidance of drugs known to cause cramping (see 'Causes and pathogenesis' <
https://www.uptodate.com/contents/nocturnal-leg-cramps?source=search_result&search=leg%20cramps&selectedTitle=1~150#H3> above) and of alcohol and caffeine; and should avoid exercising in extreme heat.