Object Shell Reuse for Faster Deserialization and Lower GC Load
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing object-oriented programming languages like Java and Python face inefficiencies in deserialization processes due to the need to recreate entire objects in memory space, leading to low efficiency, increased garbage collection, and potential memory overflow.
Innovation Solution
A deserialization method that pre-creates object shells in memory space, utilizing object pools to reuse these shells, thereby avoiding recreation of objects during deserialization and reducing garbage collection, especially young and full garbage collection, and minimizing memory overflow.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If the entire object is recreated in memory space during deserialization, then the object can be obtained, but deserialization efficiency is low
Solution Approach 1:
The object is segmented into two parts: the object shell (header and body structure) and the element data. During deserialization, only the element data is filled into the pre-created object shell, rather than recreating the entire object from scratch. This segmentation allows the reusable shell to be retained while only the variable data portion is deserialized.
Solution Approach 2:
The object shell (including header and body structure) is pre-created and stored in an object pool before deserialization occurs. This preliminary action eliminates the need to recreate the shell structure during deserialization, significantly reducing the time and computational resources required for the deserialization process.
2Productivity
If objects are recreated during deserialization, then deserialization can be performed, but garbage collection frequency increases
Solution Approach 1:
Instead of discarding object shells after use, the patent recovers and reuses them by storing them in an object pool. When deserialization is needed, shells are retrieved from the pool, used, and then returned to the pool for future use. This recovering approach dramatically reduces the number of objects that need to be garbage collected.
3Productivity
If entire objects are recreated in memory space, then deserialization is completed, but memory overflow risk increases
Solution Approach 1:
The patent creates a lightweight copy (object shell) that contains only the structural information (header and body layout) without the actual element data. This shell is stored in an object pool and reused multiple times. Only the necessary element data is deserialized and filled into the shell, significantly reducing memory space consumption compared to recreating entire objects.
Data Source
AI summary
This application discloses a deserialization method. A first object shell of a first object is created in memory space of a process, where the first object shell includes a first object header and a first object body; a serialization result of the first object is obtained; the serialization result of the first object is deserialized based on the first object shell, to obtain the first object; and after the first object is used by the process, the first object shell is released, where the first object shell may be used to deserialize a subsequently received serialization result. Deserialization efficiency is improved by reusing an object shell.


