Android system memory management optimization method

By implementing memory allocation strategies under memory defragmentation, memory leak detection, memory allocation optimization and multitasking in the Android system, multiple issues in the Android system in memory management have been solved, and memory utilization and system performance have been improved.

CN119473587APending Publication Date: 2025-02-18SHANDONG ARTAPLAY INTELLIGENT TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411519864.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In terms of memory management, Android system has problems such as memory fragmentation, memory leaks, low memory allocation efficiency and unreasonable memory allocation under multitasking.

Method used

Memory allocation strategies through memory defragmentation, memory leak detection, memory allocation optimization and multi-task processing, including fragmentation detection and classification, merger and reordering, reference chain analysis and garbage collection monitoring, memory pool management and dynamic adjustment, memory blocks Reuse, task priority evaluation, memory sharing, and memory recovery policies.

Benefits of technology

It effectively improves the memory utilization rate of the Android system, reduces memory leaks, improves memory allocation efficiency, and optimizes memory allocation under multi-tasking.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The Android system memory management optimization method is characterized by comprising the following steps: (1) memory fragment arrangement: (1-1) fragment detection and classification; (1-2) fragment merging; (1-3) rearranging memory blocks; (2) memory leak detection: (2-1) reference chain analysis; (2-2) garbage collection monitoring; (2-3) memory leak repair suggestion; (3) memory allocation optimization: (3-1) memory pool management; (3-2) dynamically adjusting the size of a memory block; (3-3) multiplexing the memory blocks; (4) a memory allocation strategy under multi-task processing: (4-1) task priority evaluation; (4-2) memory sharing; and (4-3) a memory recovery strategy. According to the method, the memory utilization rate of the Android system is improved, memory leakage is reduced, the memory allocation efficiency is improved, and memory allocation under multi-task processing is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer operating systems, and in particular to a memory management optimization method for an Android system. Background Art

[0002] As the current mainstream mobile operating system, the memory management efficiency of Android system directly affects the running speed and user experience of the device. Therefore, it is particularly important to develop a technology that can optimize the memory management of Android system and improve the performance of the device.

[0003] The memory management mechanism of the Android system includes Low Memory Killer (LMK), Page Reclaim and Page Replacement. However, as mobile application functions become increasingly rich and complex, traditional memory management mechanisms can no longer meet current needs. This is specifically reflected in the following aspects: 1. Memory fragmentation: After running for a long time, a large number of small memory fragments will appear in the Android system memory. These fragments cannot be effectively used, resulting in a waste of memory resources.

[0004] 2. Memory leak: Due to improper programming, some applications will continuously request memory during operation and forget to release it, resulting in memory leaks. This will not only occupy a large amount of memory resources, but may also cause the system to crash.

[0005] 3. Memory allocation efficiency: When allocating memory, the Android system needs to traverse the memory pool to find suitable free blocks. This process is time-consuming and affects system performance.

[0006] 4. Multitasking: The Android system supports multitasking, but different tasks have different memory requirements. The traditional memory management mechanism cannot dynamically adjust memory allocation according to task requirements, resulting in unreasonable resource allocation. Summary of the invention

[0007] In view of the problems existing in the above-mentioned background technology, the present invention proposes an Android system memory management optimization method, which aims to improve memory utilization, reduce memory leakage, improve memory allocation efficiency and optimize memory allocation under multi-tasking.

[0008] The present invention is achieved through the following technical solutions: An Android system memory management optimization method comprises the following steps: (1) Memory defragmentation (1-1) Debris detection and classification; (1-2) Fragment merging; (1-3) Memory block reordering; (2) Memory leak detection (2-1) Citation chain analysis; (2-2) Garbage collection monitoring; (2-3) Suggestions for fixing memory leaks; (3) Memory allocation optimization (3-1) Memory pool management; (3-2) Dynamically adjust the memory block size; (3-3) Memory block reuse; (4) Memory allocation strategy under multitasking (4-1) Task priority assessment; (4-2) Memory sharing; (4-3) Memory recovery strategy.

[0009] The detailed steps are as follows: Step 1. Memory Defragmentation Technology (1) Fragmentation detection and classification: First, the memory pool is traversed to detect and classify memory fragments. According to the size and distribution of the fragments, they are divided into three categories: large fragments, medium fragments, and small fragments. (2) Fragment merging: For adjacent small and medium fragments, a fragment merging algorithm is used to merge them into larger memory blocks to reduce the number and size of memory fragments; (3) Memory block rearrangement: After merging the fragments, the memory blocks will be rearranged to make the memory blocks in the memory pool more compact, which is convenient for subsequent memory allocation and management.

