When does a Pokemon get knocked out?
A Pokémon will faint if they lose a battle while fighting at a gym, or if they get kicked out while defending at a gym.
If you get too many revives you can always dump them to make more room to hold other things.