Method and apparatus for reducing heap size through adaptive object representation
First Claim
1. A method for creating a compressed version of an object, the object being arranged to store a first representation of a set of data, the object being stored on a heap structure of an object-based computing system, the method comprising:
- determining when the first representation of the set of data is suitable for compression;
compressing the first representation of the set of data to form a second representation of the set of data when it is determined that the first representation of the set of data is suitable for compression;
allocating a second portion of memory on the heap structure when it is determined that the first representation of the set of data is suitable for compression, wherein the second portion of memory is substantially smaller than a first portion of memory associated with the object; and
writing the second representation of the set of data into the allocated second portion of memory.
2 Assignments
0 Petitions
Accused Products
Abstract
Methods and apparatus for creating compressed versions of regular objects are disclosed. According to one aspect of the present invention, a method for creating a compressed version of an object that stores a first representation of a set of data on a heap structure of an object-based computing system includes determining when the first representation of the set of data is suitable for compression. If the first representation of the set of data is compressible, it is compressed to form a second representation of the set of data, and a second portion of memory is allocated on the heap structure. The second portion of memory is substantially smaller than a first portion of memory occupied by the object. Finally, the method includes writing the second representation of the set of data into the allocated second portion of memory. In one embodiment, the method includes resetting a pointer that identifies the object to identify the allocated second portion of memory, and removing the object from the heap structure.
60 Citations
32 Claims
-
1. A method for creating a compressed version of an object, the object being arranged to store a first representation of a set of data, the object being stored on a heap structure of an object-based computing system, the method comprising:
-
determining when the first representation of the set of data is suitable for compression;
compressing the first representation of the set of data to form a second representation of the set of data when it is determined that the first representation of the set of data is suitable for compression;
allocating a second portion of memory on the heap structure when it is determined that the first representation of the set of data is suitable for compression, wherein the second portion of memory is substantially smaller than a first portion of memory associated with the object; and
writing the second representation of the set of data into the allocated second portion of memory. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
resetting a pointer that identifies the object to identify the allocated second portion of memory; and
removing the object from the heap structure.
-
-
3. A method as recited in claim 1 wherein the heap structure includes a first heap and a second heap, and the object is stored on the first heap.
-
4. A method as recited in claim 3 wherein the allocated second portion of memory is allocated on the second heap.
-
5. A method as recited in claim 1 wherein the allocated second portion of memory is a compressed object, the method further including writing information into a field associated with the compressed object.
-
6. A method as recited in claim 5 wherein writing the information includes:
-
compressing the information; and
storing the information in the field.
-
-
7. A method as recited in claim 5 wherein writing the information includes:
-
determining when the information is compressible;
allocating a third portion of memory on the heap structure when it is determined that the information is not compressible, the allocated third portion of memory being substantially larger than the compressed object;
setting a pointer from the compressed object to the allocated third portion of memory;
uncompressing the second representation of data;
storing the uncompressed second representation of data into the allocated third portion of memory; and
storing the information into the allocated third portion of memory.
-
-
8. A method as recited in claim 7 wherein the allocated third portion of memory is an uncompressed object and writing the information further includes setting a bit in a header of the compressed object to identify an existence of the uncompressed object.
-
9. A method as recited in claim 8 further including reading an uncompressed data field from the uncompressed object, wherein reading the uncompressed data field from the uncompressed object includes:
-
identifying the compressed object;
following the pointer from the compressed object to the uncompressed object; and
obtaining contents of the uncompressed data field.
-
-
10. A method as recited in claim 5 further including reading from the compressed object.
-
11. A computer program product for creating a compressed version of an object, the object being arranged to store a first representation of a set of data, the object being stored on a heap structure of an object-based computing system, the computer program product comprising:
-
computer code for determining when the first representation of the set of data is suitable for compression;
computer code for compressing the first representation of the set of data to form a second representation of the set of data when it is determined that the first representation of the set of data is suitable for compression;
computer code for allocating a first portion of memory on the heap structure when it is determined that the first representation of the set of data is suitable for compression, wherein the first portion of memory is substantially smaller than a second portion of memory associated with the object;
computer code for writing the second representation of the set of data into the allocated first portion of memory; and
a computer readable medium that stores the computer codes. - View Dependent Claims (12, 13, 14, 15, 16, 17)
computer code for resetting a pointer that identifies the object to identify the allocated first portion of memory; and
computer code for removing the object from the heap structure.
-
-
13. A computer program product as recited in claim 11 wherein the heap structure includes a first heap and a second heap, and the object is stored on the first heap, and wherein the computer code for allocating the first portion of memory allocates the first portion of memory on the second heap.
-
14. A computer program product as recited in claim 11 wherein the allocated first portion of memory is a compressed object, and the computer program product further includes computer code for writing information into a field associated with the compressed object.
-
15. A computer program product as recited in claim 14 wherein the computer code for writing the information includes:
-
computer code for determining when the information is compressible;
computer code for compressing the information when it is determined that the information is compressible;
computer code for storing the information in the field when it is determined that the information is compressible computer code for allocating a third portion of memory on the heap structure when it is determined that the information is not compressible, the allocated third portion of memory being substantially larger than the compressed object;
computer code for setting a pointer from the compressed object to the allocated third portion of memory;
computer code for uncompressing the second representation of data;
computer code for storing the uncompressed second representation of data into the allocated third portion of memory; and
computer code for storing the information into the allocated third portion of memory.
-
-
16. A computer program product as recited in claim 15 wherein the allocated third portion of memory is an uncompressed object and the computer code for writing the information further includes computer code for setting a bit in a header of the compressed object to identify an existence of the uncompressed object.
-
17. A computer program product as recited in claim 16 further including computer code for reading an uncompressed data field from the uncompressed object, wherein the computer code for reading the uncompressed data field from the uncompressed object includes:
-
computer code for identifying the compressed object;
computer code for following the pointer from the compressed object to the uncompressed object; and
computer code for obtaining contents of the uncompressed data field.
-
-
18. An object-based computer system for creating a compressed version of an object, the object being arranged to store a first representation of a set of data, the object-based computer system comprising:
-
a heap structure arranged to store the object;
a compression mechanism arranged to determine when the first representation of the set of data is suitable for compression, the compression mechanism further being arranged to compress the first representation of the set of data to form a second representation of the set of data when it is determined that the first representation of the set of data is suitable for compression;
an allocator arranged to allocate a first portion of memory on the heap structure when it is determined that the first representation of the set of data is suitable for compression, wherein the first portion of memory is substantially smaller than a second portion of memory associated with the object; and
a writing mechanism arranged to write the second representation of the set of data into the allocated first portion of memory. - View Dependent Claims (19, 20, 21)
a pointer setter for resetting a pointer that identifies the object to identify the allocated first portion of memory; and
a garbage collector for removing the object from the heap structure.
-
-
20. An object-based computer system as recited in claim 18 wherein the heap structure includes a first heap and a second heap, and the object is stored on the first heap.
-
21. An object-based computer system as recited in claim 20 wherein the allocated first portion of memory is allocated on the second heap.
-
22. A method for performing garbage collection within an object-based computing system, the method comprising:
-
traversing at least one heap structure associated with the object-based computing system; and
copying an object, the object being located on the at least one heap structure, the object including a first representation of a set of information, wherein copying the object includes determining when the object may be represented as a compressed format object, the compressed format object being substantially smaller in size than the object. - View Dependent Claims (23, 24, 25, 26)
creating the second representation of the set of information, wherein creating the second representation of the set of information includes reducing the number of bytes associated with the set of information;
allocating memory space on the at least one heap structure, wherein an amount of memory space allocated is less than an amount of memory space associated with the object; and
storing the second representation in the memory space allocated on the at least one heap structure.
-
-
25. A method as recited in claim 24 wherein copying the object further includes:
resetting a pointer which identifies the object to identify the memory space allocated on the at least one heap structure, wherein the memory space allocated on the at least one heap structure represents the compressed format object.
-
26. A method as recited in claim 25 further including removing the object from the at least one heap structure.
-
27. A computer program product for performing garbage collection within an object-based computing system, the computer program product comprising:
-
computer code for traversing at least one heap structure associated with the object-based computing system;
computer code for copying an object, the object being located on the at least one heap structure, the object including a first representation of a set of information, wherein the computer code for copying the object includes computer code for determining when the object may be represented as a compressed format object, the compressed format object being substantially smaller in size than the object; and
a computer readable medium that stores the computer codes. - View Dependent Claims (28, 29, 30, 31, 32)
computer code for creating the second representation of the set of information, wherein the computer code for creating the second representation of the set of information includes computer code for reducing the number of bytes associated with the set of information;
computer code for allocating memory space on the at least one heap structure, wherein an amount of memory space allocated is less than an amount of memory space associated with the object; and
computer code for storing the second representation in the memory space allocated on the at least one heap structure.
-
-
30. A computer program product as recited in claim 29 wherein the computer code for copying the object further includes:
computer code for resetting a pointer which identifies the object to identify the memory space allocated on the at least one heap structure, wherein the memory space allocated on the at least one heap structure represents the compressed format object.
-
31. A computer program product as recited in claim 30 further including computer code for removing the object from the at least one heap structure.
-
32. A computer program product as recited in claim 27 wherein the computer readable medium is one selected from the group consisting of a data signal embodied in a carrier wave, a hard disk, a CD-ROM, a tape, a computer memory, and a floppy disk.
Specification