“We’re looking at a brick wall five years down the road,” Eli Harari, the chief executive of SanDisk, said to me earlier this week.

Brendan McDermid/Reuters

In 1990, when SanDisk, which he founded, shipped its first generation of flash memory — the sort that can remember information even after you turn off the power — each chip stored four million bits of information. Today, the biggest chip SanDisk makes holds 64 billion bits.

In other words, the capacity of flash chips has doubled 14 times in 19 years. That’s faster, Mr. Harari boasted, than Moore’s Law — the observation by Gordon Moore, the co-founder of Intel, that the capacity of semiconductors doubles roughly every two years.

Normally, when I’ve talked to chip executives about the limits of Moore’s Law, they are confident, in a vague sort of way, that they will be able to continue to increase the capacity of their chips one way or another.

Mr. Harari was a great deal more precise about the brick wall his company is heading toward: “We are running out of electrons.”

“When we started out we had about one million electrons per cell,” or locations where information is stored on a chip, he said. “We are now down to a few hundred.” This simply can’t go on forever, he noted: “We can’t get below one.”

SanDisk and other flash memory makers have figured out how to cram even more information into that tiny cell. Until a few years ago, each of those cells worked the way most computer memory does — it represented either a zero or a one. Now the chip can actually count how many electrons are in a cell, and depending on the number it can write and read up to 16 states (recording a number between zero and 15, or four bits to a computer).

Let’s stop for a second to take stock of the wonder of all this. The last flash memory card I bought for my camera held two gigabytes (16 billion bits). It cost me $6. And somewhere inside it is something that is counting electrons 40 at a time. An electron, in case you forgot your high-school physics, has a radius of 2.8179 × 10−15 meters. In layman’s terms it is pretty much the smallest thing you could ever count.

The problem here is that the way current flash technology stores those electrons, they don’t always follow instructions, especially as the memory card gets older.

“When you have a billion cells, you cannot uniformly control them to one electron,” Mr. Harari said. “If I want 40 electrons, plus or minus two electrons, I can do that when the device is new. But seven years out, it will start to smear.” In other words, the electron count will start to vary from one cell to the next.

SanDisk, to steal a line from a bigger Silicon Valley company, has an app for that. The controllers on each of its chips keep track of these errors and compensate for them.

There is still some more engineering to do. The company can try to make cells smaller, get more bits per cell and improve the controllers.

But at the end of the day, Mr. Harari said, it probably can double the capacity of its chips only two more times. Once the industry goes from its current 64-billion-bit chip to a 256-billion-bit chip (that’s 32 gigabytes), it will hit that brick wall.

Then what?

Your camera and music player will certainly be able to store a lot of files. But you won’t be able to count on next year’s iPhone having double the capacity at the same price.

He may be heading for a brick wall, but Mr. Harari has a plan: Head up.

“When Manhattan ran out of space, they built skyscrapers,” Mr. Harari said. “It’s the same for us.”

Right now semiconductors are all based on the particular properties of circuitry etched onto a flat piece of silicon. Four years ago, SanDisk bought Matrix Semiconductor, a company that was trying to develop a way to stack multiple layers of very tiny memory cells on top of one another.

(SanDisk is far from the only company trying to explore the third dimension in flash memory. Bill Watkins, the former chief executive of Seagate, recently joined the board of a company, Vertical Circuits, that uses a silver ooze to stack memory chips.)

So far, Mr. Harari said, the company has been able to build chips with four or eight layers. That’s the good news. The bad news is that they can write information to those chips only one time. That might be all right for distributing software or video games, but most flash memory is sold for use in devices like cameras, which need memory that can be erased and rewritten.

Mr. Harari said the company’s engineers were making good progress. But he didn’t have the Pollyanna view of some chip executives that Moore’s Law will apply forever.

“When you have a new material, all bets are off,” he said. “Until you have it, you don’t have anything.”