[0010] Step 2. Memory leak detection techniques (1) Reference chain analysis: Detect memory leaks in applications through reference chain analysis technology. A reference chain refers to a chain formed by a series of reference relationships starting from a root object (such as global variables, static variables, etc.). When an object cannot be referenced by other objects in the reference chain, it is considered that the object has a memory leak; (2) Garbage collection monitoring: At the same time, it also monitors the operation of the garbage collector and analyzes the garbage collection log to find potential memory leaks; (3) Memory leak repair suggestions: For detected memory leak problems, repair suggestions will be provided to help developers optimize the code and reduce the occurrence of memory leaks.

[0011] Step 3. Memory allocation optimization techniques (1) Memory pool management: The memory pool is divided into multiple sub-pools, each of which is responsible for allocating memory blocks of different sizes. By pre-allocating a certain number of memory blocks to the sub-pools, the memory allocation speed can be accelerated; (2) Dynamically adjust the memory block size: During the memory allocation process, the size of the memory block will be dynamically adjusted according to the actual needs of the application. For applications that require a large amount of memory, a larger memory block is allocated; for applications with smaller memory requirements, a smaller memory block is allocated; (3) Memory block reuse: For applications that frequently request and release memory blocks of the same size, memory block reuse technology is used to put the released memory blocks back into the corresponding sub-pool to reduce the overhead of memory allocation and release.

[0012] Step 4. Memory allocation strategy under multitasking (1) Task priority evaluation: By evaluating the priorities of different tasks, the priority of their memory requirements is determined. For high-priority tasks, memory is allocated first; for low-priority tasks, their memory allocation is dynamically adjusted according to memory usage; (2) Memory sharing: For tasks with similar functions, memory sharing technology is used to reduce the repeated allocation of memory resources. By sharing memory blocks, memory usage can be reduced and memory utilization can be improved; (3) Memory recycling strategy: When the system is short of memory, a memory recycling strategy will be formulated based on the task priority and memory usage. The memory resources of low-priority tasks are recycled first to ensure the normal operation of high-priority tasks.

[0013] The beneficial effect of the present invention is that the Android system memory management optimization method effectively improves the memory utilization of the Android system, reduces memory leaks, improves memory allocation efficiency, and optimizes memory allocation under multi-tasking through technical means such as memory defragmentation, memory leak detection, memory allocation optimization, and memory allocation strategy under multi-tasking. In the future, with the continuous development of mobile technology, the present invention will continue to iterate and optimize to adapt to new needs and challenges. DETAILED DESCRIPTION

[0014] The present invention is described in detail below with reference to specific embodiments.

[0015] The Android system memory management optimization method of the present invention comprises the following steps.

[0016] Step 1: Implementation of memory defragmentation technology (1) First, we traverse the memory pool, detect and classify memory fragments, and detect the number and size of memory fragments. According to the size and distribution of the fragments, we classify them into three categories: large fragments, medium fragments, and small fragments. (2) Then, a fragment merging algorithm is used to merge adjacent small and medium fragments into larger memory blocks to reduce the number and size of memory fragments; (3) Finally, the memory blocks are rearranged to make the memory blocks in the memory pool more compact, which facilitates subsequent memory allocation and management.

[0017] Through step 1, the number and size of memory fragments can be effectively reduced, and memory utilization can be improved.

[0018] Step 2: Implementation of memory leak detection technology (1) First, use reference chain analysis technology to detect memory leaks in applications. A reference chain is a chain formed by a series of reference relationships starting from a root object (such as a global variable, a static variable, etc.). When an object cannot be referenced by other objects in the reference chain, it is considered that the object has a memory leak; (2) Then, monitor the operation of the garbage collector and analyze the garbage collection log to find potential memory leaks; (3) Finally, for the detected memory leak problem, provide repair suggestions to help developers optimize the code and reduce the occurrence of memory leaks.

[0019] Through step 2, memory leaks in the application can be discovered and fixed in a timely manner, reducing the waste of memory resources.

[0020] Step 3: Implementation of memory allocation optimization techniques (1) First, the memory pool is divided into multiple sub-pools, each of which is responsible for allocating memory blocks of different sizes. By pre-allocating a certain number of memory blocks to the sub-pools, the memory allocation speed can be accelerated; (2) Then, during the memory allocation process, the size of the memory block is dynamically adjusted according to the actual needs of the application. For applications that require a large amount of memory, a larger memory block is allocated; for applications with smaller memory requirements, a smaller memory block is allocated; (3) Finally, for applications that frequently request and release memory blocks of the same size, memory block reuse technology is used to put the released memory blocks back into the corresponding sub-pool to reduce the overhead of memory allocation and release.

[0021] Through step 3, the memory allocation speed can be accelerated and the overhead of memory allocation and release can be reduced.

