I've been suffering occasional painful leg cramps for years, and in more recent times I've often been disturbed in the night by less painful but annoying foot cramps. Finally, four days ago, I thought of reading Wikipedia on the subject of cramp, and found that cramp can be caused by a variety of things, one of them being not enough salt.
This was interesting, because I know that an excess of salt is harmful, and so for many years I've avoided adding salt to food. What I didn't know was that a salt deficiency can also be harmful.
Wikipedia tells me that the recommended daily intake of salt is less than a teaspoonful. So, for the last four nights I've been taking a small amount of salt dissolved in water before going to bed. So far, it seems to work: I haven't had any more cramps. Magic.