US-12619467-B2 - Electronic device managing memory and operation method therefor
Abstract
An electronic device is provided. The electronic device includes a memory and a processor. The processor may be configured to identify that an application using large-capacity memory satisfying a specified condition is running, identify a first memory capacity required to run the application, and terminate at least one process allocated to the memory until the first memory capacity is secured as the available capacity of the memory.
Inventors
- Jiman KWON
- Dongho Kim
- Hakryoul KIM
- Jaehyeon Park
- Geonhee BACK
- Jiseop SONG
- Dongwook Lee
Assignees
- SAMSUNG ELECTRONICS CO., LTD.
Dates
- Publication Date
- 20260505
- Application Date
- 20230612
- Priority Date
- 20210112
Claims (18)
- 1 . An electronic device, comprising: memory, storing instructions, including volatile memory; and at least one processor communicatively coupled to the memory, wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to: identify execution of an application that has a volatile memory capacity usage for execution that meets a designated condition, identify a first volatile memory capacity to use to execute the application, terminate at least one process allocated to the volatile memory until as much available capacity of the volatile memory as the first volatile memory capacity is obtained, and allocate a process of the application to the volatile memory, based on the available capacity of the volatile memory obtained by the terminating of the at least one process, and wherein the terminating of the at least one process allocated to the volatile memory is started at a time, which is in a period that begins upon the identifying of the execution of the application and ends before the allocation of the process of the application to the volatile memory is requested.
- 2 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, further cause the electronic device to: upon identifying that the available capacity of the volatile memory for allocating the process of the application to the volatile memory is insufficient, execute a first memory recovery operation for recovering partial data of at least one process allocated to the volatile memory to increase the available capacity of the volatile memory, identify the available capacity of the volatile memory based on a first memory shortage event occurring due to the first memory recovery operation, in response to a value of the identified available capacity being a designated threshold or less, identify a level of the first memory shortage event, and wait for a designated delay time after terminating a process selected based on the level of the first memory shortage event among the at least one process allocated to the volatile memory, and terminate a next process selected based on a level of a second memory shortage event occurring due to the first memory recovery operation.
- 3 . The electronic device of claim 2 , wherein the designated delay time is shorter than a delay time designated when an application, other than the application that has the volatile memory capacity usage for execution that meets the designated condition, is executed.
- 4 . The electronic device of claim 3 , wherein the instructions, when executed by the at least one processor is individually or collectively, further cause the electronic device to: terminate the selected process based on the level of the first memory shortage event without identifying a swap usage (swapused) value.
- 5 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, further cause the electronic device to: obtain a first memory value including memory values related to an Android kernel stored when the application is previously executed, based on the execution of the application, and store a second memory value including memory values related to the Android kernel upon termination of the application and a process size value of the application based on termination of the application.
- 6 . The electronic device of claim 5 , wherein the instructions, when executed by the at least one processor individually or collectively, further cause the electronic device to: identify the first volatile memory capacity based on the first memory value, the second memory value, a current available capacity of the volatile memory, a current Android kernel-related memory value, and the process size value of the application.
- 7 . The electronic device of claim 6 , wherein the instructions, when executed by the at least one processor individually or collectively, further cause the electronic device to: determine the first volatile memory capacity by multiplying a total size of the volatile memory by a designated multiple in response to the second memory value not being stored.
- 8 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, further cause the electronic device to: in response to execution of any one application, among a plurality of applications stored in the memory, being requested, identify whether the any one application is the application that has the volatile memory capacity usage for execution that meets the designated condition.
- 9 . The electronic device of claim 8 , wherein the application that has the volatile memory capacity usage for execution that meets the designated condition includes at least one of: an application using a camera included in the electronic device, an application that uses a greater capacity of the volatile memory during execution than a designated capacity, or a designated application.
- 10 . A method performed by an electronic device including volatile memory, the method comprising: identifying execution of an application that has a volatile memory capacity usage for execution that meets a designated condition; identifying a first volatile memory capacity to use to execute the application based on execution of the application; terminating at least one process allocated to the volatile memory until as much available capacity of the volatile memory as the first volatile memory capacity is obtained; and allocating a process of the application to the volatile memory, based on the available capacity of the volatile memory obtained by the terminating of the at least one process, wherein the terminating of the at least one process allocated to the volatile memory is started at a time, which is in a period that begins upon the identifying of the execution of the application and ends before the allocation of the process of the application to the volatile memory is requested.
- 11 . The method of claim 10 , further comprising: upon identifying that the available capacity of the volatile memory for allocating the process of the application to the volatile memory is insufficient, executing a first memory recovery operation for recovering partial data of at least one process allocated to the volatile memory to increase the available capacity of the volatile memory; identifying the available capacity of the volatile memory based on a first memory shortage event occurring due to the first memory recovery operation; in response to a value of the identified available capacity being a designated threshold or less, identifying a level of the first memory shortage event; and waiting for a designated delay time after terminating a process selected based on the level of the first memory shortage event among the at least one process allocated to the volatile memory, and terminating a next process selected based on a level of a second memory shortage event occurring due to the first memory recovery operation.
- 12 . The method of claim 11 , wherein the designated delay time is shorter than a delay time designated when an application, other than the application that has the volatile memory capacity usage for execution that meets the designated condition, is executed.
- 13 . The method of claim 12 , wherein the terminating of the selected process includes: terminating the selected process based on the level of the first memory shortage event without identifying a swap usage (swapused) value.
- 14 . The method of claim 10 , further comprising: obtaining a first memory value including memory values related to an Android kernel stored when the application is previously executed, based on the execution of the application; and storing a second memory value including memory values related to the Android kernel upon termination of the application and a process size value of the application based on termination of the application.
- 15 . The method of claim 14 , wherein the identifying of the first volatile memory capacity includes: identifying the first volatile memory capacity based on the first memory value, the second memory value, a current available capacity of the volatile memory, a current Android kernel-related memory value, and the process size value of the application.
- 16 . The method of claim 15 , further comprising: determining the first volatile memory capacity by multiplying a total size of the volatile memory by a designated multiple in response to the second memory value not being stored.
- 17 . The method of claim 10 , further comprising: in response to execution of any one application, among a plurality of applications, being requested, identifying whether the any one application is the application that has the volatile memory capacity usage for execution that meets the designated condition.
- 18 . One or more non-transitory computer-readable storage media storing instructions that, when executed individually or collectively by at least one processor of an electronic device, cause the electronic device to perform operations, the operations comprising: identifying execution of an application that has a volatile memory capacity usage for execution that meets a designated condition; identifying a first volatile memory capacity to use to execute the application based on execution of the application; terminating at least one process allocated to a volatile memory of the electronic device until as much available capacity of the volatile memory as the first volatile memory capacity is obtained; and allocating a process of the application to the volatile memory, based on the available capacity of the volatile memory obtained by the terminating of the at least one process, wherein the terminating of the at least one process allocated to the volatile memory is started at a time, which is in a period that begins upon the identifying of the execution of the application and ends before the allocation of the process of the application to the volatile memory is requested.
Description
CROSS-REFERENCE TO RELATED APPLICATION(S) This application is a continuation application, claiming priority under § 365(c), of an International application No. PCT/KR2021/019415, filed on Dec. 20, 2021, which is based on and claims the benefit of a Korean patent application number 10-2021-0004261, filed on Jan. 12, 2021, in the Korean Intellectual Property Office, the disclosure of which is incorporated by reference herein in its entirety. BACKGROUND 1. Field The disclosures relate to an electronic device managing a memory and an operation method thereof. 2. Description of Related Art An electronic device may be configured in two aspects of hardware and software. In the hardware aspect, the electronic device may include a central processing unit (CPU) or system on a chip (SOC) for calculating and processing a process and a memory where data for the process is loaded. In the software aspect, the electronic device may include an operating system (or kernel) for performing basic management of the system and applications that run on the operating system to execute the processes. For example, the CPU loads the data corresponding to the operating system and executes it, and loads an application on the memory while the operating system is running to execute the application on the operating system. The process is finally performed by the execution of the application. Recently, as the electronic device provides various services, various applications may be included and, as several applications are simultaneously executed, the management of the memory where the applications are loaded and executed becomes important. The above information is presented as background information only to assist with an understanding of the disclosure. No determination has been made, and no assertion is made, as to whether any of the above might be applicable as prior art with regard to the disclosure. SUMMARY Due to limited memory (random access memory (RAM)) capacity, electronic devices using the Android operating system need to cope with the much demand for the memory by monitoring the memory status and terminating minimum essential processes to maintain system performance at an acceptable level. Accordingly, the electronic device may perform a memory securing operation (Kswapd, Direct Reclaim), low memory killer (LMK), low memory killer daemon (LMKD), and the like to monitor the memory status and prevent system performance degradation due to heavy use of the memory. However, the memory securing operation may not quickly escape from the memory shortage situation if an application requiring much memory in a short time is executed. Recently, as applications requiring memory in a short time increase, electronic devices using the Android operating system need to quickly preempt available memory capacity not to fall into memory shortage. Aspects of the disclosure are to address at least the above-mentioned problems and/or disadvantages and to provide at least the advantages described below. Accordingly, an aspect of the disclosure is to provide an electronic device and an operation method thereof, which may quickly handle a reduction in available memory due to execution of an application requiring large-capacity memory by adding and changing the LMKD memory securing operation if the application is executed. Additional aspects will be set forth in part in the description which follows and, in part, will be apparent from the description, or may be learned by practice of the presented embodiments. In accordance with an aspect of the disclosure, an electronic device is provided. The electronic device includes a memory and a processor configured to identify execution of an application using a large-capacity memory meeting a designated condition, identify a first memory capacity necessary to execute the application, and terminate at least one process allocated to the memory until as much available capacity of the memory as the first memory capacity is obtained. In accordance with another aspect of the disclosure, a method for operating an electronic device is provided. The method includes identifying execution of an application using a large-capacity memory meeting a designated condition, identifying a first memory capacity necessary to execute the application based on execution of the application, and terminating at least one process allocated to the memory until as much available capacity of the memory as the first memory capacity is obtained. In accordance with another aspect of the disclosure, a non-transitory storage medium may comprise a program including executable instructions that, when executed by a processor, allow the processor to identify execution of an application using a large-capacity memory meeting a designated condition, identify a first memory capacity necessary to execute the application based on execution of the application, and terminate at least one process allocated to the memory until as much available capacity of the me