Electrical computers and digital processing systems: memory – Storage accessing and control – Memory configuring
Reexamination Certificate
1998-10-29
2002-03-26
Kim, Matthew M. (Department: 2186)
Electrical computers and digital processing systems: memory
Storage accessing and control
Memory configuring
C709S241000, C711S173000
Reexamination Certificate
active
06363467
ABSTRACT:
BACKGROUND OF THE INVENTION
The invention relates to monitoring and/or performing of memory allocation to an application, in particular in C.
The computer programming language C is a high level programming language which is structured, modular and compiled. The language is widely known having been developed in the early 1970's. It is capable of operation in various environments including the MS-DOS environment and the UNIX environment. One aspect of C programs is the manipulation of memory using the malloc family of functions (malloc, realloc, free etc.) forming, for example, the standard C dynamic memory allocation package. The malloc function dedicates an area of memory to a given variable. In such known systems, however, a problem arises in that these dynamic-memory allocation routines use memory that may be interleaved with memory allocated for the user. If the user overwrites memory, the memory allocation process can be corrupted. Problems can arise, for example, from freeing unallocated memory, reallocating unallocated memory, or writing outside the bounds of allocated memory. All these types of operation can corrupt the memory allocator. Freeing unallocated memory and reallocating unallocated memory often causes an immediate crash. Writing to unallocated memory will sometimes just corrupt application data, but can also cause a crash at some later time. Attempts to track the problems running under a debugger, or inserting debugging code can both fail to resolve the problem as that can modify the execution environment, sufficiently to mask the original problem. For example, EP-A-729097 describes a debug system which monitors memory access errors of an application program; whilst monitoring takes place during run-time, the application program runs within the debug system environment.
As an example of inserting debugging code, Proceedings of the Winter USENIX Conference, 20.01.92, pages 125-136 Reed Hastings et al.: “Purify: Fast Detection of Memory Leaks and Access Errors”, describes a tool which detects memory leaks and access errors by inserting additional checking instructions directly into the object code of the application.
The document “Static Detection of Dynamic Memory Errors”, Evans D., ACM SIGPLAN NOTICES May 1, 1996, pages 44-53, describes the use of annotations for detecting at compile time errors such as dead storage, memory leaks and dangerous liaising. This introduces extra complication.
SUMMARY OF THE INVENTION
In order to avoid or at least reduce these problems, in a first aspect the invention provides an apparatus for monitoring allocation of memory space during run-time of a program which makes memory allocation requests, the apparatus characterised by monitor means arranged in use to execute as a process separate from that of said program, the monitor means including allocator means responsive to memory requests of the program and arranged to allocate segments of memory in response thereto.
In a second aspect the invention provides a method of monitoring allocation of memory space during run-time of a program, the method comprising:
1) running said program, said program making memory allocation requests;
2) executing a monitoring means as a process separate from said program and responsive to said memory allocation requests; and
3) the monitoring means allocating segments of memory to said program in response to said memory allocation requests.
In a preferred embodiment, invalid memory allocation requests are detected by a monitor sub-process and the monitor sub-process interrupts the application on detection of an invalid memory allocation request. As a result, when the system is run, more reliable applications are achieved, and memory leakage can be identified and plugged reducing the likelihood of programs running out of memory space and, as memory paging may be reduced, improved speed.
The invention is flexible in that its use is not dependent on a debugger, and it may be used without a debugger, in which case if the application is interrupted, and the user has the choice of continuing to abort. Alternatively a debugger may be used subsequently to investigate the invalid request. Alternatively the sub-process may be used with a debugger, in which case the debugger will break into the application upon interruption.
An allocated memory list may be maintained by the monitor sub-process, allowing yet further improved memory monitoring. The invalid memory allocation requests may include one or more of the group of:
free unallocated memory;
free already freed memory;
reallocate unallocated memory;
reallocate already freed memory;
allocate or reallocate negative, zero size or excessive amount of memory;
memory allocator corrupted.
Memory allocation requests may be performed by an allocator sub-process external to the application. The memory disposition of the allocator sub-process and the application may be synchronised on start-up of the application. As a result the application process and/or memory monitor can run in an environment that is guaranteed to be safe. Because of memory synchronisation the memory allocator returns a valid address.
On start-up of the application the monitor sub-process may be started up and one or more of the following group of user options presented:
activate monitor sub-process;
activate allocator sub-process;
provide larger allocation than requested memory allocation;
set break point;
present leakage report.
The application may run under the computer language C and memory allocation requests are carried out under the malloc family of functions. Alternatively the invention can extend to C++, using the malloc family and, in addition, the “new” and “delete” operators. As “new” and “delete” may be implemented at a lower level in terms of “malloc” and “free”, the applicability of the invention will be undiminished. All “realloc” calls may be replaced with the “malloc+copy” operation.
According to the invention there is provided a system for performing allocation of memory space requested by an application, in which memory allocation requests are passed to, and performed by, an allocation sub-process external to the application, and in which the memory disposition of the allocator sub-process is synchronised with the memory disposition of the application upon start-up of the application. The memory allocation requests may be performed at run-time. As a result operation of an application can be rendered yet safer.
According to a further aspect of the invention there is provided a computer apparatus comprising an application to be executed requiring allocation of memory space, and an allocator process external to the application and operative during run-time to perform memory allocation requests of the application.
REFERENCES:
patent: 5604864 (1997-02-01), Noda
patent: 5784699 (1998-07-01), McMahon et al.
patent: 5809554 (1998-09-01), Benayon et al.
patent: 5930829 (1999-07-01), Little
patent: 6058460 (2000-05-01), Nakhimovsky
British Telecommunications plc
Kim Matthew M.
Nixon & Vanderhye P.C.
Vital Pierre M.
LandOfFree
Apparatus and method for allocating memory space for program... does not yet have a rating. At this time, there are no reviews or comments for this patent.
If you have personal experience with Apparatus and method for allocating memory space for program..., we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Apparatus and method for allocating memory space for program... will most certainly appreciate the feedback.
Profile ID: LFUS-PAI-O-2879453