NEW YORK (CBSNewYork) — We can all be forgetful sometimes, but millions of Americans have lost the ability to make memories because of brain injury or illness.

But as CBS2’s Dr. Max Gomez reports, doctors have figured out how to provide a memory boost.

Losing their memory is probably the greatest fear most people have about growing old. Not just where you parked or what you just ate, but where you live, whether you’re married, even the faces and names of your children.

“It would be devastating,” said Keith Pinto.

It’s a growing concern. From battlefield trauma, to strokes and to dementia, more than one million Americans are diagnosed each year with brain disorders that cause moderate to severe memory loss.

Now, scientists may have discovered a way to strengthen or restore our ability to make new memories by hacking into the brain, and writing code to boost it.

It’s called prosthetic memory.

“We’re trying to bypass or support the normal memory and coding function in the brain,” said Dr. Robert Hampson.

Neuroscientist Dr. Hampson headed up a ground breaking study at Wake Forest University Baptist Medical Center in North Carolina. A small group of patients with epilepsy agreed to have electrodes inserted into a part of their brains called the hippocampus.

“When the hippocampus is damaged, we have difficulty making new memories,” said Hampson.

The patients played a game involving memory, as the electrodes recorded their brain cells firing off in a unique pattern of code.

Neural engineer Ted Berger at the University of Southern California has studied the formation of memories in the hippocampus for more than 20 years.

“The content of memory is coded in a digital code, and the hippocampus is the part of the brain that creates that digital code,” said Berger.

Using the patients’ unique codes, Berger designed a mathematical model that predicts how the brain cells fire to form a successful memory.

“Together, we can identify those neural codes, we can see them for the first time,” said Berger.

Using the electrodes, professor Hampson and his team played each patient’s unique code back into their own brain. The codes boosted the patient’s short and long-term memories by nearly 40 percent.

“We were surprised at how successful we were,” said Hampson.

The work is still very preliminary, but the goal is that one day a tiny pacemaker will help brain injured or Alzheimer’s patients make new memories or strengthen the ones they already have.