Instance-reduction algorithm for garbage-collected language

Data processing: database and file management or data structures – Database design – Data structure types

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

C707S793000

Reexamination Certificate

active

06785698

ABSTRACT:

FIELD OF THE INVENTION
This invention relates generally to providing efficient use of memory, and more particularly, to an efficient method of reducing object instances created via a Java programming language.
BACKGROUND OF THE INVENTION
In object oriented programming languages, such as Java, developed by Sun Microsystems, Inc., there may be multiple instances of equivalent objects that unnecessarily take up memory and disk space. Because objects are often large, it is desirable to maintain only one shared instance of an object in memory rather than multiple separate instances of equivalent objects. It is also desirable to allow garbage collection of an object instance if it is no longer in use.
One instance-reduction mechanism creates a dictionary of objects that have been used, and if a desired object exists in the dictionary, a reference is made to the dictionary object instead of creating a new object instance. The dictionary may be rebuilt on a periodic basis, purging objects that are no longer in use. One drawback with this solution is that it makes inefficient use of memory by having to maintain unused objects until the next purge cycle.
Another instance-reduction mechanism is maintaining, along with the dictionary of objects that have been used, a reference count for each object. The reference count increases as the number of references to the dictionary object increases, and decreases as the number of references to the dictionary object decreases. Instead of waiting for the next purge cycle, the object is removed from the dictionary when the reference count becomes zero. Although this instance-reduction mechanism may allow a more expeditious purging of unused objects, the maintaining of reference counts is often cumbersome and complex.
A further instance-reduction mechanism is compressing the set of objects being maintained in memory using standard compression algorithms. This mechanism also has its drawbacks in that the compressed objects must generally be decompressed prior to their use, adding a layer of complexity to the mechanism. Once decompressed, the objects immediately use up any memory space saved by the compression.
Accordingly, there is a need for a simpler instance-reduction mechanism that makes efficient use of memory. Such a mechanism should utilize the automatic garbage collection functionality provided by the Java programming language to allow the automatic purging of unused objects without requiring the maintenance of reference counts for the objects.
SUMMARY OF THE INVENTION
The present invention is directed to an efficient method for avoiding multiple instances of equivalent objects and making efficient use of memory. Instead of creating a new object instance each time an candidate object is presented, a map of unique objects is searched for an equivalent object instance and returned for use if found. If an equivalent object instance is not found, the candidate object is unique, and is therefore added to the map. Once an object in the map is no longer in use, the object is automatically purged from the memory.
In one embodiment, the invention is directed to a method for reducing object instances stored in memory. The method includes receiving an object and searching for an equivalent object stored in a map. The map includes a plurality of entries, each entry including a key and a value. The object is stored in an entry of the map if the search is unsuccessful. In storing the object, the key for the entry is set to the object for causing the object to be stored as a referent of a first weak reference and the value for the entry is set to a second weak reference for storing the object as a referent of the second weak reference.
In another embodiment, the method for reducing object instances includes storing an object in an entry of a map having a key and a value if the object is not found in the map, the key for the entry being set to the object and the value for the entry being set to a weak reference to the object, and automatically deleting the object from the map if the object is no longer is use.
In a further embodiment, the method for reducing object instances includes receiving an object, searching for an equivalent object stored in a map, storing the object in an entry of the map as a referent of a weak reference if the search is unsuccessful, determining if the object has become weakly reachable, and automatically deleting the object from the map if the object has become weakly reachable.
In a further embodiment, the invention is directed to an object oriented programming system that includes a memory storing a map having a plurality of entries, each entry including a key and a value, and an instance reduction engine coupled to the memory. The instance reduction engine receives an object, searches the map for an equivalent object, and stores the object in an entry of the map if the search is unsuccessful. In storing the object, the key for the entry is set to the object for causing the object to be stored as a referent of a first weak reference and the value for the entry is set to a second weak reference for storing the object as a referent of the second weak reference.
In another embodiment, the present invention is directed to an object oriented programming system that further includes a garbage collection unit coupled to the memory. The garbage collection unit automatically deletes the object from the map if the object is no longer is use.
In one embodiment, the map storing the unique objects is a WeakHashMap provided by the Java programming language.
In another embodiment, the automatic deletion of objects no longer in use is enabled by the garbage collection capabilities provided by the Java programming language.


REFERENCES:
patent: 5765174 (1998-06-01), Bishop
patent: 6237060 (2001-05-01), Shilts et al.
patent: 6473773 (2002-10-01), Cheng et al.
patent: 6701520 (2004-03-01), Santosuosso et al.
patent: 6721942 (2004-04-01), Sievert
patent: 1255191 (2002-11-01), None

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

Instance-reduction algorithm for garbage-collected language does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Instance-reduction algorithm for garbage-collected language, we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Instance-reduction algorithm for garbage-collected language will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3358266

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