>>14301390Essentially infinity. Running out of various resources just means changes in lifestyles and population sizes. The common threats cited as possibly wiping us out, be it climate change, nuclear war, bioweapons, meteor strikes, widespread famine, or any other popular reason, are all either not resource issues or things that will reduce population to a different carrying capacity rather than end it.
Certainly we can come up with unlikely things such as running out of soil but there's no danger of that happening. Depleting soil of nutrients would be a problem but only short term as nutrients do get renewed over time, especially in volcanic areas. Our population would greatly decline but would survive.