Dynamic Memory Allocation for Heap Fragmentation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional memory allocation methods in operating systems lead to memory fragmentation and inefficient heap management, particularly for applications that allocate and deallocate small chunks of memory, resulting in unused 'holes' and inability to shrink the heap, leading to suboptimal memory usage under pressure.
Innovation Solution
Dynamic memory allocation involves dividing memory into smaller, fixed-size heaps that can be allocated and deallocated as needed, allowing for efficient reuse of memory by monitoring and releasing empty or hole-filled heaps, without requiring changes to applications.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Device complexity
If a single heap is allocated to an application, then memory allocation is simple, but memory fragmentation occurs over time
Solution Approach 1:
The patent divides the single heap into multiple smaller heaps (e.g., heap1, heap2, heap3) that can be independently managed. Each heap can be allocated and deallocated separately, allowing the system to reduce fragmentation by releasing and reallocating individual heaps rather than managing one large heap, thus improving memory usage efficiency while maintaining allocation simplicity through automated management
2Ease of operation
If heap memory is resident set memory, then memory is available to the application, but the whole heap must be swapped out under memory pressure
Solution Approach 1:
By segmenting the heap into multiple smaller heaps, the system can selectively swap out only the heaps that are not currently in use rather than swapping out the entire heap. This reduces the amount of data that needs to be written to disk under memory pressure, thereby reducing swap overhead and energy consumption while maintaining easy memory accessibility for active portions of the heap
3Reliability
If malloc_trim() is used to reduce fragmentation, then memory holes are reduced, but the operation is computationally intensive
Solution Approach 1:
The patent uses segmentation to divide the heap into multiple smaller heaps that can be independently managed. This eliminates the need for computationally intensive fragmentation repair operations like malloc_trim() because the segmented structure naturally allows for easier memory reclamation and reallocation without requiring complex compaction algorithms to fix fragmentation issues
4Speed
If the heap cannot be re-organized, then memory allocation is fast, but the heap cannot shrink even when memory is freed
Solution Approach 1:
The patent segments the heap into multiple smaller heaps that can be independently allocated and deallocated. This segmentation enables the heap structure to adapt its total size dynamically - when memory is freed from one or more heaps, those heaps can be deallocated and reallocated to other applications, allowing the original application to effectively shrink its memory footprint without requiring reorganization of the entire heap structure
Data Source
AI summary
Some embodiments of a system and a method to dynamically allocate memory to applications have been presented. For instance, an application interface executing on a processing device running in a computing system receives a request from an application running on the processing device for a predetermined capacity of memory. A kernel running on the processing device may allocate one or more consecutive heaps of memory to the application in response to the request. A total capacity of the heaps allocated is at least the predetermined capacity requested.


