There are some contributing factors to leg cramps.....
1) Vitamin deficiency,
2) Heavy exercising,
3) Being over the age of 60
4) Being overweight
5) Electrolyte imbalances,
6) Muscle Fatigue or strain
7) Dehydration
Some possible medical causes related to the disease process are;
Calcium and phosphorus imbalances can cause cramping. Imbalances in these minerals can also occur when fluid levels in the body become low. B12 deficiency has also been shown to be a culprit of leg cramps. Low potassium or sodium (salt) levels. Peripheral neuropathy, a complication of diabetes in which the nerves in the extremities are impaired, can cause cramp-like pain. Overexertion, standing on concrete for long periods, or prolonged sitting (especially with the legs contorted) may contribute to nighttime cramps. Also, conditions like RLS (restless leg syndrome) can lead to leg cramps.
Electrolyte imbalances are generally considered the most common, main cause. A serum (blood) electrolyte level can help the Dr either rule this out or in. Some researchers believe inadequate stretching and muscle fatigue leads to abnormalities in mechanisms that control muscle contraction. Other factors may also be involved, including exercising or working in intense heat and dehydration.
Prevention of the cramps is the best cure; for that following measures should be employed:
Drink water at regular intervals, even when you are not thirsty and you should drink atleast 8-8oz of water per day.
If cramps occur frequently, stretching exercises help. Muscle relaxants are also used.
Following exercise may help you before you go to bed; Stand about 30 inches from a wall and, keeping the heels flat on the floor, lean forward and slowly move the hands up the wall to achieve a comfortable stretch.
While in bed, loose covers should be used to prevent the toes and feet from pointing upwards, which causes calf muscles to contract and cramp easily.
Keeping the feet elevated when you are at rest will also help.
Daily walking and wearing supportive footwear is also important.
I have included a link to a resource which tells you specifically about the night cramps;
http://www.mayoclinic.com/health/night-leg-cramps/AN00499
To date, the most effective treatments based on current research are:
Nurse
17 years exp. in all areas of nursing including emergency medicine, hospital, and private practice.