[0022] Step 4: Implementation of memory allocation strategy under multitasking (1) First, evaluate the priorities of different tasks and determine the priority of their memory requirements. For high-priority tasks, memory is allocated first; for low-priority tasks, their memory allocation is dynamically adjusted based on memory usage; (2) Then, for tasks with similar functions, memory sharing technology is used to reduce the repeated allocation of memory resources. By sharing memory blocks, memory usage can be reduced and memory utilization can be improved; (3) Finally, when the system is short of memory, a memory recycling strategy is formulated based on the task priority and memory usage. The memory resources of low-priority tasks are recycled first to ensure the normal operation of high-priority tasks.

[0023] Through step 4, memory allocation under multi-tasking can be optimized, and memory utilization and system performance can be improved.

Claims

1. An Android system memory management optimization method, characterized in that: The following steps are involved: (1) Memory defragmentation (1-1) Debris detection and classification; (1-2) Fragment merging; (1-3) Memory block reordering; (2) Memory leak detection (2-1) Citation chain analysis; (2-2) Garbage collection monitoring; (2-3) Suggestions for fixing memory leaks; (3) Memory allocation optimization (3-1) Memory pool management; (3-2) Dynamically adjust the memory block size; (3-3) Memory block reuse; (4) Memory allocation strategy under multitasking (4-1) Task priority assessment; (4-2) Memory sharing; (4-3) Memory recovery strategy.

2. The Android system memory management optimization method according to claim 1, characterized in that: Step (1) includes the following detailed steps: (1-1) Fragment detection and classification: First, the memory pool is traversed to detect and classify memory fragments, and the number and size of memory fragments are detected. According to the size and distribution of the fragments, they are divided into three categories: large fragments, medium fragments, and small fragments. (1-2) Fragment merging: Using the fragment merging algorithm, adjacent small and medium fragments are merged into larger memory blocks to reduce the number and size of memory fragments; (1-3) Memory block rearrangement: After merging the fragments, the memory blocks will be rearranged to make the memory blocks in the memory pool more compact, which is convenient for subsequent memory allocation and management; Through step (1), the number and size of memory fragments can be effectively reduced, and memory utilization can be improved.

3. The Android system memory management optimization method according to claim 1, characterized in that: Step (2) includes the following detailed steps: (2-1) Reference chain analysis: Detect memory leaks in applications through reference chain analysis technology. A reference chain is a chain formed by a series of reference relationships starting from the root object, which includes global variables and static variables. When an object cannot be referenced by other objects in the reference chain, it is considered that the object has a memory leak. (2-2) Garbage collection monitoring: At the same time, it also monitors the operation of the garbage collector and analyzes the garbage collection log to find potential memory leaks; (2-3) Memory leak repair suggestions: Provide repair suggestions for detected memory leak problems to help developers optimize code and reduce the occurrence of memory leaks; Through step (2), memory leak problems in the application can be discovered and fixed in a timely manner, reducing the waste of memory resources.

4. The Android system memory management optimization method according to claim 1, characterized in that: Step (3) includes the following detailed steps: (3-1) Memory pool management: Divide the memory pool into multiple sub-pools, each of which is responsible for allocating memory blocks of different sizes; by pre-allocating a certain number of memory blocks to the sub-pools, the memory allocation speed can be accelerated; (3-2) Dynamically adjust the size of memory blocks: During the memory allocation process, the size of memory blocks is dynamically adjusted according to the actual needs of the application. For applications that require a large amount of memory, larger memory blocks are allocated; for applications that require less memory, smaller memory blocks are allocated. (3-3) Memory block reuse: For applications that frequently request and release memory blocks of the same size, memory block reuse technology is used to put the released memory blocks back into the corresponding sub-pool to reduce the overhead of memory allocation and release; Through step (3), the memory allocation speed can be accelerated and the overhead of memory allocation and release can be reduced.

5. The Android system memory management optimization method according to claim 1, characterized in that: Step (4) includes the following detailed steps: (4-1) Task priority evaluation: By evaluating the priorities of different tasks, the priority of their memory requirements is determined; for high-priority tasks, memory is allocated first; for low-priority tasks, their memory allocation is dynamically adjusted according to memory usage; (4-2) Memory sharing: For tasks with similar functions, memory sharing technology is used to reduce the repeated allocation of memory resources. By sharing memory blocks, memory usage can be reduced and memory utilization can be improved. (4-3) Memory recovery strategy: When the system is short of memory, a memory recovery strategy will be formulated based on the task priority and memory usage; Prioritize the recovery of memory resources of low-priority tasks to ensure the normal operation of high-priority tasks; Through step (4), memory allocation under multi-tasking can be optimized, and memory utilization and system performance can be improved.

Citation Information

Cited By

  • Memory allocation method, device and system of battery management system, medium and product

    CN119847768A