Just have a system of variable storage which works by FIFO, where a rotating record of X number of records are logged in RAM. The last in the queue is freed from RAM.