There are various reasons for muscle cramps such as -
1. Improper blood supply.
2. Mineral depletion or deficiency.
3. Deposition of lactic acid during vigorous exercise due to lack of sufficient oxygen.
glucose (in absence of oxygen)---- lactic acid + 2ATP ( energy ).