1. An image forming apparatus having a first memory to store a print job, the image forming apparatus comprising: at least one processor; and a second memory having instructions stored thereon, which when executed by the least one processor, cause the at least one processor to: determine whether the first memory is a non-volatile memory or a volatile memory; a storage memory configured to store a result of the determination in a non-volatile manner, erase a data stored in the first memory in accordance with an event that causes the image forming apparatus to transition into a power off state or a power saving state, in a case where it is determined that the first memory is the non-volatile memory; cause the image forming apparatus to transition to the power off state or the power saving state after the data stored in the first memory is erased in the case where it is determined that the first memory is the non-volatile memory, receive an instruction to instruct the image forming apparatus to hold the print job in the first memory until the print job is instructed to print; and output a message indicating that the print job is to be kept in the first memory in a case where the image forming apparatus receives the instruction and it is determined that the first memory is the non-volatile memory, and not output the message in the case where the image forming apparatus receives the instruction and it is determined that the first memory is the volatile memory.