How? There's a $3000 cap on THL against regular income and capital gains is only taxed at 15%. $1M in realized capital gains is a pretty extraordinary circumstance.
Every portfolio has a mix of gains and losses if it's well diversified. I have gains that offset the losses elsewhere, but a reasonable chunk of those gains is offset by losses realized in parts of the portfolio that didn't do so well.
If you have a diversified portfolio that is all gains, I think you're probably not actually diversified.
So if you have $50,000 in capital gains and $53,000 in capital losses, your gains are "free". And you can deduct the extra $3k from ordinary income.
You can also carry capital losses forward each year.