Patent ID: 9715448
Date: 2017-07-25
CPC Classifications: G06F

Claim:
1. A computer system for collection instance resizing, the computer system comprising: one or more processors, one or more computer-readable memories, one or more computer-readable tangible storage medium, and program instructions stored on at least one of the one or more tangible storage medium for execution by at least one of the one or more processors via at least one of the one or more memories, wherein the computer system is capable of performing a method comprising: identifying, by a processor, at least one collection object among a plurality of live collection objects within a collection framework of a virtual machine, wherein the plurality of live collection objects relates to a plurality of elements actively stored with the virtual machine; determining a current modification count is equal to a cached count based on comparing the current modification count associated with the at least one identified collection object with a cached count associated with each at least one identified collection object, wherein the cached count is a record of a plurality of previous modifications to the at least one identified collection object during a previous garbage collection cycle kept by a scalar counter, and wherein the value of the scalar counter is cached at a garbage collection point within the at least one identified collection object upon a completion of a garbage collection cycle, and wherein the current modification count is a record of a plurality of current modifications to the at least one identified collection object during a current garbage collection cycle; determining a garbage collection cycle count associated with the at least one identified collection object exceeds a value of thirty-two, wherein the garbage collection cycle count is a tally of a plurality of completed garbage collection cycles by the collection framework; determining an occupancy ratio associated with the at least one identified collection object is less than a preconfigured shrink threshold, wherein the occupancy ratio is calculated as a plurality of actively used memory within the collection framework compared to a plurality of total available memory within the collection framework, and wherein the preconfigured shrink threshold is a preconfigured value relating to the plurality of actively used memory within the collection framework compared to the plurality of total available memory within the collection framework; and restructuring the at least one identified collection object based on determining the modification count is equal to the cached count, the garbage collection cycle count exceeds the value of thirty-two, and the occupancy ratio is less than the preconfigured shrink threshold, wherein restructuring the at least one identified collection object includes shrinking the at least one identified collection object to a previous expansion boundary nearest to a current volume of the at least one identified collection object by creating a new backing structure to the collection framework with a size equal to the current volume, copying a plurality of currently stored content on an old backing structure to the created new backing structure, and deleting the old backing structure, and wherein the scalar counter is reset when the at least one identified collection object is shrunk.