1 trainer can feed 10 different pokemon 10 berrys EACH whitin a short time. If you try to feed an 11th pokemon or if you try to feed an 11th berry, the game will say that pokemon isnt hungry.
If you remotely feed a pokemon a golden razz berry, that pokemon will be fully healed. 1 trainer can do this for all 6 pokemon who are in a gym he/she is also in. The best way to defend is to wait untill the attacker is attacking for the 2nd time, and then feed right after each pokemon has been defeated. This way, the attacker will have to attack 23(!!) times at maximum before the gym goes down.
And that is if only 1 person is defending with feeding berrys. If its 1 person with multiple accounts he can just time it right and youll be there untill all his accounts run out of golden razz berrys, or you run out of revives/potions.
If you are a single attacker and this is happening, move on to the next gym because you wont be able to tear it down anyways.
(its a fast way to prestige your gym badge to gold tough, if thats something you want to do).