At the recent Gold Coast Marathon, I felt cramping coming on around km 30, 32 and 36, and each time I ‘ran goofy’ splaying my legs wide and bouncing for 50m or so and it fixed it right up.
I’m an adherent to the train of thought that cramping is about exhaustion and neural pathways, not salt or hydration. See Are cramps caused by lack of salt? and Got Cramps? Here’s How To Stop Them for a good introduction to that view.