# US 10,956,316 B2 · Method and device for processing reclaimable memory pages, and storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,956,316 B2
- Document ID: US10956316B2
- Status: Granted
- Kind: B2
- Application number: 16/139,624
- Filed: 2018-09-24
- Published: 2019-07-04
- Granted: 2021-03-23
- Earliest claimed: 2017-12-29
- Assignees: Guangdong Oppo Mobile Telecommunications Corp., Ltd.
- Applicants: Guangdong Oppo Mobile Telecommunications Corp., Ltd.
- Inventors: Pan Fang; Yan Chen
- Web page: https://patentgrep.com/patent/US10956316B2

## CPC

- G06F 12/0253: {Garbage collection, i.e. reclamation of unreferenced memory}
- G06F 9/445: Program loading or initiating (bootstrapping G06F9/4401; security arrangements for program loading or initiating G06F21/57)
- G06F 9/5022: {Mechanisms to release resources}
- G06F 11/3419: {by assessing time}
- G06F 12/121: using replacement algorithms
- G06F 12/123: with age lists, e.g. queue, most recently used [MRU] list or least recently used [LRU] list
- G06F 2212/1024: Latency reduction
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and device for processing a memory, and a computer-readable storage medium are provided. In the method, reclaimable memory pages occupied by an application to be processed are determined, a reclaiming proportion corresponding to the application to be processed is determined, a reclaiming number is determined according to the reclaimable memory pages and the reclaiming proportion, and the reclaiming number of memory pages from the reclaimable memory pages are selected and reclaimed.

## Claims

### Claim 1

A method for processing a memory, the method being carried out in an electronic device and comprising:
determining a plurality of reclaimable memory pages occupied by an application to be processed, comprising:
determining all memory pages occupied by the application to be processed by querying a memory occupied by the application to be processed; and
determining as the plurality of reclaimable memory pages of the all memory pages except at least one particular memory page, wherein data stored on each of the at least one particular memory page is being used by the application to be processed or is data necessary for keeping normal running of the application to be processed;
determining a reclaiming portion corresponding to the application to be processed, wherein the reclaiming proportion represents a proportion of memory pages to be reclaimed in the plurality of reclaimable memory pages;
determining a reclaiming number according to the plurality of reclaimable memory pages and the reclaiming proportion; and
selecting the reclaiming number of reclaimable memory pages from the plurality of reclaimable memory pages and reclaiming the reclaiming number of memory pages,
wherein the determining a reclaiming proportion corresponding to the application to be processed comprises;
determining restarting durations and an application type of the application to be processed, the application type indicating correspondences between restarting durations for the application to be processed and reclaiming proportions, each restarting duration indicating a duration taken for restarting the application to be processed after a reclaiming proportion of the plurality of reclaimable memory pages of the application to be processed is reclaimed; and
determining a reclaiming proportion corresponding to the application to be processed according to a reclaiming model corresponding to the application type.

### Claim 2 (depends on 1)

The method of claim 1, wherein the determining as the plurality of reclaimable memory pages the all memory pages except at least one particular memory page comprises:
determining at least one particular memory page having stored data being used by the application to be processed or having data necessary for keeping normal running of the application to be processed;
configuring an occupation mark for each of the at least one particular memory page, the occupation mark indicating that the particular memory page cannot be reclaimable; and
determining as the plurality of reclaimable memory pages the all memory pages except at least one particular memory page for which the occupation mark is configured.

### Claim 3 (depends on 2)

The method of claim 2, wherein the querying all memory pages of a memory occupied by the application to be processed comprises:
traversing memory-mapped files of the application to be processed; and
querying, in memory-mapped files, all memory pages occupied by the application to be processed.

### Claim 4 (depends on 1)

The method of claim 1, wherein the determining a reclaiming proportion corresponding to the application to be processed according to a reclaiming model corresponding to the application type comprises:
when the application type indicates that there are no correspondences between restarting durations for the application to be processed and reclaiming proportions, determining that the reclaiming proportion corresponding to the application to be processed is 100%.

### Claim 5 (depends on 1)

The method of claim 1, wherein the determining a reclaiming proportion corresponding to the application to be processed according to a reclaiming model corresponding to the application type comprises:
when the application type indicates that there are linear correspondences between restarting durations for the application to be processed and reclaiming proportions, determining the reclaiming proportion corresponding to the application to be processed according to a slope of the linear correspondences.

### Claim 6 (depends on 1)

The method of claim 1, wherein the determining a reclaiming proportion corresponding to the application to be processed according to a reclaiming model corresponding to the application type comprises:
when the application type indicates that there are non-linear correspondences between restarting durations for the application to be processed and reclaiming proportions, determining the reclaiming proportion corresponding to the application to be processed such that a cost performance between a total number of reclaimed memory pages and a restarting duration of the application to be processed is highest.

### Claim 7 (depends on 1)

The method of claim 1, wherein the selecting the reclaiming proportion of memory pages from the reclaimable memory pages and reclaiming the reclaiming number of memory pages comprises:
selecting the reclaiming number of reclaimable memory pages from the reclaimable memory pages according to a descending size order of idle durations and reclaiming the reclaiming number of memory pages, the idle duration is a duration during which the reclaimable memory page is not used by the application to be processed.

