The last line of defense for pressurized equipment, Temperature and pressure (T&P) relief valves protect equipment from excess pressure and, ultimately, catastrophic failure.
T&P valves used on residential water heaters are typically designed and manufactured to relieve pressure at 150 psi and temperature at 210 degrees F. ASME, ANSI and CSA (AGA) approved relief valves protect the water heater from excess pressures and temperatures by discharging water.
When water is heated it expands. In a 40 gallon water heater, water being heated to its thermostat setting will end up expanding by approximately 1/2 gallon. The extra volume created by this expansion has to go somewhere or pressure will dramatically increase, such as when water is heated in a closed system.
A good indication of thermal expansion is when the T&P valve releases about one cup of water for each 10 gallons of heater capacity with each heating cycle.