what causes swelling in both legs and feet

I have swelling in both my legs and the doctor said its edema,I’m a heavy set woman and I have diabetes,plus high blood pressure. Sometimes the swelling goes down then other days they swell up really big making it hard to walk or put on my shoes. Can someone please explain to me what it could be.