SAN FRANCISCO — VISITORS have forever left their hearts in San Francisco. But leaving the rest of your body here isn’t so easy: there’s no place to live.

The City by the Bay is going through one of its worst housing shortages in memory. With typical high demand intensified by a regional boom in tech jobs, apartment open houses are mob scenes of desperate applicants clutching their credit reports. The citywide median rental price for a one-bedroom is $2,764 a month, but jumps to $3,500 in trendy areas.

One reason for the shortage? Me.

I’ve recently joined the ranks of San Francisco landlords who have decided that it’s better to keep an apartment empty than to lease it to tenants. Together, we have left vacant about 10,600 rental units. That’s about five percent of the city’s total — or enough space to house up to 30,000 people in a city that barely tops 800,000.

I feel a twinge of guilt for those who want to settle in this glorious city but can’t find a flat. But after renting out a one-bedroom apartment in my home for several years, I will never do it again. San Francisco’s anti-landlord housing laws and political climate make it untenable.