Cramping is the result of muscles being irritated, and many times the trigger at night is stretching.
Prolonged working on legs; heavy exercise
; low potassium
; venous valvular incompetence are common causes. Try stretching exercises, anti-inflammatory agents, ice massages, and if no relief, seek help of a phlebologist to evaluate your leg veins.