Dynamic HTML Component Memory Reduction via Static Cloning
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The increasing complexity of visual components in web applications leads to high memory consumption, particularly in JavaScript, where memory management is challenging due to indirect references and automatic cleanup by the JavaScript engine, resulting in sluggish performance or application crashes.
Innovation Solution
The method involves constructing dynamic HTML components, generating static HTML clones, replacing dynamic components with static ones in the document object model, decoupling, and deleting dynamic components from memory using garbage collection, thereby reducing memory usage.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If dynamic HTML components are constructed using JavaScript, then interactivity and functionality are improved, but memory consumption increases
Solution Approach 1:
The patent creates a static HTML clone of the dynamic HTML component, copying the visual structure while eliminating the interactive JavaScript functionality. This allows the application to maintain visual fidelity while reducing memory usage by keeping only the essential static HTML structure rather than the full dynamic component with its associated JavaScript objects and event handlers.
2Adaptability or versatility
If complex visual components are constructed, then visual capability is improved, but memory usage increases
Solution Approach 1:
The patent extracts the static HTML structure from the dynamic HTML component, separating the visual representation from the interactive behavior. By taking out only the essential HTML structure and discarding the JavaScript-based interactive elements, the application maintains visual capability while significantly reducing memory usage associated with complex visual components.
3Extent of automation
If automatic garbage collection is used in JavaScript, then memory management is automated, but indirect references and closures prevent cleanup
Solution Approach 1:
The patent extracts and removes the dynamic HTML component from the DOM tree, which breaks the reference chains that prevent garbage collection. By taking out the component through DOM manipulation, the patent enables reliable memory cleanup by ensuring that all references to the component are severed, allowing the garbage collector to safely remove the component and its associated memory without being blocked by indirect references or closures.
4Adaptability or versatility
If dynamic HTML components are maintained in memory, then functionality is preserved, but application performance deteriorates
Solution Approach 1:
The patent creates a static HTML clone that copies the visual structure of the dynamic component without maintaining its interactive functionality in memory. This allows the application to preserve the visual appearance and basic structure while improving performance by eliminating the memory overhead and computational cost of maintaining the full dynamic component with its event handlers and JavaScript objects.
Data Source
AI summary
Embodiments of the present disclosure pertain to reducing memory usage in software applications. In one embodiment, the present disclosure includes a computer implemented method comprising constructing a dynamic HTML component in a document object model by executing first source code of a scripting language, generating a static HTML component clone of the dynamic HTML component by executing second source code of the scripting language, replacing the dynamic HTML component with the static HTML component in the document object model by executing third source code of the scripting language, decoupling the dynamic HTML component by executing fourth source code of the scripting language, and deleting the dynamic HTML component from memory using a garbage collection process in a scripting engine.


