On average, a dash cam will automatically record for up to two hours. Usually, a dash cam is suited for use with a 16GB SD card. With this, after two hours of footage is recorded, it will automatically begin overwriting footage unless you manually stop recording.
Most dash cams have G-sensors that, if motion or impact detection is triggered, will automatically save the footage. This is in the case of a car accident. Most dash cams will save and lock this footage so that it can not be overwritten.