The swap trick is often suggested as a solution. I don't think it's guaranteed to work on all platforms or all situations, but it's commonly recommended so I'd give it a try.
Basically it swaps with a newly constructed vector that presumably has much smaller capacity. The vector swap likely just swaps internal pointers rather than copying anything, so it is fast. That's why small capacity of the temporary becomes the small capacity of my_data, and my_data's big capacity gets switched to the temporary, which is immediately destroyed and frees the memory.
my_data.clear(); // empty vector with high capacity
// swap trick: