Compilation method and system to reuse memory storage...

Data processing: software development – installation – and managem – Software program development tool – Translation of code

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

C707S793000

Reexamination Certificate

active

06684393

ABSTRACT:

FIELD OF THE INVENTION
The invention relates generally to a method and system of optimizing local memory usage in a computer system. More particularly the invention relates to a method and system for enabling a computer to reuse an amount of memory instead of allocating a different portion of the memory.
BACKGROUND
Common idioms in the JAVA programming language often lead to performance problems when the underlying JAVA code is executed. Such performance problems cause a varying, but often significant performance deficit.
Specifically, source code segments written in an object oriented programming language such as C++ will typically conform to the pattern set forth in TABLE 1.
TABLE 1
C++
AppObject some;
AnyObject x(create,with,parms);
while (some.WorkToDo( )) { // at least one more of
some list of work associated with “some”
some.SourceofNextAnyObject(x); // x's storage is
altered to new values
some.DoworkWith(x); // x might be used, put on
other list within “some”
};
In contrast, source code segments written in an object oriented programming language, such as JAVA, will typically conform to the example set forth in TABLE 2.
TABLE 2
JAVA
AppObject some;
while (some.WordToDo) { // at least one more of some
list of work assoc. with “some”
AnyObject x = new
AnyObject (some.SourceofNextAnyObject ( ));
// x's old storage abandoned, replaced with new
storage initialized from “some”
some.DoworkWith(x); // might be used, put on other
list within “some”
 };
The differences between the two source code segments are subtle in the text, but are rather profound in terms of the underlying executable code. For example, in C++ only one storage copy is associated with “x”. This is illustrated in
FIG. 2B
where it is shown that: when executing “AnyObject x(create, with, parms)” in C++, x will be allocated over a single object instance at
78
within memory space
76
. On every loop, instead of allocating a new object instance, the function “some.SourceofNextAnyObject(x)” reinitializes
78
to new values and reuses the memory space. Thus, the various memory blocks
80
in memory space
76
are never used by the loop and can be used by other processes.
As illustrated in
FIG. 2A
, however, in JAVA “x” is a reference to a series of objects stored in memory space
66
. Each time the loop is executed, a new “instance” of x is created. As a result, the “new” operator of the JAVA language instantiates a new object, or creates a new object, by allocating memory for the new object each time “new” is encountered. By way of example, during a first execution of the loop, a memory storage space
68
is allocated for Object
0
. Subsequently Object
0
is stored in memory storage space
68
. Similarly, memory storage space
70
is allocated for Object
1
, which is subsequently stored in that memory storage. This iterative process continues until N new objects have been created and an Nth memory storage space
74
has been allocated for storing Object N. Those of skill in the art will appreciate that the memory storage for each new instantiation of an object need not lie in a contiguous memory space. Instead, the memory storage space(s) may be allocated wherever adequate memory space is located.
In the preceding example, if the loop iterates 20,000,000 times, then the memory space to hold the object is allocated 20,000,000 times. This would amount to a 20,000,000 to one deficit for JAVA to overcome as compared to C++. The number of times that the loop iterates varies in practice. Therefore, the deficit will vary with the iterations and the application of the program.
It will also be appreciated that the processor deficit may not be noticed if the function DoWorkWith executes enough instructions. However, the problem associated with allocating a new memory space each time an object is encountered in an iterative loop is sufficiently pervasive that the function DoWorkWith may have other circumstances that repeat the above illustrated practice. Namely, memory for another object may be allocated on a “once per loop” basis within DoWorkWith itself. Regardless of whether a processor deficit is noticed, a storage deficit exists.
Therefore, there is a need for a method and system for optimizing the memory space allocated for each new instance of an object by reusing a previously created memory space (when possible) instead of allocating a new memory space for the object during the execution of a loop.
SUMMARY
The present invention relates generally to a method and system for optimizing local memory storage in a computer. More specifically, the present invention relates to reusing local memory storage for each instance of an object that is created within an iterative loop instead of reallocating a new memory space “once per loop.”
As noted above, JAVA has a performance deficit compared to other languages (C, C++, RPG, etc.) in that it tends to allocate many short-lived objects on a “once per loop” basis rather than a “once per job” basis. The other languages do “once per job” more often. Because there can be a very large number of loop iterations, the cost of creating and garbage collecting all of these objects (many of which only “live” for a few JAVA statements or at most, one loop iteration) can be very high. The present invention provides a system and method for optimizing the memory allocation by reducing the allocation cost for that loop from “once per loop” to “once per job.”
Those skilled in the art will readily understand that a garbage collector in JAVA cleans the dynamic memory when it is needed and there is available time. The garbage collector marks objects throughout the memory space to which there are references and subsequently removes the unmarked ones. Garbage collection is necessary to limit JAVA's storage costs. If objects are created on a “per loop” basis and there are a large number of loop iterations, the main storage cost is unacceptable compared to other languages (e.g., without the garbage collection process). But garbage collection is costly in terms of processor time. Also, since garbage collection runs occasionally, there is a time lag between when any particular object ceases to be in use and when garbage collection next executes. Within this lag or time between collections, storage is wasted. Therefore, while garbage collection keeps the worst case storage deficit far below the example deficit identified above, a substantial storage and processor deficit remains compared to alternative languages.
In accordance with a preferred embodiment, the present invention provides a method of reusing a local memory space in a computer. The method comprises analyzing an incoming stream of computer instructions with an executable module and determining the presence of a first predetermined operator in said stream of computer instructions. If said first predetermined operator is present, the method determines the value of a parameter following said first operator in said stream. If said first predetermined operator is present, the method interposes a second operator in place of said first operator by said executable module and reuses a local memory space to store an instance of said parameter in said memory space in response to the execution of said second operator.
In another embodiment, the present invention provides a method of optimizing the usage of a memory space in a computer while executing a module wherein a new instance of an object is created within each execution of an executable loop. The method comprises reusing said memory space for each new instance of said object created each time said loop is executed whereby said memory space is reclaimed without garbage collecting and is reused without allocating a new memory space.
In still another embodiment, the present invention provides, a computer system. The system comprises a memory configured and arranged to store an object and a processor associated with said memory executing an executable module in said computer having a portion t

LandOfFree

Say what you really think

Search LandOfFree.com for the USA inventors and patents. Rate them and share your experience with other people.

Rating

Compilation method and system to reuse memory storage... does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Compilation method and system to reuse memory storage..., we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Compilation method and system to reuse memory storage... will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3212334

  Search
All data on this website is collected from public sources. Our data reflects the most accurate information available at the time of publication.