String Pooling Using Index and Length for Memory Optimization
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In object-oriented programming languages, the management of string pools for efficient string processing tasks leads to unnecessary creation of temporary objects and memory allocation due to the lack of efficient identification and reuse of pooled string objects.
Innovation Solution
A method is implemented where a start index and length for a text sequence are used to poll a string pool for existing pooled string objects, and if a match is found, the existing object is used; otherwise, a new pooled string object is generated, with the option to store this information in a data bucket for sequential reuse, particularly applicable in processing XML documents and utilizing character array objects.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of energy
If string pool polling is implemented to identify existing pooled string objects, then memory allocation and processing overhead are minimized, but the complexity of string management increases
Solution Approach 1:
The system performs preliminary actions by maintaining a string pool of pre-created string objects and using start index and length parameters to identify and reuse existing strings before creating new ones, thereby reducing memory allocation overhead
Solution Approach 2:
Instead of creating new string objects, the system copies references to existing pooled string objects that match the required text sequence, eliminating redundant object creation and reducing processing overhead
2Quantity of substance
If pooled string objects are reused by polling the string pool, then temporary object creation is reduced, but the time required to search the pool increases
Solution Approach 1:
String objects are pre-created and stored in the pool before they are needed, allowing for efficient reuse without creation overhead. The start index and length parameters enable direct identification of pooled strings without full string comparison
Solution Approach 2:
The system uses start index and length parameters to efficiently identify pooled string objects without requiring complete string comparison, reducing the time complexity of pool searches while maintaining object reuse benefits
Data Source
AI summary
A start index and a length are obtained for a subset of a text sequence buffered within a parser. A string pool containing a plurality of pooled string objects is polled to determine whether any of the pooled string objects contain the subset of the text sequence buffered within the parser by using the start index and the length. One of the pooled string objects is used if it contains the subset of the text sequence, otherwise, the generation of a new pooled string object in the string pool containing the subset of the text sequence is initiated. Related techniques, apparatus, systems, and articles are described.


