CN113076194A - Memory resource allocation method, device, terminal and storage medium - Google Patents

Memory resource allocation method, device, terminal and storage medium Download PDF

Info

Publication number
CN113076194A
CN113076194A CN202110336568.0A CN202110336568A CN113076194A CN 113076194 A CN113076194 A CN 113076194A CN 202110336568 A CN202110336568 A CN 202110336568A CN 113076194 A CN113076194 A CN 113076194A
Authority
CN
China
Prior art keywords
memory
memory resource
resource
resources
memory resources
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110336568.0A
Other languages
Chinese (zh)
Inventor
李培锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202110336568.0A priority Critical patent/CN113076194A/en
Publication of CN113076194A publication Critical patent/CN113076194A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources

Abstract

The application relates to a memory resource allocation method, a memory resource allocation device, a terminal and a storage medium, and belongs to the technical field of terminals. The method comprises the following steps: determining available memory resources for a file cleaning function; determining the memory resources available for the file cleaning function as multiplexing memory resources of a user interaction interface (UI) process; and responding to the received instruction for allocating the memory resource for any UI process, and allocating the memory resource for any UI process based on the multiplexing memory resource. According to the scheme, the UI process can be prevented from being executed slowly due to insufficient memory resources of the UI process, so that page jamming is prevented, and page smoothness is improved.

Description

