Patent ID: 9552170
Date: 2017-01-24
CPC Classifications: G06F

Claim:
1. A memory managing apparatus, comprising: an application that allocates a virtual area in a virtual memory space required for performing an image process, and performs the image process; a memory area managing unit that i) performs mapping the virtual area to a physical area in a physical memory space in accordance with a request from the application, ii) sets a protect flag to each of the virtual area in accordance with the request from the application, the protect flag indicating that a use of the virtual area by the application has been finished or not, iii when a part or all of a first virtual area would overlap a second virtual area due to expansion or movement of the first virtual area, allows the expansion or the movement of the first virtual area accompanying with overlapping the second virtual area if the protect flag of the second virtual area indicates that the use of the second virtual area has been finished, and iv) when the part or all of the first virtual area would overlap the second virtual area due to the expansion or the movement of the first virtual area, does not allow the expansion or the movement of the first virtual area accompanying with overlapping the second virtual area if the protect flag of the second virtual area does not indicate that the use of the second virtual area has been finished; and a memory pool managing unit that i) adds the physical area corresponding to an overlapping part of the first and the second virtual areas into a memory pool in order to map the physical area to another virtual area, if the expansion or the movement of the first virtual area accompanying with overlapping the second virtual area is allowed by the memory area managing unit, ii) manages a memory pool table that stores either a top physical address and a size or the top physical address and an end physical address of the physical area in the memory pool, and iii) selects the physical area having the size either equal to or larger than the size of said another virtual area on the basis of either the top physical address and the size or the top physical address and the end physical address in the memory pool table, wherein, if the memory area managing unit i) detects data writing by the application, the data writing being to the virtual area that is not mapped to any physical areas, ii) determines a shortage size for the data writing, and iii) determines whether or not a physical area having the size either equal to or larger than the shortage size is kept in the memory pool by referring the memory pool table, if the physical area having the size either equal to or larger than the shortage size is kept in the memory pool, the memory area managing unit selects the physical area having the size either equal to or larger than and nearest to the shortage size, if the size of the selected physical area is the same as the shortage size, the memory area managing unit maps the whole selected physical area to an unmapped virtual area, and the memory pool managing unit deletes the mapped physical area in the memory pool table, if the size of the selected physical area is larger than and nearest to the shortage size, the memory area managing unit maps a part of the selected physical area to the unmapped virtual area, and keeps the physical area as its residual part in the memory pool, and the memory pool managing unit deletes the mapped physical area in the memory pool table, and registers the physical area as its residual part in the memory pool table, and if no physical areas having the size either equal to or larger than and nearest to the shortage size are kept in the memory pool, the memory area managing unit maps a new physical area to the unmapped virtual area.