Cross-Platform Memory Management via Garbage Collection Handles
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Modern cross-platform software development tools face challenges in managing memory effectively on target platforms like mobile devices and game consoles, where memory management features interfere with each other, leading to inefficiencies and potential application errors.
Innovation Solution
Implementing a system that uses multiple memory managers, one for the managed runtime environment and another for the native runtime environment, with garbage collection handles and reference counting to ensure safe memory management by modifying garbage collection handles based on interaction types and reference counts, thereby preventing unintended memory deallocation.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Device complexity
If a single memory manager is used in cross-platform applications, then the system structure is simple, but memory management reliability deteriorates due to interference between managed and native runtime environments
Solution Approach 1:
The patent divides the memory management system into two separate memory managers: a first memory manager for the managed runtime environment and a second memory manager for the native runtime environment. Each manager independently manages memory allocations and deallocations for its respective environment, preventing interference and ensuring reliable memory management across both runtime contexts.
2Productivity
If memory is automatically deallocated by the managed runtime memory manager, then memory efficiency is improved, but application stability deteriorates when native runtime still needs the memory
Solution Approach 1:
The patent implements a reference counting mechanism where the second memory manager monitors native runtime references to managed peer objects. When the native runtime holds a reference, the reference count prevents automatic deallocation by the first memory manager. The system continuously tracks reference states and adjusts memory deallocation decisions based on current reference counts, ensuring memory is only freed when safe.
3Reliability
If multiple memory managers are implemented, then memory management reliability is improved, but system complexity increases
Solution Approach 1:
The patent introduces a binding layer as an intermediary between the two memory managers. This binding layer handles the coordination and communication between the managed and native runtime environments, managing peer object references and coordinating memory management actions. The binding layer abstracts the complexity of dual memory manager interaction, providing a clean interface that simplifies the overall system architecture.
Data Source
AI summary
Embodiments are directed towards managing memory for an application be executing in a managed runtime environment. Managed peer objects may be generated to correspond to native objects executing in a native runtime environment such that memory may be allocated for managed peer objects. Garbage collection handles may be generated and associated with the managed peer objects. If the managed application executes instructions that interact with the managed peer objects and the native runtime environment each garbage collection handle associated with the managed peer objects may be modified based on a type of an interaction. The garbage collection handlers may be garbage collection roots for a garbage collector that may be included in the managed runtime memory manager. If a garbage collection event occurs, memory for the managed peer objects may be deallocated based in part on its correspondent garbage collection handle.


