Efficient memory management in software caches
AssigneeInternational Business Machines Corporation
InventorsAvinash Koradhanyamath, Shirish T. S. Kuncolienkar, Ajith Ramanath
Life of this patent
Estimating the term…
Abstract
The use of heap memory is optimized by extending a cache implementation with a CacheInterface base class. An instance of a ReferenceToCache is attached to the CacheInterface base class. The cache implementation is registered to a garbage collector application. The registration is stored as a reference list in a memory. In response to an unsatisfied cache allocation request, a garbage collection cycle is triggered to check heap occupancy. In response to exceeding a threshold value, the reference list is traversed for caches to be cleaned based upon a defined space constraint value. The caches are cleaned in accordance with the defined space constraint value.
Claims17
A method for optimizing use of heap memory, comprising:
- with a processor, extending a cache implementation with a base class;
- with said processor, attaching an instance of a utility class to said base class;
- registering said cache implementation to a garbage collector routine with said processor;
- storing said registration as a reference list in a memory;
- responsive to an unsatisfied cache allocation request, triggering a garbage collection cycle to check heap occupancy;
- responsive to exceeding a first threshold value, traversing said reference list to identify caches for cleanup based upon a defined space constraint value, wherein said space constraint value comprises a plurality of defined percentages of total caches to be cleaned;
- and clearing all said identified caches in compliance with a plurality of criteria and in accordance with said defined space constraint value.
A system for optimizing use of heap memory, comprising:
- a processor;
- and memory connected to the processor, wherein the memory is encoded with instructions and wherein the instructions when executed comprise:
- instructions for extending a cache implementation with a base class;
- instructions for attaching an instance of a utility class to said base class;
- instructions for registering said cache implementation to a garbage collector routine;
- instructions for storing said registration as a reference list;
- responsive to an unsatisfied cache allocation request, instructions for triggering a garbage collection cycle to check heap occupancy;
- and responsive to exceeding a first threshold value, instructions for traversing said reference list to identify caches for cleanup based upon a defined space constraint value, wherein said space constraint value comprises a plurality of defined percentages of total caches to be cleaned;
- and instructions for cloning clearing all said identified caches in compliance with a plurality of criteria and in accordance with said defined space constraint value.
A computer program product for optimizing use of heap memory, the computer program product comprising a non-transitory computer readable storage medium having computer readable program code embodied therewith, the computer readable program code comprising:
- computer readable program code configured to extend a cache implementation with a base class;
- computer readable program code configured to attach an instance of a utility class to said base class;
- computer readable program code configured to register said cache implementation to a garbage collector routine;
- computer readable program code configured to store said registration as a reference list;
- responsive to an unsatisfied cache allocation request, computer readable program code configured to trigger a garbage collection cycle to check heap occupancy;
- responsive to exceeding a first threshold value, computer readable program code configured to traverse said reference list to identify caches for cleanup based upon a defined space constraint value;
- and computer readable program code configured to clean said caches in accordance with said defined space constraint value, wherein said space constraint value comprises a plurality of defined percentages of total caches to be cleaned;
- and computer readable program code configured to clearing all said identified caches in compliance with a plurality of criteria and in accordance with said defined space constraint value.
Dependencies are inferred from the claim text.