Patent ID: 8861013

Claim:
An image forming apparatus comprising: a processor that executes a heap memory allocation program; and a memory unit that a heap memory is allocated to, the memory unit is connected to the processor, wherein the processor executes the heap memory allocation program to perform the steps of: (a) determining whether a required size of memory area can be allocated or not and allocating the required size of memory area if the memory area can be allocated; (b) when it is not determined that the memory area can be allocated, waiting for changing a status of the memory unit from a predetermined first status to a predetermined second status if a status of the memory unit is the first status and then performing the step (a) again when a status of the memory unit becomes the second status; and (c) in the step (b), if it is determined that a status of the memory unit is not the first status, allocating the required size of memory area after garbage collection is performed.