I agree with ggeg -- it's probably lack of potassium. My internist also recommended a magnesium supplement. As soon as I started taking daily magnesium, my leg and toe cramps pretty much stopped altogether. I also eat an occasional banana for the potassium.
Could be you're not absorbing minerals very well, lack of potassium or iron can do this. Also could be you've got restless legs syndrom, you can read about it online. But since you had a gastro problem in the past, I'd put my money on the mineral thing.