Method and apparatus for detecting references to deallocated memory in a dynamic memory allocation system
First Claim
1. A dynamic memory allocation system having an address space comprising a plurality of non-overlapping address-space pages, each address-space page including a plurality of addresses of the address space, the system comprising:
- a memory comprising a plurality of non-overlapping memory pages, each memory page including a plurality of memory locations each having a corresponding first address for use in accessing that memory location;
a memory map for representing a mapping of addresses from the address space to the memory locations, the memory map representing a mapping of the addresses from a first portion of the address space that presently resides in the memory to the memory locations;
memory allocating means (42) responsive to a dynamic memory allocation request, for allocating to a requestor a memory location from a memory page having at least one other memory location already allocated in response to another dynamic memory allocation request, mapping to the allocated memory location a second address from an address-space page none of whose included addresses are presently mapped to memory locations, and giving the second address to the requestor for referencing the allocated memory location;
memory deallocating means (43) responsive to a dynamic memory deallocation request, for deallocating the allocated memory location from the requestor and canceling the mapping of the second address to the deallocated memory location; and
address translating means (41) responsive to the requestor referencing the deallocated memory location with the second address, for using the memory map to translate the second address to the deallocated memory location'"'"'s first address, the address translating means failing to accomplish the translation if the mapping of the second address to the deallocated memory location is not represented in the memory map, whereby the reference by the requestor to the deallocated memory location is detected.
4 Assignments
0 Petitions
Accused Products
Abstract
A system and means for identifying references by a process or a subprogram of a process to deallocated memory in a dynamic memory allocation system. The system and method are effective in identifying such references even before they have manifested themselves, and also in identifying the perpetrators of such references. The system and method make use of that portion of the address space of the process which is not otherwise used. A dynamic memory allocation function responds to a requestor'"'"'s request for memory allocation by mapping memory which the function is allocating to the requestor into otherwise-unused virtual address space, recording this mapping in the system'"'"'s memory map, and returning the virtual address to the requestor for use in referencing the allocated memory. Hence, any attempted access by the requestor to the allocated memory uses the virtual address, and the virtual address must be translated through the process memory map before the access can be established. A dynamic memory deallocation function responds to a requestor'"'"'s request for memory deallocation by deleting from the process memory map the mapping between the memory which is being deallocated and the corresponding virtual address. Hence, any subsequent attempted access by the requestor to the deallocated memory fails on account of the corresponding entry in the process memory map being empty and thus unavailable for completion of the requisite address translation. This failure is trapped, recorded, and reported by the system'"'"'s conventional fault-management mechanisms.
-
Citations
27 Claims
-
1. A dynamic memory allocation system having an address space comprising a plurality of non-overlapping address-space pages, each address-space page including a plurality of addresses of the address space, the system comprising:
-
a memory comprising a plurality of non-overlapping memory pages, each memory page including a plurality of memory locations each having a corresponding first address for use in accessing that memory location; a memory map for representing a mapping of addresses from the address space to the memory locations, the memory map representing a mapping of the addresses from a first portion of the address space that presently resides in the memory to the memory locations; memory allocating means (42) responsive to a dynamic memory allocation request, for allocating to a requestor a memory location from a memory page having at least one other memory location already allocated in response to another dynamic memory allocation request, mapping to the allocated memory location a second address from an address-space page none of whose included addresses are presently mapped to memory locations, and giving the second address to the requestor for referencing the allocated memory location; memory deallocating means (43) responsive to a dynamic memory deallocation request, for deallocating the allocated memory location from the requestor and canceling the mapping of the second address to the deallocated memory location; and address translating means (41) responsive to the requestor referencing the deallocated memory location with the second address, for using the memory map to translate the second address to the deallocated memory location'"'"'s first address, the address translating means failing to accomplish the translation if the mapping of the second address to the deallocated memory location is not represented in the memory map, whereby the reference by the requestor to the deallocated memory location is detected. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A dynamic memory allocation system having an address space comprising a plurality of non-overlapping address-space pages, each address-space page including a plurality of addresses of the address space, the system comprising:
-
a memory comprising a plurality of non-overlapping memory pages, each memory page including a plurality of memory locations each having a corresponding first address for use in accessing that memory location; a memory map for representing a mapping of addresses from the address space to the memory locations, the memory map representing a mapping of the addresses from a first portion of the address space that presently resides in the memory to the memory locations; memory allocating means (42) responsive to a dynamic memory allocation request, for allocating to a requestor a memory location from a memory page having at least one other memory location already allocated in response to another dynamic memory allocation request, mapping in the memory map to the allocated memory location a second address from an address-space page none of whose included addresses are presently mapped to memory locations, and giving the second address to the requestor for referencing the allocated memory location; address translating means (41) responsive to the requestor referencing the allocated memory location with the second address of the allocated memory location, for using the memory map to translate the second address of the allocated memory location to the allocated memory location'"'"'s first address for use in accessing the referenced allocated memory location; memory deallocating means (43) responsive to a dynamic memory deallocation request, for deallocating the allocated memory location from the requestor and deleting the mapping of the second address to the deallocated memory location from the memory map; and the address translating means further responsive to the requestor referencing the deallocated memory location with the second address of the deallocated memory location, for using the memory map to attempt to translate the second address of the deallocated memory location to the first address of the deallocated memory location and failing to accomplish the translation due to the deletion from the memory map by the memory deallocating means, whereby the reference by the requestor to the deallocated memory location is detected. - View Dependent Claims (7, 8, 9, 10, 11)
-
-
12. In a dynamic memory allocation system having a memory comprising a plurality of non-overlapping memory pages, each memory page including a plurality of memory locations each having a corresponding first address for use in accessing that memory location, an address space comprising a plurality of non-overlapping address-space pages, each address-space page including a plurality of addresses of the address space, a memory map for representing a mapping of addresses from the address space to the memory locations, the memory map representing a mapping of the addresses from a first portion of the address space that presently resides in the memory to the memory locations, a memory allocation means that responds to a memory allocation request by allocating a memory location to a requestor, a memory deallocation means that responds to a memory deallocation request by deallocating the allocated memory location from the requestor, and an address translation means that responds to the requestor referencing the allocated memory location with an address that is mapped to that allocated memory location, by using the memory map to translate the referencing address to the allocated memory location'"'"'s first address, the improvement comprising:
-
said memory allocation means including means responsive to an allocation of a memory location to a requestor in response to a memory allocation request, the allocated memory location being from a memory page having at least one other memory location already allocated in response to another memory allocation request, for mapping to the allocated memory location a second address from an address-space page none of whose included addresses are presently mapped to memory locations, and giving the second address to the requestor for referencing the allocated memory location; and said memory deallocation means including means responsive to a deallocation of the allocated memory location from the requestor, for canceling the mapping of the second address to the deallocated memory location; whereby an attempt, by the translation means in response to the requestor referencing the deallocated memory location with the second address of the deallocated memory location, to use the memory map to translate the second address of tile deallocated memory location to the first address of the deallocated memory location fails if the mapping of the second address is not represented in the memory map, and the reference by the requestor to the deallocated memory location is detected in consequence of the failure. - View Dependent Claims (13, 14, 15, 16)
-
-
17. A method of detecting a reference by a requestor to a memory location in a dynamic memory allocation system having a memory comprising a plurality of non-overlapping memory pages, each memory page including a plurality of memory locations each having a corresponding first address for use in accessing the memory location, an address space comprising a plurality of non-overlapping address-space pages, each address-space page including a plurality of addresses of the address space, and a memory map for representing a mapping of addresses from the address space to the memory locations, the memory map representing a mapping of the addresses from a first portion of the address space that presently resides in the memory to the memory locations, the method comprising the steps of:
-
in response to a dynamic memory allocation request, allocating to a requestor a memory location from a memory page having at least one other memory location already allocated in response to another dynamic memory allocation request, mapping a second address, from an address-space page none of whose included addresses are presently mapped to memory locations, to the allocated memory location, and giving the second address to the requestor for referencing the allocated memory location; in response to a dynamic memory deallocation request, deallocating the allocated memory location from the requestor, and canceling the mapping of the second address to the deallocated memory location; and in response to the requestor referencing the deallocated memory location with the second address, using the memory map to translate the second address to the deallocated memory location'"'"'s first address, and failing to accomplish the translation if the mapping of the second address to the deallocated memory location is not represented in the memory map, whereby the reference by the requestor to the deallocated memory location is detected. - View Dependent Claims (18, 19, 20, 21)
-
-
22. A method of detecting a reference by a requestor to a deallocated memory location in a dynamic memory allocation system having a memory comprising a plurality of non-overlapping memory pages, each memory page including a plurality of memory locations each having a corresponding first address for use in accessing the memory location, an address space comprising a plurality of non-overlapping address-space pages, each address-space page including a plurality of addresses of the address space, and a memory map for representing a mapping of addresses from the address space to the memory locations, the memory map representing a mapping of the addresses from a first portion of the address space that presently resides in the memory to the memory locations, the method comprising the steps of:
-
in response to a dynamic memory allocation request, allocating to a requestor a memory location from a memory page having at least one other memory location already allocated in response to another dynamic memory allocation request, mapping a second address, from an address-space page none of whose included addresses are presently mapped to memory locations, to the allocated memory location in the memory map, and giving the second address to the requestor for referencing the allocated memory location; in response to the requestor referencing the allocated memory location with the second address, using the memory map to translate the second address to the allocated memory location'"'"'s first address, and using the first address to access the allocated referenced memory location; in response to a dynamic memory deallocation request, deallocating the allocated memory location from the requestor, and deleting the mapping of the second address to the deallocated memory location from the memory map; and in response to the requestor referencing the deallocated deallocated memory location with the second address, using the memory map in an attempt to translate the second address to the deallocated deallocated memory location'"'"'s first address, and failing in the attempt due to the deletion from the memory map, whereby the reference by the requestor to the deallocated memory location is detected. - View Dependent Claims (23, 24, 25, 26, 27)
-
Specification