Memory Quota Detection Using RSS Screening and PSS Verification
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing memory detection methods in electronic devices are time-consuming and inaccurate due to the time-consuming process of detecting proportional set size (PSS) and the inaccurate attribution of shared library memory during resident set size (RSS) detection, leading to resource abuse by background applications.
Innovation Solution
The method involves detecting resident set size (RSS) first, and if it exceeds a threshold, then detecting proportional set size (PSS) to filter out processes exceeding the memory quota, thereby improving accuracy and reducing detection time by skipping unnecessary PSS detection when RSS is within the quota.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If PSS detection is performed for all processes to ensure accurate memory detection, then measurement precision is improved, but detection time increases significantly
Solution Approach 1:
The memory detection process is segmented into two stages: first performing rapid RSS detection for all processes to filter out those within quota, then performing detailed PSS detection only for processes exceeding the RSS threshold. This segmentation resolves the contradiction by applying different detection depths to different process groups.
Solution Approach 2:
Instead of performing complete PSS detection on all processes (excessive action), the system performs partial detection by first using RSS as a screening mechanism. This partial action approach detects only the necessary subset of processes that require detailed PSS analysis, reducing overall detection time while maintaining accuracy for critical cases.
2Productivity
If RSS detection is used to reduce detection time, then productivity is improved, but measurement precision deteriorates due to inaccurate shared library memory attribution
Solution Approach 1:
RSS serves as an intermediary screening mechanism that quickly identifies processes potentially exceeding memory quotas. While RSS alone has attribution inaccuracies for shared libraries, it acts as an effective first-stage filter that directs subsequent accurate PSS detection to only those processes needing it, thus maintaining both speed and precision.
Solution Approach 2:
RSS detection is performed as a preliminary action before PSS detection. This preliminary screening establishes a subset of processes that require further accurate analysis, preventing the need for time-consuming PSS detection on all processes while ensuring that processes with potential memory issues are accurately identified.
3Adaptability or versatility
If memory quota is set to control background application resources, then resource management is improved, but system complexity increases due to multiple detection mechanisms
Solution Approach 1:
The detection system dynamically adjusts its behavior based on RSS detection results. For processes with RSS within quota, only RSS detection is performed (simpler path). For processes exceeding RSS threshold, the system dynamically transitions to include PSS detection (more comprehensive path). This dynamic adaptation resolves the complexity issue by making the system's complexity proportional to the problem's severity.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
This application discloses a memory detection method and an electronic device. The method may include: The electronic device detects first memory occupied by a first process, where the first memory is a resident set size RSS; when the first memory is greater than a first threshold, the electronic device detects second memory occupied by the first process, where the second memory is a proportional set size PSS; and when the second memory is greater than the first threshold, the electronic device performs memory detection on the first process based on preset time. In this way, the electronic device first detects the RSS occupied by the first process. If the RSS occupied by the first process exceeds a memory quota (namely, the first threshold), the electronic device then detects the PSS occupied by the first process. Because a range of the RSS is larger than a range of the PSS, the electronic device filters out most processes by detecting the RSS occupied by the first process, and then accurately locates, by detecting the PSS occupied by the first process, a process whose memory exceeds a quota, to improve memory detection accuracy.