Cramping at night or during your workout is a very common problem. The first thing to know is that it is almost never a potassium deficiency. That is actually the last thing that I would suspect (and if it is, avocados are a much better source than bananas). It is normally dehydration, a magnesium deficiency or not enough salt.
Take a sweat soaked shirt and hang it to dry. If it has any white crusty or chalky stuff on it then you excrete a lot of salt in your sweat. Add a teaspoon of salt to your workout drink (the sweetness from a glutamine mixture should mask it. I really like Beverly International Glutamine Select plus BCAAs).
For your magnesium (if it’s not salt, it is probably magnesium). Make sure that you are taking a Magnesium Orotate (1 gm 2 hours before WX and 1 gm before bed)-The Orotate carrier improves absorption and moves the magnesium directly to the muscles. You can also try daily Epson salt (Magnesium Sulfate) baths, especially after leg Wx. Use 1-2 cups in hot water (As hot as you can stand without getting burned) for a 20 minute soak. Try to stay completely submerged (chin deep). This is the only way I encourage heat after a Wx and is great for recovery. Transdermal Magnesium is also great. There are a few products out there, I really like Designs for Health’s MagneDerm. Rub it on your neck and your tension headache is gone in 5 minutes. Great Product!
If none of these things work…there may be some adhesions causing the problem. If that is the problem you will likely cramp in almost the same place every time. The Foam roller and Active Release Therapy are your best options to correct it quickly.
To avoid lesions checkout my previous posts on workout recovery, especially the one on shake outs.
Less frequent causes are neurological (possibly related to a deficiency of something) and will take more digging and tests. It may be wise to have a MicroNutrient test done to rule out any specific cellular deficiencies. It’s a good test for finding suspicious nutrient deficiencies.