This can be a sign of a serious condition called a Deep Vein Thrombosis, especially if the swelling is accompanied by a warm feeling of the skin, decreased pulses below the swelling or any redness and pain (though these other symptoms don't have to be present). This is dangerous because it is a clot that can break off and travel through the blood stream to the heart, brain or lungs. The possibility of a DVT needs to be ruled out. Your doctor can preform an ultrasound evaluation to determine whether there is a clot present. In the meantime, do not massage the area and keep the leg elevated when the swelling is present.
This can also be a sign of impairment of venous return. In this case, you would want to keep the leg elevated at the time of the swelling and do range of motion exercises to help with venous return to the heart. I would strongly suggest that you have the clot ruled out first just to be safe, though this may be all that is going on.
I hope that you seek evaluation for this. I hope this has been helpful to you; please remember to press ACCEPT and feel free to contact me if you have anything to add!