Memory resource allocation method, device, terminal and storage medium
Technical Field
The embodiment of the application relates to the technical field of terminals, in particular to a memory resource allocation method, a memory resource allocation device, a terminal and a storage medium.
Background
Currently, a Linux (an operating system name) system is provided with a recycling mechanism for recycling memory resources. In the process of memory resource recovery, the recovery mechanism is adopted for all processes meeting the recovery conditions to recover the memory resources. However, for a User Interface (UI) process, if the recycle mechanism is adopted, the memory resource occupied by the UI process is low, which results in a long UI process time and a problem of page jamming, resulting in a reduction in page fluency.
Disclosure of Invention
The embodiment of the application provides a memory resource allocation method, a memory resource allocation device, a terminal and a storage medium, and page fluency can be improved. The technical scheme is as follows:
in one aspect, a method for allocating memory resources is provided, where the method includes:
determining available memory resources for a file cleaning function;
determining the memory resource available for the file cleaning function as a multiplexing memory resource of a user interaction interface (UI) process;
and responding to a received instruction for allocating memory resources for any UI process, and allocating the memory resources for any UI process based on the multiplexing memory resources.
In another aspect, an apparatus for allocating memory resources is provided, the apparatus including:
the first determining module is used for determining available memory resources of the file cleaning function;
the second determining module is used for determining the memory resource available for the file cleaning function as a multiplexing memory resource of a user interaction interface (UI) process;
and the resource allocation module is used for responding to a received instruction for allocating the memory resource for any UI process and allocating the memory resource for any UI process based on the multiplexing memory resource.
In another aspect, a terminal is provided that includes a processor and a memory; the memory stores at least one program code for execution by the processor to implement the memory resource allocation method as described in the above aspect.
In another aspect, a computer readable storage medium is provided, the storage medium storing at least one program code for execution by a processor to implement the memory resource allocation method as described in the above aspect.
In another aspect, a computer program product is provided, where at least one program code is stored, and the at least one program code is loaded and executed by a processor to implement the memory resource allocation method of the above aspect.
In the embodiment of the application, after an instruction for allocating memory resources to any UI process is received, a file cleaning function is started, and then the memory resources of the file cleaning function are started, and the memory resources are used as multiplexing memory resources, so that when the first free memory resources of the multiplexing memory resources are enough to meet the target memory resources of any UI process, the memory resources are allocated to any UI process from the first free memory resources, and therefore, the low execution speed of the UI process caused by insufficient memory resources of the UI process is prevented, page jamming is prevented, and page fluency is improved.
Drawings
FIG. 1 illustrates a flow diagram of a memory resource allocation method in accordance with an exemplary embodiment of the present application;
FIG. 2 illustrates a flow diagram of a memory resource allocation method in accordance with an exemplary embodiment of the present application;
FIG. 3 illustrates a flow chart of a memory resource allocation method in accordance with an exemplary embodiment of the present application;
FIG. 4 illustrates a flow chart of a memory resource allocation method in accordance with an exemplary embodiment of the present application;
FIG. 5 illustrates a flow chart of a memory resource allocation method in accordance with an exemplary embodiment of the present application;
FIG. 6 illustrates a flow chart of a memory resource allocation method in accordance with an exemplary embodiment of the present application;
fig. 7 is a block diagram illustrating a memory resource allocation apparatus according to an exemplary embodiment of the present application;
fig. 8 shows a schematic structural diagram of a terminal according to an exemplary embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Reference herein to "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
At present, in order to ensure that a Linux system can normally operate and ensure the resource amount of idle memory resources, the Linux system is provided with a memory resource recycling mechanism. The memory resource recovery means that if data can be stored in a disk, the data can be stored in the disk when the memory resource is insufficient, and then the memory resource occupied by the data is released as a free memory resource to be provided for other processes in the system to use.
In the process of memory resource recovery, the memory resource is often recovered by using a Least Recently Used (LRU) linked list. Generally, when the memory resources are insufficient, the memory resources occupied by the corresponding process are recycled through the LRU linked list. However, for a better user experience for the user, the importance of the UI process is generally set higher than other background processes. Among them, the fluency of the UI process can affect the experience of human-computer interaction. Therefore, in the process of recovering the memory resources, if the scene of recovering the UI process is the same as the scenes of other processes, the memory resources used by the UI process may be recovered, and further the memory resources occupied by the UI process are smaller, which causes the foreground to be stuck and reduces the page fluency.
In the related art, in order to ensure that a UI process can normally operate, a certain memory resource is usually reserved for the UI process in a system memory resource, and the reserved memory resource is only used for allocating the memory resource of the UI process, and in this case, other types of processes cannot use the memory resource. Under the condition that the memory resources of the system are relatively tense, other types of processes cannot use the reserved memory resources, so that the reserved memory resources are wasted, and the memory resources are more tense. Therefore, a memory resource allocation method is needed to allocate memory resources for the UI process, so as to avoid memory resource waste on the premise of ensuring that the UI process can be normally performed.
Fig. 1 is a flowchart illustrating a memory resource allocation method according to an exemplary embodiment of the present application. The execution main body in the embodiment of the present application may be a terminal, or may also be a processor in the terminal or an operating system in the terminal, and the embodiment takes the execution main body as the terminal for example. In this embodiment, a description is given by taking an example that when a terminal receives an instruction for allocating a memory resource to any UI process, the terminal directly allocates the memory resource to the UI process in a multiplexing memory resource. The method comprises the following steps:
step 101: and the terminal determines the available memory resources of the file cleaning function.
In this step, the terminal reserves memory resources for a file cleaning function, which is used to clean cleanable files.
In some embodiments, the file cleaning function is a function implemented by a clearcache flow. The cache flow refers to storing some files which may be accessed during process running in the memory resource, and reading the files in the memory through the external memory disk when the files need to be stored in the disk. The clearcache flow refers to a process of storing a file process corresponding to a process which does not need to interact with an external memory at present, and files stored through the clearcache flow can be directly cleaned during cleaning without interacting with an external disk.
In the implementation mode, the memory resource occupied by the clearcache flow is determined, and the memory resource occupied by the clearcache flow is used as the multiplexing memory resource of the UI process, and because the file stored in the memory resource by the clearcache flow does not need to interact with an external disk during cleaning, the IO load of the system can be reduced during multiplexing of the memory resource, and the performance of the system is improved.
Before this step, referring to fig. 2, the terminal reserves memory resources for the cleanable file, and the process of reserving memory resources is implemented by the following steps (1) - (3), including:
(1) the terminal divides the reserved memory resources from the total memory resources of the system.
The reserved memory resource is an available memory resource with a file cleaning function. In some embodiments, the reserved memory resource is a memory resource composed of a plurality of discontinuous memory resources. In this implementation manner, the reserved memory resource is formed by a plurality of discontinuous memory resources, so that the memory resource that can be used is guaranteed to be reserved for the file cleaning function. In some embodiments, the reserved memory resources are contiguous memory resources. The memory resource reservation process is as follows: the terminal determines continuous memory resources in the total memory resources of the system; and allocating continuous memory resources to the function of clearing the file. In the implementation mode, the reserved memory resources are determined as continuous memory resources, and the reserved memory resources can meet the condition that a UI process occupies a large amount of memory resources.
Referring to fig. 3, in this step, the terminal divides the memory resources for the UI process from the total memory resources of the system. The terminal determines whether the reserved memory resources are successfully stored, and if the reserved memory resources are successfully stored, the following step (2) is executed; if the reservation is not successful, the terminal starts the memory management system and divides the reserved memory resources again.
It should be noted that the size of the reserved memory resource is set according to needs, and in the embodiment of the present application, the size of the reserved memory resource is not specifically limited.
(2) And the terminal determines the function identifier of the file cleaning function.
With continued reference to fig. 3, in this step, the terminal determines a function identifier for identifying whether the file cleaning function is started or not when the function is started. For example, the function identification is Init _ clean _ cache.
(3) And the terminal binds the function identifier of the file cleaning function with the reserved memory resource.
In this step, with continued reference to fig. 3, the terminal assigns the source stream memory resource to the target function identifier. For example, the reserved memory is assigned to Init _ clean _ cache.
In this implementation manner, the reserved memory resource is determined as the memory resource occupied by the cleanable file in the file cleaning function by binding the reserved memory resource with the file cleaning function, so that the memory resource is used as a multiplexing memory resource with the UI process, thereby reducing the problem that the UI process cannot be normally performed due to insufficient memory allocation or allocation failure of the UI process.
Step 102: and the terminal determines the memory resource available for the file cleaning function as the multiplexing memory resource of the UI process of the user interaction interface.
In this step, the terminal allocates the memory resource available for the file cleaning function as the reserved memory resource of the UI process. The process is as follows: and the terminal sets the starting identifier of the file cleaning function as a UI process. Namely, when the terminal detects that the UI process needs to be executed, the file cleaning function is automatically started, so that the UI process can use the available memory resources of the file cleaning function.
Step 103: and responding to the received instruction for allocating the memory resource for any UI process, and allocating the memory resource for any UI process by the terminal based on the multiplexing memory resource.
And responding to the received instruction for allocating the memory resource for any UI process, starting a file cleaning function by the terminal, and starting the multiplexing memory resource of the file cleaning function and the UI process.
In this step, referring to fig. 4, when the terminal receives an instruction to allocate a memory resource to a process, it determines whether the process is a UI process, and if the process is a non-UI process, the terminal allocates a memory resource to the process in an idle memory resource of the system. At this time, when the free memory resources in the system are insufficient, the terminal can release the occupied memory resources and recycle part of the memory resources to ensure that the process can continue. If the process is a UI process, the terminal performs step 103.
The process that the terminal allocates the memory resource for any UI process based on the multiplexing memory resource is realized through the following steps (1) to (2), and comprises the following steps:
(1) the terminal determines a first free memory resource from the multiplexing memory resources.
The first free memory resource is a memory resource except a memory resource occupied by the cleanable file and other UI processes in the multiplexing memory resource. In this step, the terminal determines the memory resource occupied by the cleanable file and the memory resource occupied by the other UI process having the file cleaning function in the multiplexed memory resource, and determines the memory resource other than the memory resource occupied by the cleanable file and the memory resource occupied by the other UI process in the multiplexed memory resource as the first free memory resource.
(2) And if the first idle memory resource is not less than the target memory resource, the terminal allocates the memory resource for any UI process in the first idle memory resource.
The target memory resource is a memory resource required by any UI process. In this step, the terminal predicts a memory resource required when executing the UI process, and determines the memory resource as a target memory resource. And if the first idle memory resource is not less than the target memory resource, the terminal allocates the memory resource for any UI process from the first idle memory resource.
In this implementation manner, after receiving an instruction for allocating resources to any UI process, the terminal starts a file cleaning function, and further starts a memory resource of the file cleaning function, and uses the memory resource as a multiplexing memory resource, so that when a first free memory resource of the multiplexing memory resource is sufficient to meet a target memory resource of any UI process, the memory resource is allocated to the any UI process from the first free memory resource, thereby preventing a low execution speed of the UI process due to insufficient memory resources of the UI process, further preventing page jamming, and improving page smoothness.
In addition, if the first free memory resource is insufficient, the terminal returns to the system memory resource management, and allocates the memory resource for any UI process from the memory resource of the system. The process is as follows: and if the first idle memory resource is less than the target memory resource, the terminal allocates memory resources for any UI process based on a fourth idle memory resource of the system.
The fourth free memory resource is an available memory resource which is not occupied currently in the memory resources of the system. And if the fourth free memory resource is not less than the target memory resource, the terminal allocates the memory resource for any UI process in the fourth free memory resource of the system. If the fourth free memory resource is less than the target memory resource, the terminal releases the memory resource occupied in the system; and allocating memory resources for any UI process in second idle memory resources of the system, wherein the second idle memory resources at least comprise the memory resources released by the system.
The second free memory resource further includes a fourth free memory resource. The process of allocating the memory resource for any UI process in the second idle memory resource of the system by the terminal is similar to the process of allocating the memory resource for any UI process in the first idle memory resource by the terminal, and is not described herein again.
The process of releasing the memory resources occupied in the system by the terminal is as follows: and the terminal determines the process of the memory resource to be recovered, stores the process to an external disk and releases the memory resource occupied by the process.
In a possible embodiment, the terminal recovers the memory resource occupied by the terminal according to the ULR linked list. In a possible implementation manner, the terminal recovers the memory resources occupied by the processes according to the priorities of the processes occupying the memory resources. The priority of the process is determined based on at least one of the attributes of the memory resource occupied by the process, the time length required by the process execution, the recoverability of the process and the like.
In the implementation manner, if the available memory resources in the multiplexed memory resources do not satisfy the resources required for executing the UI process, the terminal continues to allocate resources to the UI process from the memory resources of the system, thereby ensuring that the UI process can be allocated with the available memory resources, ensuring that the UI process executes normally, and ensuring the fluency of the page.
If the first free memory resource is insufficient, the terminal can also release the memory resource in the multiplexing memory resource, and allocate the memory resource for any UI process according to the released memory resource in the multiplexing memory resource. The process may be: if the first free memory resource is less than the target memory resource, the terminal releases the resource occupied by the file cleaning function in the multiplexing memory resource; and allocating memory resources for any UI process in third idle memory resources in the multiplexing memory resources, wherein the third idle memory resources at least comprise the memory resources released by the file cleaning function.
The process that the terminal releases the memory resource occupied by the cleanable file in the multiplexing memory resource comprises the following steps: and the terminal deletes the cleanable files in the multiplexing memory resources. In the implementation mode, the terminal does not need to interact the multiplexing memory resource with an external disk, and the IO performance of the system is improved.
Or the terminal stores the cleanable files in the multiplexing memory resources into an external disk and deletes the cleanable files in the multiplexing memory resources. In the implementation mode, the terminal stores the cleanable file into the external disk, so that the cleanable file cannot be acquired when being called again.
It should be noted that the process of the terminal recovering the memory resource in the multiplexing memory resource is similar to the process of the terminal recovering the memory resource of the system, and is not described herein again.
Another point to be described is that before the terminal releases the resources of the multiplexed memory resources, it may be determined whether the free memory resources in the multiplexed memory resources are not less than the target memory resources after the memory resources are recovered, and if not less than the target memory resources, the terminal executes the process of releasing the memory resources already occupied in the multiplexed memory resources; and if the number of the UI processes is less than the preset threshold, executing a process of allocating memory resources for any UI process from the memory resources of the system.
Correspondingly, if the first free memory resource is less than the target memory resource, the terminal releases the multiplexing memory resource first, and if the free memory resource after the release of the multiplexing memory resource is not less than the target memory resource, the terminal continues to allocate the memory resource for any UI process from the multiplexing memory resource; and if the idle memory resource after the release of the multiplexing memory resource is less than the target memory resource, allocating the memory resource for any UI process from the memory resource of the system.
In the embodiment of the application, after an instruction for allocating memory resources to any UI process is received, a file cleaning function is started, and then the memory resources of the file cleaning function are started, and the memory resources are used as multiplexing memory resources, so that when the first free memory resources of the multiplexing memory resources are enough to meet the target memory resources of any UI process, the memory resources are allocated to any UI process from the first free memory resources, and therefore, the low execution speed of the UI process caused by insufficient memory resources of the UI process is prevented, page jamming is prevented, and page fluency is improved.
Fig. 5 is a flowchart illustrating a memory resource allocation method according to an exemplary embodiment of the present application. The execution main body in the embodiment of the present application may be a terminal, or may also be a processor in the terminal or an operating system in the terminal, and the embodiment takes the execution main body as the terminal for example. In this embodiment, with reference to fig. 4, when the terminal receives an instruction to allocate a memory resource to any UI process, it first allocates a memory resource to the UI process from the idle memory resources of the system. If the free memory resources of the system are not enough to execute the UI process, the memory resources are allocated to the UI process from the multiplexing resources.
The method comprises the following steps:
step 501: and the terminal determines the available memory resources of the file cleaning function.
This step is similar to step 101 and will not be described herein again.
Step 502: and the terminal determines the memory resource available for the file cleaning function as the multiplexing memory resource of the UI process of the user interaction interface.
This step is similar to step 102 and will not be described herein again.
Step 503: and the terminal determines a second idle memory resource from the memory resources of the system.
The second free memory resource is a current free memory resource in the memory resources of the system.
It should be noted that, at this time, the occupied memory resource in the system is a memory resource that cannot be recycled.
The terminal determines whether the second free memory resource is less than the target memory resource. If less than step 504 is performed; and if the second idle memory resource is not less than the target memory resource, allocating the memory resource for any UI process in the second idle memory resource.
In this implementation manner, the terminal allocates the memory resource for the UI process from the memory resource of the system first, so as to avoid the system having redundant idle memory resources, and when the multiplexing memory resource is used, the file data stored in the multiplexing memory resource may be deleted, which may cause the terminal to call from the external disk again when acquiring the file data again, thereby preventing the memory resource from being wasted, and further improving the IO performance of the terminal system.
Step 504: and if the second free memory resource is less than the target memory resource, allocating the memory resource for any UI process based on the multiplexing memory resource.
The target memory resource is a memory resource required by any UI process.
This step is similar to step 103 and will not be described herein.
It should be noted that, with reference to fig. 4, in the present implementation manner, if the free memory resource released from the multiplexing memory resource is still not less than the target memory resource, the memory resource in the system may be released directly, and it is not necessary to determine whether the free memory resource in the system is less than the target memory resource.
In the embodiment of the application, after an instruction for allocating memory resources to any UI process is received, a file cleaning function is started, and then the memory resources of the file cleaning function are started, and the memory resources are used as multiplexing memory resources, so that when the first free memory resources of the multiplexing memory resources are enough to meet the target memory resources of any UI process, the memory resources are allocated to any UI process from the first free memory resources, and therefore, the low execution speed of the UI process caused by insufficient memory resources of the UI process is prevented, page jamming is prevented, and page fluency is improved.
In some embodiments, before allocating the memory resource to the UI process, the terminal further detects whether the multiplexed memory resource is available, and executes the process of allocating the memory resource to the UI process only when the multiplexed memory resource is available. Referring to fig. 6, fig. 6 is a flowchart illustrating a memory resource allocation method according to an exemplary embodiment of the present application. The execution main body in the embodiment of the present application may be a terminal, or may also be a processor in the terminal or an operating system in the terminal, and the embodiment takes the execution main body as the terminal for example. The method comprises the following steps:
step 601: and the terminal determines the available memory resources of the file cleaning function.
This step is similar to step 101 and will not be described herein again.
Step 602: and the terminal determines the memory resource available for the file cleaning function as the multiplexing memory resource of the UI process of the user interaction interface.
This step is similar to step 102 and will not be described herein again.
Step 603: and the terminal determines the resource occupation proportion in the multiplexing memory resource.
The resource occupation ratio is the ratio of the memory resources occupied by other UI processes in the multiplexing memory resources.
In this step, the terminal counts the memory resources occupied by other UI processes in the multiplexed memory resources, and determines the proportion of the memory resources to the multiplexed memory resources. The terminal compares the resource occupation ratio with a first preset ratio, if the resource occupation ratio does not exceed the first preset ratio, the terminal determines that the current multiplexing memory resource is a multiplexing memory resource, and executes step 704; if the resource occupation ratio exceeds a first preset ratio, setting the multiplexing memory resource as an unavailable memory resource; and allocating target resources for the UI process from the memory resources of the system.
The first preset ratio is set as required, and is not particularly limited in the embodiment of the present application. For example, the first predetermined ratio is 3/4 or 4/5.
In addition, after setting the multiplexing memory resource as the unavailable resource, the terminal can determine the resource occupation ratio again when receiving the instruction for allocating the memory resource for the UI process again, and if the resource occupation ratio does not exceed a second preset ratio, the terminal sets the multiplexing memory resource as the available resource again.
The second preset ratio is set as required, for example, the second preset ratio is 1/2.
In the implementation mode, whether the multiplexing memory resource is stopped is determined according to the resource occupation ratio of the UI process in the multiplexing memory resource, so that the phenomenon that the UI process uses up the memory resource in the multiplexing memory resource to cause that the file with the file cleaning function cannot be stored is prevented.
Step 604: and if the resource occupation proportion does not exceed the preset proportion, the terminal allocates the memory resource for any UI process based on the multiplexing memory resource.
This step is similar to step 103 and will not be described herein.
In the embodiment of the application, after an instruction for allocating memory resources to any UI process is received, a file cleaning function is started, and then the memory resources of the file cleaning function are started, and the memory resources are used as multiplexing memory resources, so that when the first free memory resources of the multiplexing memory resources are enough to meet the target memory resources of any UI process, the memory resources are allocated to any UI process from the first free memory resources, and therefore, the low execution speed of the UI process caused by insufficient memory resources of the UI process is prevented, page jamming is prevented, and page fluency is improved.
Referring to fig. 7, a block diagram of a memory resource allocation apparatus according to an embodiment of the present application is shown. The memory resource allocation means may be implemented as all or part of the processor in software, hardware or a combination of both. The device includes:
a first determining module 701, configured to determine an available memory resource for a file cleaning function;
a second determining module 702, configured to determine, as a multiplexing memory resource of a UI process of the user interaction interface, a memory resource available for the file cleaning function;
the resource allocation module 703 is configured to, in response to receiving an instruction to allocate a memory resource to any UI process, allocate a memory resource to the any UI process based on the multiplexed memory resource.
In some embodiments, the resource allocation module 703 includes:
a first determining unit, configured to determine a first free memory resource from the multiplexing memory resource;
a first resource allocation unit, configured to allocate a memory resource to the any UI process in the first idle memory resource if the first idle memory resource is not less than a target memory resource, where the target memory resource is a memory resource required by the any UI process.
In some embodiments, the apparatus further comprises:
a first releasing module, configured to release the occupied memory resource in the system if the first idle memory resource is less than the target memory resource;
the resource allocation module 703 is further configured to allocate a memory resource to the UI process in a second idle memory resource of the system, where the second idle memory resource at least includes a memory resource released by the system.
In some embodiments, the apparatus further comprises:
a second releasing module, configured to release the memory resource occupied by the file cleaning function in the multiplexed memory resource if the first free memory resource is less than the target memory resource;
the resource allocation module 703 is further configured to allocate a memory resource to the UI process in a third idle memory resource in the multiplexed memory resource, where the third idle memory resource at least includes a memory resource released by the file cleaning function.
In some embodiments, the apparatus further comprises:
a third determining module, configured to determine a second idle memory resource from the memory resources of the system;
the resource allocation module 703 is further configured to allocate a memory resource to the any UI process based on the multiplexing memory resource if the second free memory resource is less than a target memory resource, where the target memory resource is a memory resource required by the any UI process.
In some embodiments, the apparatus further comprises:
the resource allocation module 703 is further configured to allocate a memory resource to the any UI process in the second idle memory resource if the second idle memory resource is not less than the target memory resource.
In some embodiments, the resource allocation module 703 includes:
a second determining unit, configured to determine a resource occupation ratio in the multiplexed memory resource, where the resource occupation ratio is a ratio of memory resources occupied by other UI processes in the multiplexed memory resource;
and the second resource allocation unit is further configured to allocate a memory resource to the any UI process in the multiplexed memory resource if the resource occupation ratio does not exceed a preset ratio.
In some embodiments, the apparatus further comprises:
a setting module, configured to set the multiplexing memory resource as an unavailable resource if the resource occupation ratio exceeds the preset ratio;
the resource allocation module 703 is further configured to allocate a memory resource to the UI process in a memory resource of the system.
In some embodiments, the apparatus further comprises:
a fourth determining module, configured to determine a continuous memory resource from the total memory resources of the system;
and a fifth determining module, configured to allocate the continuous memory resource to the file cleaning function.
In the embodiment of the application, after an instruction for allocating memory resources to any UI process is received, a file cleaning function is started, and then the memory resources of the file cleaning function are started, and the memory resources are used as multiplexing memory resources, so that when the first free memory resources of the multiplexing memory resources are enough to meet the target memory resources of any UI process, the memory resources are allocated to any UI process from the first free memory resources, and therefore, the low execution speed of the UI process caused by insufficient memory resources of the UI process is prevented, page jamming is prevented, and page fluency is improved.
Referring to fig. 8, a block diagram of a terminal 800 according to an exemplary embodiment of the present application is shown. The terminal 800 may be a terminal having a communication function, such as a smart phone, a tablet computer, and a wearable device. The terminal 800 in the present application may include one or more of the following components: a processor 810, a memory 820, and a UI interaction module 830.
Processor 810 includes one or more processing cores. The processor 810, which is connected to various parts throughout the terminal 800 using various interfaces and lines, performs various functions of the terminal 800 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 820 and calling data stored in the memory 820. Alternatively, the processor 810 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 810 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Neural-Network Processing Unit (NPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing the content required to be displayed by the display screen; the NPU is used for realizing an Artificial Intelligence (AI) function; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 810, but may be implemented by a single chip.
The Memory 820 may include a Random Access Memory (RAM) or a Read-Only Memory (ROM). Optionally, the memory 820 includes a non-transitory computer-readable medium. The memory 820 may be used to store instructions, programs, code sets, or instruction sets. The memory 820 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like; the storage data area may store data (such as audio data, a phonebook) created according to the use of the terminal 800, and the like.
The UI interaction module 830 is configured to generate a UI interaction process, so as to implement a function of interacting with a user through the terminal 600. For example, a click operation of a user in the terminal 600 is received, the page display content corresponding to the click operation is determined through the UI interaction module 830, and the page display content is displayed.
A display screen is a display component for displaying a user interface. Optionally, the display screen is a display screen with a touch function, and through the touch function, a user may use any suitable object such as a finger or a touch pen to perform a touch operation on the display screen.
The display is usually provided on the front panel of the terminal. The display screen may be designed as a full-face screen, curved screen, odd-shaped screen, double-face screen, or folding screen. The display screen may also be designed as a combination of a full screen and a curved screen, a combination of a special screen and a curved screen, and the like, which is not limited in this embodiment.
In addition, those skilled in the art will appreciate that the configuration of terminal 800 illustrated in the above-described figures is not meant to be limiting with respect to terminal 800, and that terminal 800 may include more or less components than those illustrated, or some components may be combined, or a different arrangement of components. For example, the terminal 800 further includes a microphone, a speaker, a radio frequency circuit, an input unit, a sensor, an audio circuit, a Wireless Fidelity (Wi-Fi) module, a power supply, a bluetooth module, and other components, which are not described herein again.
The present invention also provides a computer-readable medium, where at least one program code is stored, and the at least one program code is loaded and executed by the processor to implement the memory resource allocation method shown in the above embodiments.
The embodiment of the present application further provides a computer program product, where the computer program product stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the memory resource allocation method shown in the above embodiments.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in the embodiments of the present application may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (12)

1. A method for allocating memory resources, the method comprising:
determining available memory resources for a file cleaning function;
determining the memory resource available for the file cleaning function as a multiplexing memory resource of a user interaction interface (UI) process;
and responding to a received instruction for allocating memory resources for any UI process, and allocating the memory resources for any UI process based on the multiplexing memory resources.
2. The method according to claim 1, wherein said allocating memory resources for said any UI process based on said multiplexed memory resources comprises:
determining a first free memory resource from the multiplexing memory resources;
and if the first idle memory resource is not less than a target memory resource, allocating a memory resource for any UI process in the first idle memory resource, wherein the target memory resource is a memory resource required by any UI process.
3. The method of claim 2, further comprising:
if the first free memory resource is less than the target memory resource, releasing the memory resource occupied in the system;
allocating memory resources for any UI process in second idle memory resources of the system, wherein the second idle memory resources at least comprise the memory resources released by the system.
4. The method of claim 2, further comprising:
if the first free memory resource is less than the target memory resource, releasing the memory resource occupied by the file cleaning function in the multiplexing memory resource;
allocating memory resources to any UI process in a third free memory resource in the multiplexing memory resources, wherein the third free memory resource at least comprises the memory resources released by the file cleaning function.
5. The method according to claim 1, wherein before allocating memory resources for the UI process based on the multiplexed memory resources, the method further comprises:
determining a second free memory resource from the memory resources of the system;
and if the second free memory resource is less than a target memory resource, executing the step of allocating memory resources for any UI process based on the multiplexing memory resource, wherein the target memory resource is the memory resource required by any UI process.
6. The method of claim 5, further comprising:
and if the second idle memory resource is not less than the target memory resource, allocating memory resources for any UI process in the second idle memory resource.
7. The method according to claim 1, wherein said allocating memory resources for said any UI process based on said multiplexed memory resources comprises:
determining the resource occupation proportion in the multiplexing memory resource, wherein the resource occupation proportion is the proportion of the memory resource occupied by other UI processes in the multiplexing memory resource;
and if the resource occupation proportion does not exceed a preset proportion, allocating memory resources for any UI process in the multiplexing memory resources.
8. The method of claim 7, further comprising:
if the resource occupation ratio exceeds the preset ratio, setting the multiplexing memory resource as an unavailable resource;
and allocating memory resources for any UI process in the memory resources of the system.
9. The method of claim 1, further comprising:
determining continuous memory resources in the total memory resources of the system;
and allocating the continuous memory resources to the file cleaning function.
10. An apparatus for allocating memory resources, the apparatus comprising:
the first determining module is used for determining available memory resources of the file cleaning function;
the second determining module is used for determining the memory resource available for the file cleaning function as a multiplexing memory resource of a user interaction interface (UI) process;
and the resource allocation module is used for responding to a received instruction for allocating the memory resource for any UI process and allocating the memory resource for any UI process based on the multiplexing memory resource.
11. A terminal, characterized in that the terminal comprises a processor and a memory; the memory stores at least one program code for execution by the processor to implement the memory resource allocation method of any of claims 1 to 9.
12. A computer-readable storage medium having stored thereon at least one program code for execution by a processor to implement the memory resource allocation method of any one of claims 1 to 9.
CN202110336568.0A 2021-03-29 2021-03-29 Memory resource allocation method, device, terminal and storage medium Pending CN113076194A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110336568.0A CN113076194A (en) 2021-03-29 2021-03-29 Memory resource allocation method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110336568.0A CN113076194A (en) 2021-03-29 2021-03-29 Memory resource allocation method, device, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN113076194A true CN113076194A (en) 2021-07-06

Family

ID=76611264

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110336568.0A Pending CN113076194A (en) 2021-03-29 2021-03-29 Memory resource allocation method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN113076194A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103425592A (en) * 2013-08-05 2013-12-04 大唐移动通信设备有限公司 Memory management method and device for multiprocess system
US20150052326A1 (en) * 2013-08-19 2015-02-19 International Business Machines Corporation User-controlled paging
CN110134655A (en) * 2019-04-30 2019-08-16 华为技术有限公司 A kind of method for managing resource, device and equipment
CN110895492A (en) * 2019-12-11 2020-03-20 Oppo(重庆)智能科技有限公司 Device control method, device, storage medium and electronic device
CN111158910A (en) * 2019-12-27 2020-05-15 Oppo广东移动通信有限公司 Memory management method and device, storage medium and electronic equipment
CN111475299A (en) * 2020-04-03 2020-07-31 Oppo广东移动通信有限公司 Memory allocation method and device, storage medium and electronic equipment
CN111831433A (en) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 Resource allocation method, device, storage medium and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103425592A (en) * 2013-08-05 2013-12-04 大唐移动通信设备有限公司 Memory management method and device for multiprocess system
US20150052326A1 (en) * 2013-08-19 2015-02-19 International Business Machines Corporation User-controlled paging
CN110134655A (en) * 2019-04-30 2019-08-16 华为技术有限公司 A kind of method for managing resource, device and equipment
CN110895492A (en) * 2019-12-11 2020-03-20 Oppo(重庆)智能科技有限公司 Device control method, device, storage medium and electronic device
CN111158910A (en) * 2019-12-27 2020-05-15 Oppo广东移动通信有限公司 Memory management method and device, storage medium and electronic equipment
CN111475299A (en) * 2020-04-03 2020-07-31 Oppo广东移动通信有限公司 Memory allocation method and device, storage medium and electronic equipment
CN111831433A (en) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 Resource allocation method, device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
US11531625B2 (en) Memory management method and apparatus
CN110764906B (en) Memory recovery processing method and device, electronic equipment and storage medium
CN110895492B (en) Device control method, device, storage medium and electronic device
CN114096953A (en) Memory management method and device, electronic equipment and computer readable medium
CN111158910A (en) Memory management method and device, storage medium and electronic equipment
CN105874428B (en) Technology for the operating system transformation in multiple operating system environments
EP2750042B1 (en) Method and apparatus for managing memory
CN114185494B (en) Memory anonymous page processing method, electronic device and readable storage medium
CN111078586B (en) Memory recovery method and device, storage medium and electronic equipment
CN114174987A (en) Application program management method and device, electronic equipment and storage medium
CN115421909A (en) Memory management method and device, electronic equipment and storage medium
CN111475299B (en) Memory allocation method and device, storage medium and electronic equipment
CN114237381A (en) Application processing method and device
CN113076194A (en) Memory resource allocation method, device, terminal and storage medium
CN112114965A (en) Application program running method and device, terminal and storage medium
CN115587049A (en) Memory recovery method and device, electronic equipment and storage medium
WO2019128542A1 (en) Application processing method, electronic device, computer readable storage medium
CN111078405B (en) Memory allocation method and device, storage medium and electronic equipment
CN114218126A (en) Memory recovery method and device
CN111628895B (en) Configuration data synchronization method, device, equipment and readable storage medium
CN112052089B (en) Memory recovery method and device and electronic equipment
CN113934692A (en) File cleaning method and device, storage medium and equipment
CN111090627A (en) Log storage method and device based on pooling, computer equipment and storage medium
CN111414254A (en) Device management method, device, storage medium and electronic device
CN116049025B (en) Method for dynamically adjusting memory reclamation GC parameters, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination