Pitting is when you go to the range with your hair perfectly brushed, make-up on your face & clothes that look like you just walked off a movie set that stars Brad Pitt. I try not to Pitt if I can help it. In Georgia, Pitting can get you beaten up if you aren't paying attention & lower your guard (and your gun). Hope that helps you.
Seriously, pitting is when rust is allowed to stand on the metal long enough to eat into the metal. I have a 22LR that was left in my parents closet for years with no oil on it. The surface rust just kept growing and eating the metal until I found it a few years ago. If I had found it sooner I could have cleaned it off with steel wool and some oil. Now I have a 22 that has a pitted barrel. Keep oil on the metal and you will never get pitting.
A metal exposed to moisture in the air long enough to rust. Go out and look at anything rusted. Allowed to go on long enough the rust forms pits. Metals with iron in them + water + time = rust
The answer is proper storage and a light coat of oil on the surface of the metal. You want to store your firearms somewhere dry. A light coat of oil over the metal will repel water in the air enough to slow down the process to a point where pitting probably won't be a problem in your lifetime.
Keep in mind that most gun cleaning products have solvents that will strip that coat of oil off the metal and leave it less protected from rust. If you live somewhere humid or rainy, rust is the enemy. Its the enemy everywhere but if you were in a desert it would take a lot longer to damage your firearm.
In too many M/L bores, pitting in a bore is like cavities in a tooth. The thing about pitting is it will get bigger when left unattended. Liike the sign read on the dentist's wall that showed a piece of cherry pie;
Five minuted after eating me, I start eating your teeth.
Brushing, cleaning and protecting, is the answer. ....
Pitting corrosion is a localised form of corrosion and is quite different from rsuting which is a uniform type of corrosion. In pitting, corrosion starts at a point of high localised stress or different material composition and sets up a galvanic cell. The pit extends from the surface into the metal and can be very small in diameter making it difficult to see.