Oil companies have a history of over-spending on ambitious projects and acquisitions during boom times only to see returns crushed when the commodity cycle turns.

Investors will be reading the third-quarter tea leaves to discern whether executives plan to boost dividends and buybacks, hike spending on shiny new mega projects, or perhaps even do both.

What they do know is that fresh sources of oil and gas are needed over coming decades to meet increasing demands for energy. Spending too much would defy the new-found commitment to financial discipline, while spending too little could choke new supplies and raise crude prices. Higher prices, in turn, may brighten the appeal of green technologies that would hasten the industry’s demise.

“We’ve certainly seen more discipline in the oil patch than we really ever have,” said Burns McKinney, a Dallas-based portfolio manager who oversees $13 billion at Allianz Global Investors, speaking to Bloomberg. “Management are more wary about which projects they take on. But discipline never lasts forever.”

Oil companies need to develop the equivalent of 670 billion barrels of crude — about seven times Exxon Mobil’s total worldwide holdings — by 2040, largely to offset dwindling output from older fields, according to the International Energy Agency. And even as some in the industry openly question whether oil demand will peak because of the onset of electric vehicles, oil companies must still invest to find more crude. The financial costs will be enormous.

The good news is that Big Oil has plenty of cash to invest. The industry will generate $175 billion in free cash flow this year, about as much as it did over the previous five years combined, according to consultant Rystad Energy. Third-quarter earnings will be about 45 percent higher than a year earlier and the most since 2014, according to Morgan Stanley.

That mimics the 45 percent year-on-year rise in international oil prices to a third-quarter average of $75.84 a barrel.

The bad news is oil companies have a history of over-spending on ambitious projects and acquisitions during boom times only to see returns crushed when the commodity cycle turns. For examples, look no further than Exxon’s $16 billion investment in Canadian oil sands over the past decade and Chevron’s Gorgon liquefied natural gas operation in Australia, where costs swelled by almost half to $54 billion.

There are signs it may be different this time. Both US supermajors replaced long-time CEOs since the 2014-2016 downturn, appointing former refining chiefs who oversaw penny-pinching business units. Spending on oil production is down 37 percent globally over the past four years, according to Wood Mackenzie.