Lightweight Object Instance Sharing for Memory Reduction
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The duplication of class object instances when objects inherit from the same class leads to inefficient use of memory and storage space, particularly when storing objects in a database.
Innovation Solution
Implementing a system for lightweight objects where a sharable type is designated as a parent for multiple lightweight type objects, allowing only a single copy of the sharable type and its instance to be stored, rather than duplicating copies for each lightweight type composite object, similar to heavyweight objects.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If class object instances are stored for each object that inherits from the same class, then each object can access its class behavior and data, but memory and storage space are inefficiently used due to duplication
Solution Approach 1:
Multiple lightweight object instances share a single parent class object instance in memory. Instead of each object having its own copy of the parent class instance, they all reference the same shared parent class instance, thereby merging the storage of class behavior and data into a single location that serves multiple objects.
Solution Approach 2:
The parent class object instance serves multiple functions by being shared across multiple lightweight object instances. A single parent class instance provides class behavior and data to numerous child objects, making it universal and eliminating the need for duplicate copies.
2Adaptability or versatility
If class object instances are stored for each object that inherits from the same class, then complete object functionality is maintained, but storage efficiency is reduced
Solution Approach 1:
The functionality provided by parent class instances is merged into a single shared instance that multiple lightweight objects reference. This consolidation maintains complete object functionality while reducing storage space by eliminating redundant copies of the same class data.
Solution Approach 2:
Instead of creating physical copies of parent class instances for each child object, the system uses references or pointers to the single shared parent class instance. This copying approach allows multiple objects to access the same functional data without duplicating the actual storage.
3Quantity of substance
If a single sharable type instance is shared across multiple lightweight objects, then memory usage is reduced, but system complexity increases
Solution Approach 1:
The system introduces lightweight object instances as intermediaries between the shared parent class instance and the actual object functionality. These lightweight instances act as mediators that reference the shared parent class, simplifying the overall structure by providing a clear hierarchical relationship rather than complex many-to-many associations.
Data Source
AI summary
Converting heavyweight instances to lightweight instances is disclosed. An indication is received to convert one or more heavyweight instances to corresponding one or more lightweight instances. One or more sharable parent instances is/are created. One or more lightweight instances is/are created. For each lightweight instance, one of the one or more sharable parent instances is/are designated as a parent to create a lightweight composite instance. Each of at least a subset of the one or more sharable parent instances is shared by two or more lightweight instances. And, the created lightweight composite instances are configured to provide the functionality provided by the one or more heavyweight instances.