### Claim 8 (depends on 1)

The method of claim 1, wherein the selecting the reclaiming proportion of memory pages from the reclaimable memory pages and reclaiming the reclaiming number of memory pages comprises:
selecting the reclaiming number of reclaimable memory pages from the reclaimable memory pages at equal intervals according to serial numbers of memory pages and reclaiming the reclaiming number of memory pages.

### Claim 9 (depends on 1)

The method of claim 1, wherein before determining reclaimable memory pages occupied by an application to be processed, the method further comprises:
detecting whether at least one foreground application depends on the application to be processed;
when at least one foreground application depends on the application to be processed, adjusting the priority of the application to be processed to match the foreground application; and
when no foreground application depends on the application to be processed, performing the operation of determining reclaimable memory pages occupied by an application to be processed.

### Claim 10

An electronic device, comprising a memory and a processor, the memory storing a computer program that when executed by the processor, causes the processor to perform:
determining a plurality of reclaimable memory pages occupied by an application to be processed, comprising:
determining all memory pages occupied by the application to be processed by querying a memory, occupied by the application to be processed; and
determining as the plurality of reclaimable memory pages the all memory pages except at least one particular memory page, wherein data stored on each of the at least one particular memory page is being used by the application to be processed or is data necessary for keeping normal running of the application to be processed;
determining a reclaiming proportion corresponding to the application to be processed, wherein the reclaiming proportion represents a proportion of memory pages to be reclaimed in the plurality of reclaimable memory pages;
determining a reclaiming number according to the plurality of reclaimable memory pages and the reclaiming proportion; and
selecting the reclaiming number of reclaimable memory pages from the plurality of reclaimable memory pages and reclaiming the reclaiming number of memory pages;
wherein the determining a reclaiming proportion corresponding to the application to be processed comprises;
determining restarting durations and an application type of the application to be processed, the application type indicating correspondences between restating durations for the application to be processed and reclaiming proportions, each restarting duration indicating a duration taken for restarting the application to be processed after a reclaiming proportion of the plurality of reclaimable memory pages of the application to be processed is reclaimed; and
determining a reclaiming proportion corresponding to the application to be processed according to a reclaiming model corresponding to the application type.

### Claim 11 (depends on 10)

The electronic device of claim 10, wherein the determining as the plurality of reclaimable memory pages the all memory pages except at least one particular memory page comprises:
determining at least one particular memory page having stored data being used by the application to be processed or having data necessary for keeping normal running of the application to be processed;
configuring an occupation mark for each of the at least one particular memory page, the occupation mark indicating that the particular memory page cannot be reclaimable; and
determining as the plurality of reclaimable memory pages the all memory pages except at least one particular memory page for which the occupation mark is configured.

### Claim 12 (depends on 11)

The electronic device of claim 11, wherein the querying all memory pages of a memory occupied by the application to be processed comprises:
traversing memory-mapped files of the application to be processed; and
querying, in memory-mapped files, all memory pages occupied by the application to be processed.

### Claim 13 (depends on 10)

The electronic device of claim 10, wherein the determining a reclaiming proportion corresponding to the application to be processed according to a reclaiming model corresponding to the application type comprises:
when the application type indicates that there are no correspondences between restarting durations for the application to be processed and reclaiming proportions, determining that the reclaiming proportion corresponding to the application to be processed is 100%.

### Claim 14 (depends on 10)

The electronic device of claim 10, wherein the determining a reclaiming proportion corresponding to the application to be processed according to a reclaiming model corresponding to the application type comprises:
when the application type indicates that there are linear correspondences between restarting durations for the application to be processed and reclaiming proportions, determining the reclaiming proportion corresponding to the application to be processed according to a slope of the linear correspondences.

### Claim 15

A non-transitory computer-readable storage medium having stored thereon a computer program that when executed by a processor, causes the processor to perform a method, the method comprising:
determining a plurality of reclaimable memory pages occupied by an application to be processed, comprising:
determining all memory pages occupied by the application to be processed by querying a memory occupied by the application to be processed; and
determining as the plurality of reclaimable memory pages the all memory pages except at least one particular memory page, wherein data stored on each of the at least one particular memory page is being used by the application to be processed or is data necessary for keeping normal running of the application to be processed;
determining a reclaiming proportion corresponding to the application to be processed, wherein the reclaiming proportion represents a proportion of memory pages to be reclaimed in the plurality of reclaimable memory pages;
determining a reclaiming number according to the plurality of reclaimable memory pages and the reclaiming proportion; and
selecting the reclaiming number of reclaimable memory pages from the plurality of reclaimable memory pages and reclaiming the reclaiming number of memory pages,
wherein the determining a reclaiming proportion corresponding to the application to be processed comprises;
determining restarting durations and an application type of the application to be processed, the application type indicating correspondences between restarting durations for the application to be processed and reclaiming proportions, each restarting duration indicating a duration taken for restarting the application to be processed after a reclaiming proportion of the plurality of reclaimable memory pages of the application to be processed is reclaimed; and
determining a reclaiming proportion corresponding to the application to be processed according to a reclaiming model corresponding to the application type.
