Memory usage in managed runtime applications
Live objects in heap memory exceeding a threshold size and that have not been recently accessed are compressed or offloaded to secondary memory or storage. Compressing or offloading an object can further be based on how old the object is, which can be determined based on how many garbage collections the object has survived. Objects comprising references to other objects can be split into two sub-objects, one containing value fields that is compressed or offloaded and one containing reference fields that remains uncompressed in heap memory. Heap memory can undergo compaction after objects are compressed or offloaded. Compression accelerators can be used for compression and the decision of whether to compress or offload an object can be based on accelerator throughput, latency, availability, as well as other computing system metrics or characteristics. The compressing and offloading of objects and subsequent compaction can make more heap memory available for object allocation.
1 . A method comprising:
identifying an object located in volatile memory of a computing system and reachable from an application executing on the computing system;
compressing the object to create a compressed object, the compressing being performed in response to:
determining that a size of the object is larger than a threshold size; and
determining that the object has not been recently accessed;
storing the compressed object in a heap memory in a region of the volatile memory that stores compressed objects intermingled with uncompressed objects; and
compressing the heap memory in response to compressing the object.
2 . The method of claim 1 , wherein the determining that the size of the object is larger than a threshold size comprises determining that the object is located in a large object heap.
3 . The method of claim 1 , wherein the compressing is performed in further response to determining that an age of the object is greater than a threshold age.
4 . The method of claim 3 , wherein the object comprises garbage collection generation information, the determining that the age of the object is greater than the threshold age comprises determining that the garbage collection generation information satisfies a garbage collection generation criterion.
5 . A computing system, comprising:
one or more processing units; and
one or more computer-readable storage media storing computer-executable instructions that, when executed, cause the one or more processing units to:
identify an object stored in volatile memory of the one or more computer-readable storage media and reachable from an application executing on the computing system;
compress the object to create a compressed object, to compress the object to be performed in response to:
determining that a size of the object is larger than a threshold size; and
determining that the object has not been recently accessed;
store the compressed object in a heap memory in a region of the volatile memory that stores compressed objects intermingled with uncompressed objects; and
compact at least a portion of the heap memory in response to compressing the object.
6 . The computing system of claim 5 , wherein to compress the object is to be performed in further response to determining that an age of the object is greater than a threshold age.
7 . The computing system of claim 6 , wherein the object comprises garbage collection generation information, the determining that the age of the object is greater than the threshold age comprises determining that the garbage collection generation information satisfies a garbage collection generation criterion.
8 . The computing system of claim 5 , wherein to compress the object is to be performed by a compression accelerator.
9 . One or more computer-readable storage media storing computer-executable instructions for causing a computing system to:
identify an object located in volatile memory of the one or more computer-readable storage media and reachable from an application executing on the computing system, wherein the object comprises one or more reference fields and one or more value fields;
split the object into a first sub-object comprising the one or more value fields and a second sub-object comprising the one or more reference fields;
compress the object to create a compressed object, wherein to compress the object comprises to compress the first sub-object and to not compress the second sub-object and to compress the object to be performed in response to:
determining that a size of the object is larger than a threshold size; and
determining that the object has not been recently accessed; and
store the compressed object in a region of the volatile memory that stores compressed objects intermingled with uncompressed objects.
10 . The one or more computer-readable storage media of claim 9 , wherein to compress the object is performed in further response to determining that an age of the object is greater than a threshold age.
11 . The one or more computer-readable storage media of claim 10 , wherein the object comprises garbage collection generation information, the determining that the age of the object is greater than the threshold age comprises determining that the garbage collection generation information satisfies a garbage collection generation criterion.
12 . The one or more computer-readable storage media of claim 9 , wherein the object comprises compression hint information, to compress the object comprising to determine whether to compress the object based on the compression hint information.
13 . The one or more computer-readable storage media of claim 12 , wherein the compression hint information comprises a saturation counter indicating whether the object was recently compressed.
14 . The one or more computer-readable storage media of claim 9 , the computer-executable instructions to further cause the computing system to maintain an object dictionary comprising a plurality of object entries, individual of the plurality of object entries associated with an object reachable by the application and comprising an object size and access information indicating how recently the individual object has been accessed, the determining that the object size is larger than a threshold size comprising referencing the object dictionary to determine the size of the object, the determining that the object has not been recently accessed comprising referencing the object dictionary to determine how recently the object has been accessed.