Methods and systems for managing heap creation and allocation
AssigneeMicrosoft Corporation
InventorsJon B. Avner, Soner Terek
Life of this patent
Estimating the term…
Abstract
The present invention increase the efficiency of virtual memory usage when performing heap allocation and reduces virtual memory fragmentation caused by heap allocation. Instead of incrementally growing the initial heaps when there is not enough heap memory to make an allocation, an entirely new heap is created in which to make the allocation. That new heap may be added to the pool of heaps from which an allocation may be made. The additional heaps are of a constant, relatively large, size thereby reducing the risk of virtual memory fragmentation.
Claims22
In a computer system capable of allocating heaps in virtual memory, a method of allocating non-growable heaps in virtual memory so as to increase the usage efficiency of the virtual memory and so as to reduce fragmentation of the virtual memory, the method comprising the following:
- an act of creating an initial number of non-growable heaps in the virtual memory, the non-growable heaps each being a heap that a heap manager cannot associate with any other additional virtual memory segments beyond the virtual memory segment that was initially allocated to the heap during creation;
- an act of receiving an instruction that requires allocation of virtual memory within one or more heaps;
- if there is enough virtual memory within any available heap of the initial number of non-growable heaps in which to make the allocation necessitated by the received instruction, an act of allocating memory from one or more of the initial number of non-growable heaps;
- and
- if there is not enough virtual memory within any available heap of the initial number of non-growable heaps in which to make the allocation necessitated by the received instruction, an act of creating a new heap for use in making the allocation necessitated by the received instruction.
In a computer system capable of allocating heaps in virtual memory, a method of allocating non-growable heaps in virtual memory so as to reduce fragmentation of the virtual memory, the method comprising the following:
- an act of creating an initial number of non-growable heaps in the virtual memory, the non-growable heaps each being a heap that a heap manager cannot associate with any other additional virtual memory segments beyond the virtual memory segment that was initially allocated to the heap during creation;
- an act of receiving an instruction that requires allocation of virtual memory within one or more heaps;
- and
- a step for making the allocation in a new heap if there is not enough room in any available heap of the initial non-growable heaps in which to make the allocation.
A computer-program product for use in a computer system capable of allocating heaps in virtual memory, the computer-program product for implementing a method of allocating non-growable heaps in virtual memory so as to reduce fragmentation of the virtual memory, the computer program product comprising a computer-readable medium having stored thereon the following:
- a virtual memory manager configured to map virtual memory addresses to physical memory addresses;
- a heap manager configured to allocate heaps in virtual memory by using the virtual memory manager to access virtual memory;
- a heap optimization module configured to perform the following:
- an act of instructing a heap manager to create an initial number of non-growable heaps in the virtual memory the non-growable heaps each being a heap that a heap manager cannot associate with any other additional virtual memory segments beyond the virtual memory segment that was initially allocated to the heap during creation;
- an act of receiving an instruction that requires allocation of virtual memory within one or more heaps;
- an act of instructing the heap manager to make the allocation necessitated by the received instruction in one or more of the initial heaps;
- an act of receiving an indication from the heap manager that there is not enough virtual memory available in the initial heaps to make the allocation necessitated by the received instruction;
- and
- in response to the indication from the heap manager, an act of instructing the heap manager to create a new heap within the virtual memory.
In a computer program product for use in a computer system capable of allocating heaps in virtual memory, a computer program product for implementing a method of allocating non-growable heaps in virtual memory so as to reduce fragmentation of the virtual memory, the computer program product comprising a computer-readable medium having stored thereon computer-executable instructions for implementing the following:
- an act of causing an initial number of non-growable heaps to be created in the virtual memory, the non-growable heaps each being a heap that a heap manager cannot associate with any other additional virtual memory segments beyond the virtual memory segment that was initially allocated to the bean during creation;
- an act of detecting the receipt of an instruction that requires allocation of virtual memory within one or more heaps;
- if there is enough virtual memory within any available heap of the initial number of non-growable heaps in which to make the allocation necessitated by the received instruction, an act causing memory to be allocated from one or more of the initial number of non-growable heaps;
- and
- if there is not enough virtual memory within any available heap of the initial number of non-growable heaps in which to make the allocation necessitated by the received instruction, an act of causing a new heap to be created far use in making the allocation necessitated by the received instruction.
Dependencies are inferred from the claim text.