CN115437783A - Searching and killing method, electronic equipment and readable storage medium - Google Patents

Searching and killing method, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN115437783A
CN115437783A CN202210986404.7A CN202210986404A CN115437783A CN 115437783 A CN115437783 A CN 115437783A CN 202210986404 A CN202210986404 A CN 202210986404A CN 115437783 A CN115437783 A CN 115437783A
Authority
CN
China
Prior art keywords
memory
application
size
threshold
killing
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.)
Granted
Application number
CN202210986404.7A
Other languages
Chinese (zh)
Other versions
CN115437783B (en
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.)
Honor Device Co Ltd
Original Assignee
Honor Device Co 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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202210986404.7A priority Critical patent/CN115437783B/en
Publication of CN115437783A publication Critical patent/CN115437783A/en
Application granted granted Critical
Publication of CN115437783B publication Critical patent/CN115437783B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a searching and killing method, electronic equipment and a readable storage medium, and relates to the technical field of equipment systems; the method can obtain the required size of the memory at the next starting by learning the occupied size of the memory at the historical starting of the same application, so that the required size of the memory is used as a searching and killing basis at the next starting; in addition, different killing waterlines can be set at different stages when the application is started, for example, a higher killing waterline is selected before the top Activity is started, and a lower killing waterline is selected after the top Activity is started; therefore, the background process is killed through the higher checking and killing waterline, so that the residual memory space is larger in the application starting process, and the application starting speed is increased.

Description

Searching and killing method, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of device systems, and in particular, to a searching and killing method, an electronic device, and a readable storage medium.
Background
With the increasing functions of electronic devices, the memory space required by an application program running in the electronic device is increasing, and meanwhile, in order to quickly open the application program, when a user finishes using the application program, the application program can be returned to the background running, and the application program running in the background also occupies the memory space.
At present, a killing waterline can be set, and under the condition that the residual space of the memory is less than or equal to the killing waterline, the application program running in a background is killed. However, when an application is newly launched, a large amount of memory is generally consumed during the application launching process. When the memory space consumed by the newly started application is smaller than or equal to the searching and killing waterline, the application program running in the background is searched and killed again, so that the application starting process is slow.
Disclosure of Invention
The application provides a searching and killing method, an electronic device and a readable storage medium, which can improve the starting speed of application.
In order to achieve the purpose, the following technical scheme is adopted in the application:
in a first aspect, the present application provides a searching and killing method, including:
the electronic equipment monitors a first event, wherein the first event is related to the starting of a first application;
the electronic equipment acquires the required size of the memory of the first application during starting, wherein the required size of the memory is determined by the occupied size of the memory during historical starting of the first application;
and if the difference value between the residual space of the memory of the electronic equipment and the required size of the memory is smaller than or equal to a first threshold value, the electronic equipment checks and kills the application program running in the background.
In the application, after an event related to the starting of the first application is monitored, the memory occupation size of the first application during the historical starting can be obtained, so that the required size of the memory during the current starting is determined based on the memory occupation size during the historical starting, and then when the difference value between the residual space of the memory and the required size of the memory is smaller than or equal to a first threshold value, the progress of the application program running in the background is searched and killed to release the memory space; under the condition of larger memory space, more resources are allocated to the application program which is started by the system, so that the starting speed of the first application can be increased.
As an implementation manner of the first aspect of the present application, the method further includes:
the electronic equipment monitors a second event, wherein the second event is related to whether the memory occupation size is stable or not when the first application is started;
the electronic equipment samples the memory occupation size of the first application to obtain a plurality of sampling data;
the electronic equipment obtains the memory occupation size of the first application when the first application is started according to the plurality of sampling data, stores the memory occupation size of the first application when the first application is started, and the memory occupation size of the first application when the first application is started is used for determining the required memory size of the first application when the first application is started next time.
In this application, after the memory size of occuping when first application starts is stable, can sample the memory size of occuping, however, when first application starts next time, the memory size of occuping when this starts can regard as the basis of the required size of memory when starting next time to can confirm the required size of memory when first application starts through the method of study, avoid looking for and killing too much and influence the keep-alive of other application programs, or because look for and kill again after leading to triggering to look for and kill the waterline in the start-up process too little to look for and kill, influence the boot speed.
As another implementation manner of the first aspect of the present application, the method for obtaining, by an electronic device, the memory occupation size of a first application when the first application is started according to a plurality of sampling data includes:
the electronic equipment calculates the data characteristic values of the plurality of sampling data, and the occupied size of the memory of the first application when the first application is started at this time is the data characteristic values of the plurality of sampling data.
As another implementation manner of the first aspect of the present application, the electronic device calculating a data characteristic value of a plurality of sample data includes:
the electronic equipment removes the maximum value and the minimum value of the plurality of sampling data to obtain a plurality of screening data;
the electronic equipment calculates the data characteristic values of the plurality of screening data, and the data characteristic values of the plurality of sampling data are the data characteristic values of the plurality of screening data.
In the application, in order to avoid the occurrence of abnormality in the starting process or unreasonable setting of the sampling time, the maximum value and the minimum value in a plurality of sampling data can be deleted, and then the data characteristic value is calculated, so that the more accurate memory occupation size is obtained.
As another implementation manner of the first aspect of the present application, before the electronic device calculates the data characteristic values of the plurality of filter data, the method further includes:
the electronic equipment calculates standard deviations of the plurality of screening data;
the electronic device determines that a standard deviation of the plurality of screening data is less than a first value.
In this application, through the test discovery use when normal start, the memory size that occupies can tend to stable, so, for the memory size that occupies when avoiding gathering the application start anomaly, can calculate the standard deviation of screening data, just can obtain this memory size that occupies when starting based on the screening data of this standard deviation determination data set to obtain effective reasonable memory size that occupies, just can provide effective reasonable memory required size for follow-up start.
As another implementation manner of the first aspect of the present application, after the electronic device stores the memory occupation size of the first application when the first application is started, the method further includes:
the electronic equipment acquires a plurality of memory occupation sizes of the latest storage belonging to the first application;
the electronic equipment performs sliding window filtering on the plurality of memory occupation sizes to obtain an average value of the plurality of memory occupation sizes, wherein the average value of the plurality of memory occupation sizes is the size required by the memory when the first application is started next time.
In the application, the average value of the occupied sizes of the memories is calculated by adopting a sliding window filtering mode, so that the smoothness of the required size of the memory obtained by multiple times of calculation is higher, and the phenomenon that the fluctuation of the required size of the memory calculated every time is larger is avoided.
As another implementation manner of the first aspect of the present application, before the electronic device performs sliding window filtering on the multiple memory occupation sizes, the method further includes:
the electronic device determines that the number of the plurality of memory footprint sizes is greater than or equal to 5.
In the present application, the sliding window filtering method requires at least 5 data, and therefore, the number of the occupied sizes of the plurality of memories that are limited to be stored at the latest in practical application is greater than or equal to 5.
As another implementation manner of the first aspect of the present application, the method further includes:
the electronic equipment determines that the number of the occupied sizes of the plurality of memories is less than 5;
the electronic device calculates an average of the plurality of memory footprint sizes.
In the application, when the number of times of starting the first application or the number of times of obtaining the effective memory occupation size is less than 5, the required size of the memory when the first application is started next time can be determined by adopting a mode of directly calculating an average value.
As another implementation of the first aspect of the present application, the first event includes: an event of starting startup of a first application; the second event includes: the top Activity of the first application launches the completed event.
In the application, in order to timely kill an application program running in a background when the first application is started, when the trigger event for judging whether killing is started is the first application, and in order to obtain stable sampling data, the trigger event for starting sampling may be set after the top Activity of the first application is started.
As another implementation manner of the first aspect of the present application, after the electronic device monitors the second event, the method further includes:
and if the memory residual space of the electronic equipment is smaller than or equal to a second threshold value, the electronic equipment kills the application program running in the background, wherein the second threshold value is smaller than or equal to the first threshold value.
In the application, after the first application is started, it is further required to determine whether to perform killing for other application programs running in the background according to the remaining memory space and the killing waterline (for example, a second threshold).
Of course, in practical applications, the killing waterline before the first application is started and after the first application is started may be the same or different. For example, the killing waterline before the completion of starting can be set to be larger than the killing waterline after the completion of starting, so that the residual space of the memory in the starting process is larger, the residual space of the memory after the completion of starting can be smaller, the starting speed of the application program is increased, and the keep-alive requirements of other application programs are increased after the completion of starting.
As another implementation of the first aspect of the present application, the second threshold is smaller than the first threshold;
the checking and killing threshold value of the electronic equipment comprises a first-level threshold value and a second-level threshold value, the second-level threshold value is higher than the first-level threshold value, the second-level threshold value comprises a first threshold value and a second threshold value, and the first-level threshold value comprises a third threshold value and a fourth threshold value;
if the difference between the residual memory space of the electronic device and the required size of the memory is smaller than or equal to a first threshold, the electronic device checks and kills the application program running in the background, and the method comprises the following steps:
if the difference value between the residual space of the memory of the electronic equipment and the required size of the memory is smaller than or equal to a first threshold value and larger than a third threshold value, the electronic equipment checks and kills the first type of application program running in the background;
if the difference value between the residual memory space of the electronic device and the required size of the memory is smaller than or equal to a third threshold value, the electronic device searches and kills the first type of application programs and the second type of application programs running in the background, and the keep-alive requirement of the second type of application programs is larger than that of the first type of application programs.
According to the application, a multi-stage searching and killing waterline can be further arranged, so that when the remaining space of the memory is determined to be lower according to the relation between the remaining space of the memory and the multi-stage searching and killing waterline, the application programs with lower keep-alive requirements are killed preferentially; when the residual space of the memory is low, the application program with high keep-alive requirement can be killed, and the quick start of the application and the keep-alive of the background application program are balanced.
As another implementation manner of the first aspect of the present application, if the remaining memory space of the electronic device is less than or equal to the second threshold, the searching and killing, by the electronic device, the application program running in the background includes:
if the residual memory space of the electronic equipment is smaller than or equal to the second threshold and larger than the fourth threshold, the electronic equipment checks and kills the first type of application program running in the background;
if the memory residual space of the electronic equipment is smaller than or equal to a fourth threshold value, the electronic equipment checks and kills the first type of application programs and the second type of application programs running in the background, and the fourth threshold value is smaller than the third threshold value.
Of course, after the application is started, a multi-level kill pipeline may also be employed to balance between fast running of the application and keep-alive of background applications.
As another implementation manner of the first aspect of the present application, before the electronic device obtains a size required by a memory of the first application at the time of starting, the method further includes:
the electronic equipment determines the size required by a memory in the electronic equipment, wherein the memory stores a first application, and the second threshold is equal to the first threshold.
As another implementation manner of the first aspect of the present application, the method further includes:
the electronic device monitors a first event;
the electronic equipment determines the size required by a memory which does not store the first application in the electronic equipment;
the method comprises the steps that the electronic equipment obtains the memory setting size of a first application, the memory setting size of the first application is the pre-estimated memory consumption size when the first application is started, a second threshold is smaller than the first threshold, the searching and killing threshold of the electronic equipment comprises a first-level threshold and a second-level threshold, the second-level threshold is higher than the first-level threshold, the second-level threshold comprises the first threshold and the second threshold, and the first-level threshold comprises a third threshold and a fourth threshold;
if the difference value between the residual space of the memory of the electronic equipment and the set size of the memory is smaller than or equal to a first threshold value and larger than a third threshold value, the electronic equipment checks and kills the first type of application program running in the background;
if the difference value between the residual memory space of the electronic equipment and the set memory size is smaller than or equal to a third threshold value, the electronic equipment checks and kills the first type of application programs and the second type of application programs running in the background, and the keep-alive requirement of the second type of application programs is larger than that of the first type of application programs.
According to the method and the device, whether the application program needs to be checked and killed or not can be judged by adopting the size required by the learned memory when the application program with the size required by the learned memory is started, the application program can be checked and killed in time when the application program needs to be checked and killed, and the memory can be released in time, so that the starting speed of the application program is increased.
Different ways of checking and killing the waterline in the starting process and after the starting can be adopted when the application program with the size required by the memory is not learned to be started, so that the residual space of the memory in the starting process is higher, and the starting speed of the application program is improved.
Of course, the two modes can be simultaneously applied to the starting process and the running process of the application program, namely, the required size of the learned memory can be adopted to judge whether to need to check and kill when the application program with the required size of the learned memory is started, the memory can be checked and killed in time when the memory needs to be checked and killed, and the memory can be released in time, so that the starting speed of the application program is increased, meanwhile, a higher checking and killing waterline is adopted in the starting process when judging whether to need to check and kill, and a lower checking and killing waterline is adopted after the starting is finished.
Provides diversified application modes.
As another implementation manner of the first aspect of the present application, the method further includes:
after the electronic equipment monitors a second event, if the remaining memory space of the electronic equipment is smaller than or equal to a second threshold and larger than a fourth threshold, the electronic equipment checks and kills the first type of application program running in the background;
if the memory residual space of the electronic equipment is smaller than or equal to a fourth threshold value, the electronic equipment checks and kills the first type of application programs and the second type of application programs running in the background, and the fourth threshold value is smaller than the third threshold value.
In a second aspect, an electronic device is provided, comprising a processor for executing a computer program stored in a memory, implementing the method of any of the first aspect of the present application.
In a third aspect, a chip system is provided, which includes a processor coupled to a memory, and the processor executes a computer program stored in the memory to implement the method of any one of the first aspect of the present application.
In a fourth aspect, there is provided a computer readable storage medium storing a computer program which, when executed by one or more processors, performs the method of any one of the first aspects of the present application.
In a fifth aspect, the present application provides a computer program product for causing a device to perform the method of any one of the first aspects of the present application when the computer program product is run on the device.
It is understood that the beneficial effects of the second aspect to the fifth aspect can be referred to the related description of the first aspect, and are not described herein again.
Drawings
Fig. 1 is a schematic hardware structure diagram of an electronic device according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram illustrating changes in remaining memory space during an application start process according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram illustrating a change of a remaining memory space in an application start process according to another embodiment of the present application;
fig. 4 is a schematic diagram of a technical architecture of a searching and killing method according to an embodiment of the present application;
fig. 5 is a timing chart of a searching and killing method according to an embodiment of the present application;
fig. 6 is a schematic diagram illustrating a change in memory usage during an application start process according to an embodiment of the present application;
FIG. 7 is a timing diagram illustrating another searching and killing method according to an embodiment of the present disclosure;
fig. 8 is a schematic diagram illustrating a change of a killing waterline before and after application start according to an embodiment of the present application;
fig. 9 is a schematic flowchart of another searching and killing method according to an embodiment of the present application;
fig. 10 is a timing diagram of another killing method according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that in the embodiments of the present application, "one or more" means one, two, or more than two; "and/or" describes the association relationship of the associated object, and indicates that three relationships can exist; for example, a and/or B, may represent: a exists singly, A and B exist simultaneously, and B exists singly, wherein A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," "fourth," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather mean "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
The searching and killing method provided by the embodiment of the application can be suitable for electronic equipment such as tablet computers, mobile phones, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, personal Digital Assistants (PDAs) and the like. The embodiment of the present application does not limit the specific type of the electronic device.
Fig. 1 shows a schematic structural diagram of an electronic device. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a key 190, a motor 191, a camera 193, a display screen 194, and a Subscriber Identification Module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a touch sensor 180K, and the like.
It is to be understood that the illustrated structure of the embodiment of the present application does not specifically limit the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or combine certain components, or split certain components, or arrange different components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The controller may be, among other things, a neural center and a command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the time sequence signal to finish the control of instruction fetching and instruction execution.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to use the instruction or data again, it can be called directly from memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
The USB interface 130 is an interface conforming to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transmit data between the electronic device 100 and a peripheral device.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the memory capability of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in an external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, and an application program (such as a sound playing function, an image playing function, etc.) required by at least one function.
In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like.
The charging management module 140 is configured to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger via the USB interface 130.
The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140 and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, the wireless communication module 160, and the like.
In other embodiments, the power management module 141 may be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be disposed in the same device.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution including wireless communication of 2G/3G/4G/5G, etc. applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 150 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave.
The wireless communication module 160 may provide solutions for wireless communication applied to the electronic device 100, including Wireless Local Area Networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), bluetooth (bluetooth, BT), global Navigation Satellite System (GNSS), frequency Modulation (FM), near Field Communication (NFC), infrared (IR), and the like. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering on electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into electromagnetic waves through the antenna 2 to radiate the electromagnetic waves.
In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150 and antenna 2 is coupled to wireless communication module 160 so that electronic device 100 can communicate with networks and other devices through wireless communication techniques.
The electronic device 100 may implement audio functions via the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio signals into analog audio signals for output, and also used to convert analog audio inputs into digital audio signals. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also called a "horn", is used to convert the audio electrical signal into an acoustic signal. The electronic apparatus 100 can listen to music through the speaker 170A or listen to a handsfree call.
The receiver 170B, also called "earpiece", is used to convert the electrical audio signal into an acoustic signal. When the electronic apparatus 100 receives a call or voice information, it can receive voice by placing the receiver 170B close to the ear of the person.
The microphone 170C, also referred to as a "microphone," is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can input a voice signal to the microphone 170C by speaking near the microphone 170C through the mouth. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C to implement a noise reduction function in addition to listening to voice information. In other embodiments, the electronic device 100 may further include three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, perform directional recording, and so on.
The earphone interface 170D is used to connect a wired earphone. The headset interface 170D may be the USB interface 130, or may be a 3.5mm open mobile electronic device platform (OMTP) standard interface, a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The pressure sensor 180A is used for sensing a pressure signal, and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A can be of a variety of types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a sensor comprising at least two parallel plates having an electrically conductive material. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the strength of the pressure from the change in capacitance. When a touch operation is applied to the display screen 194, the electronic apparatus 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic apparatus 100 may also calculate the touched position from the detection signal of the pressure sensor 180A.
The touch sensor 180K is also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation acting thereon or nearby. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output associated with the touch operation may be provided through the display screen 194. In other embodiments, the touch sensor 180K may be disposed on a surface of the electronic device 100, different from the position of the display screen 194.
The keys 190 include a power-on key, a volume key, and the like. The keys 190 may be mechanical keys. Or may be touch keys. The electronic apparatus 100 may receive a key input, and generate a key signal input related to user setting and function control of the electronic apparatus 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration cues, as well as for touch vibration feedback.
The electronic device 100 implements display functions via the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 194 is used to display images, video, and the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The camera 193 is used to capture still images or video. In some embodiments, electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The SIM card interface 195 is used to connect a SIM card. The SIM card can be attached to and detached from the electronic device 100 by being inserted into the SIM card interface 195 or being pulled out of the SIM card interface 195. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1.
The embodiment of the present application does not particularly limit a specific structure of an execution subject of a killing method, as long as the execution subject can be processed by a killing method provided according to the embodiment of the present application by running a code recorded with the killing method of the embodiment of the present application. For example, an execution main body of the searching and killing method provided by the embodiment of the present application may be a functional module capable of calling a program and executing the program in the electronic device, or a processing device, such as a chip, applied to the electronic device.
One or more applications may be run in the memory of the electronic device. When a new application program is started, a large amount of memory is generally consumed, and when the remaining memory space of the electronic device is small, in order to ensure that the new application program is started normally or quickly, some or all other application programs (processes) currently running in the memory of the electronic device can be killed to release the memory space. The process of killing part or all of other running applications (processes) in the memory of the electronic device by the system can be recorded as a process of killing the applications by the system.
In practical application, a checking and killing waterline can be set. The checking and killing waterline can be used as the basis for checking and killing the application program by the system. For example, if the remaining space of the memory is less than or equal to the checking and killing waterline, the electronic device needs to check and kill the application programs (processes) running in the memory to kill part or all of the application programs running in the memory to release the memory, so that the remaining space of the released memory is greater than the checking and killing waterline. And if the residual space of the memory is larger than the checking and killing waterline, the electronic equipment does not trigger the checking and killing of the application program currently running in the memory.
Because the keep-alive requirements of different applications may be different, the applications in the system can be divided into at least two broad categories: the application programs with high keep-alive requirements and the application programs with low keep-alive requirements; dividing the checking and killing waterline into two stages: the first-level checking and killing waterline and the second-level checking and killing waterline. The second-level checking and killing waterline is larger than the first-level checking and killing waterline. As an example, the second-level kill waterline is 1000MB, and the first-level kill waterline is 600MB.
When the residual space of the memory is smaller than or equal to the second-level checking and killing waterline and larger than the first-level checking and killing waterline, the application program with low keep-alive requirement can be killed, and the memory space is released; when the residual space of the memory is less than or equal to the first-level killing waterline, the application program with high keep-alive requirement can be killed, and the memory space is released. In this way, when the remaining space of the memory is low (less than or equal to the second-level killing waterline and more than the first-level killing waterline), the application program with low keep-alive requirement can be killed preferentially, and the application program with high keep-alive requirement can continue to run in the background; when the residual space of the memory is very low (less than or equal to a first-level killing waterline), the application program with high keep-alive requirement can be killed for normal operation of the system. Thereby balancing the live-keeping of the running application in the background against the fast start of the newly started application.
Of course, the above embodiments are only examples, and in practical applications, a type of application program may also be set as an application program that keeps alive during the system operation. And a multi-stage checking and killing waterline can be set, and application programs with more classes of keep-alive requirements are correspondingly set.
In some middle and low-end electronic devices, in order to improve the keep-alive rate of background applications, the checking and killing waterline is usually set to be low, so that more applications are run in an originally small memory. The smaller the memory residual space is, the more tense the system resources are, the less the resources allocated to each process are, and the slower the processing speed of a single process is; therefore, the application program start-up process is slower.
Even if the configuration of the high-end electronic device is high and the memory space is large, however, the situation that the memory occupied by some application programs is higher and higher during the starting and running along with the version upgrading also occurs, and therefore, the phenomenon that the starting process of the application programs is slow also occurs.
In addition, in the starting process of the application program, when the memory is consumed to be less than or equal to the searching and killing waterline, the system can start to search and kill other application programs running in the memory, so that the searching and killing process is delayed, and the starting process of the application program is slow.
In addition, when some applications with large memory consumption are started, the system may not be able to determine how much memory space is needed in the starting process of the application being started, which may cause the system to be untimely to check and kill, the remaining memory space may also be small, and the application starting process may also be slow. Specifically, reference may be made to the schematic diagram of memory change when the application program with large memory consumption is started, where the time value in the diagram is only used to represent the time change, and does not represent the time value in an absolute sense.
As shown in fig. 2, between time 0 and time 6, the application starts, gradually consumes the memory, and the remaining memory space gradually decreases.
At time 6, the remaining space of the memory is reduced to 1000MB (second-level killing waterline), and at this time, the system starts to kill the application program running in the background and having low keep-alive requirement so as to recycle the memory.
Between 6 and 12, the system recovers the memory and the newly started application program consumes the memory; if the recycled memory is larger than the consumed memory, the remaining memory space will be larger, and if the recycled memory is smaller than the consumed memory, the remaining memory space will be smaller. However, the memory headroom is between the first-level pipeline (600 MB) and the second-level pipeline.
At 12, the remaining memory space is reduced (the recovered memory is less than the consumed memory) to a first-level killing waterline, and at the moment, the system can kill the application program with higher keep-alive requirement running in the background to recover the memory. Of course, after the remaining memory space is reduced to the first-level killing waterline, if the application program with lower keep-alive requirement still exists in the background, the application program with lower keep-alive requirement can be preferentially killed.
After 12 hours, the system recovers the memory and the newly started application program consumes the memory, and similarly, if the recovered memory is larger than the consumed memory, the remaining memory space will become larger, and if the recovered memory is smaller than the consumed memory, the remaining memory space will become smaller. Along with the process of system killing, the residual space of the memory is larger and larger until the residual space is larger than a second-level killing waterline.
As can be understood from the illustration, the system does not determine the size of the memory required for the application program starting process (whether the second-level killing waterline and the first-level killing waterline are touched) over time, but only kills a part of the application program when it is determined that the remaining memory space is less than or equal to the second-level killing waterline, and if the killed application program is still insufficient over time, the remaining memory space is reduced to (or less than) the first-level killing waterline, and then the killing of a part of the application program is continued. The system cannot check and kill the newly started application program in time, so that the residual memory space of the newly started application program is reduced to be lower than a first-stage checking and killing waterline in the starting process, and the newly started application program is slow to start.
In order to solve the problem, the size required by the memory can be set for the application program which consumes a large amount of memory in the starting process, when the application program is started, the system kills part or all of the application programs which run in the background in the memory so as to check and kill the memory to a size larger than the size required by the memory, however, the mode often causes multiple killing and influences the keep-alive rate of background application. Specifically, reference may be made to a schematic diagram of memory change when an application program with a size required by the memory is started, where a time value in the diagram is only used to represent a time change, and does not represent a time value in an absolute sense.
As shown in fig. 3, during the starting process of the application program, the memory remaining space does not touch the second level killing waterline yet, and the system starts to kill other application programs running in the background, so as to ensure that the memory remaining space of the system is greater than or equal to the optimal memory remaining space. However, in practice, this approach may result in killing more applications running in the background, which affects the survival rate of the background applications.
In view of this, an embodiment of the present application provides a checking and killing method, which monitors memory occupied sizes of different applications when the applications are started, and then uses the memory occupied size of the application when the application is started as a basis for a memory size required by subsequent starting of the application, and when the application is subsequently started, a system performs checking and killing based on the memory required size of the application.
Referring to fig. 4, a technical architecture diagram of a searching and killing method provided in the embodiment of the present application is shown.
An application layer, a Java framework layer, a native framework layer, a kernel layer and a hardware layer exist in a system structure of the electronic device. The technical architecture diagram only shows the hierarchical structure related to the embodiment of the present application, and in practical applications, other hierarchical structures or hierarchical structures different from the division of the embodiment of the present application may also be included.
The application layer comprises a plurality of applications, such as application 1, application 2, 8230, application N and 8230. These applications may be in an off state, a background running state, a foreground running state, etc. Applications may switch between these states, for example, from an off state to a foreground running state after an application is started.
The Java framework layer comprises an application state module and a memory management module. The application state module is used for managing the state of each application program. The memory management module is used for being matched with other modules to realize the searching and killing method provided by the embodiment of the application. For example, the memory management module may monitor the state of the application program, identify the memory occupied size of the application program in the application program starting process, and when the same application is started again in the subsequent process, use the identified memory occupied size as the basis of the memory required size of the same application, thereby triggering the killing of the application program running in the background when the remaining memory space is small.
The memory management module comprises a state monitoring module, a memory size identification module and an application searching and killing processing module.
The state monitoring module is used for acquiring the state of the application program from the application state module;
the memory size identification module is used for identifying the size of the memory occupied by the application program in the starting process of the application program and taking the size of the occupied memory as the basis of the size required by the memory when the application program is subsequently started;
the application searching and killing processing module is used for triggering searching and killing of the background application program under the condition that the residual space of the memory is judged to be in contact with the searching and killing waterline based on the required size of the memory of the application when the application is started.
The native framework layer has a file module. The file module is used for generating a file according to the occupied size of the memory (or the size required by the memory) identified by the memory size identification module.
The kernel layer comprises a memory information module and a file read-write module. The memory information module is used for providing the current residual space of the memory and the occupied size of the memory in the application starting process to the memory size identification module; and the file reading and writing module is used for writing the file generated according to the memory occupation size (or the size required by the memory) into the memory or reading the file from the memory.
The hardware layer has a memory for storing a file in which the memory occupation size (or the size required by the memory) is located.
Based on the technical architecture, the searching and killing method shown in fig. 5 can be realized.
S101, the state monitoring module monitors the state change information of the application.
The state change information of the application can be acquired by an application state module of the Java framework layer.
S102, after monitoring that the application 2 (any application program in an application layer) starts to be started, the state monitoring module sends starting information to the memory size identification module, wherein the starting information carries the unique identifier of the application 2 which starts to be started currently, and the starting information is used for indicating the memory size identification module to sample the memory occupied size of the application 2 which is started currently in the starting process.
S105, the memory size identification module samples the memory occupation size of the application 2 which is currently started in the starting process to obtain the sampling data of the memory occupation size.
The memory size identification module may obtain, from the memory information module in the kernel layer, sample data of a memory occupied size in the starting process of the application 2.
In practical applications, after the start information is received, the sampling data of the memory occupation size of the application 2 may be obtained from the memory information module at a preset time interval (a preset sampling period).
To obtain more accurate sample data of the memory size, reference may be made to a schematic diagram of the memory size change during the application start process, and specifically refer to fig. 6.
As shown in fig. 6, during the startup process of an application, the memory size gradually increases and then becomes stable. By testing the starting processes of multiple applications, the memory occupation size is found to be stable within 2s after topActivity starting of the applications is completed. For example, the application in FIG. 6 begins to stabilize the memory footprint size after 1 s.
Wherein topActivity is Activity corresponding to the topmost interface (excluding advertisement pages, blank pages, transition pages, etc.) belonging to the application after the application is started.
In the application, the memory occupation size obtained by sampling is the memory size required to be occupied in the application starting process and is also the basis for the memory required size in the next starting process, so that the memory occupation size after the memory occupation size is stable in the application starting process is mainly sampled. In order to avoid collecting more interference sampling data (for example, data before the memory occupancy is stable), sampling may be started after the topActivity of the application is started.
As an example, the memory usage size of the application may be collected at a preset time interval (e.g., 0.05s, 0.1s, 0.2s, etc.) after the topActivity of the application is started (or after the startup is completed for 2 s).
Certainly, the trigger condition or the time node and the like for starting to acquire the memory occupation size of the application at the preset time interval are not limited, and the important point is to start to acquire the application after the memory occupation size is stable.
In view of the above description, the embodiments of the present application may provide: and after receiving the topActivity of the application 2 and finishing starting, the memory size identification module starts to sample the memory occupation size of the application 2.
Namely, before step S105, the method further includes the steps of:
s103, the state monitoring module monitors the information of the topActivity start end of the application 2.
And S104, after the state monitoring module monitors the topActivity start ending information of the application 2, the state monitoring module sends the topActivity start ending information to the memory size identification module, and the topActivity start ending information can also carry the unique identifier of the application 2.
In addition, the CPU is burdened by frequently acquiring the memory occupation size, and therefore, it may be set to stop acquiring data n times (for example, 5 times, 6 times, 7 times, and the like).
And S106, the memory size identification module obtains the memory occupation size in the starting process of the application 2 according to the sampling data.
In the application, after a plurality of sampling data are obtained by sampling, the data characteristic values of the plurality of sampling data can be used as the memory occupation size of the application 2 in the starting process.
As an example, an average value of a plurality of sampling data may be used as the memory occupation size of the starting process; the maximum value in the sampling data can also be used as the memory occupation size in the starting process; the average value of the remaining sample data after removing a maximum value and a minimum value from the plurality of sample data can be used as the memory occupation size in the starting process; the average value or the maximum value of the remaining sampled data after removing part of the sampled data (for example, points with obvious errors, points deviating from the trend, and the like) from the plurality of sampled data can also be used as the memory occupation size in the starting process.
Of course, the data characteristic value may also be a median, a mode, and the like of the plurality of sample data, and the embodiment of the present application does not limit the manner of obtaining the data characteristic value of the n sample data.
In the embodiment of the application, the memory occupation size calculated is used as the size required by the memory when the same subsequent application is started, and in order to avoid data inaccuracy, the data occupation size calculated is considered to be an effective data characteristic value under the condition that the sampling data of the data characteristic value are relatively concentrated. The sampling data for calculating the data feature value may be data after the abnormal data is subtracted, or data after the maximum value and the minimum value are subtracted.
As an example, first, n times of sampling data are removed one maximum value and one minimum value, then a standard deviation of n-2 times of data (data after removing the maximum value and the minimum value) is calculated, in a case where the standard deviation is less than a threshold, the n-2 times of data is considered as valid data, and then an average value (median, mode, maximum value, etc.) of the n-2 times of data is calculated. The average value (median, mode, maximum, etc.) is used as the memory occupation size at the time of the current startup. Otherwise, the data collected in the starting process is considered as invalid data and discarded.
As another example, 3 abnormal data are first removed from n-time sample data, then, the standard deviation of n-3-time data (data after 3 abnormal data are removed) is calculated, in the case where the standard deviation is less than a threshold, the n-3-time data is considered as valid data, and then the average value (median, mode, maximum value, etc.) of the n-3-time data is calculated. The average value (median, mode, maximum, etc.) is used as the memory occupation size at the time of the current startup. Otherwise, the data collected in the starting process is considered as invalid data and discarded.
And S107, the memory size identification module stores the calculated memory occupation size of the application 2 at the starting time in a memory. The specific storage process may refer to the related description in the technical architecture shown in fig. 4, and is not described herein again.
By the method, the memory occupation size of the application in the starting process can be stored in the memory, and when the same application is started next time, the memory occupation size can be read from the memory to serve as the basis for the memory required size in the next starting.
As described above, the memory occupied size obtained according to the sampling data in the application starting process can be used as a basis for the memory required size of the same application in the subsequent starting process. Therefore, in the application starting process, not only the processes from S101 to S107 to obtain the memory occupation size at the time of the current starting, but also a process for performing a searching and killing process based on the stored historical memory occupation size as the memory occupation size at the time of the current starting is required.
In view of this, in the embodiment of the present application, S101 to S107 may be used as a process executed when the application 2 is started for the 1 st time (or an effective historical memory occupation size is not obtained yet), and since there is no stored historical memory occupation size, only the memory occupation size at the time of starting needs to be obtained by sampling, and a process of performing a searching and killing process by using the memory occupation size as a basis of a memory required size is not executed.
For a clearer understanding of the killing method provided in the embodiment of the present application, reference may be made to steps S108 to S118 to describe a killing process of the same application when the same application is started next time.
And S108, the state monitoring module monitors the state change information of the application.
This step can refer to the description of step S101, and is not described herein again.
And S109, after the state monitoring module monitors that the application 2 (any application program in the application layer) starts to be started, the state monitoring module sends starting information to the memory size identification module, wherein the starting information carries the unique identifier of the application 2 which starts to be started currently.
The start information is used to instruct the memory size identification module to sample the memory occupied size of the currently started application 2 in the start process. The start information is also used to instruct the memory size identification module to determine whether to execute the killing process based on the historical memory occupation size and the memory remaining space of the application 2 stored in the memory.
After it is monitored that the application 2 is started, on the first aspect, the memory occupied size of the application 2 during the historical start needs to be obtained as the memory required size during the current start, so as to determine whether to check and kill the application program currently running in the background, and on this aspect, reference may be made to steps S110 to S113.
In the second aspect, the memory usage size of the application 2 in the current starting process needs to be sampled, so that the memory usage size in the current starting process is used as a basis for checking and killing whether the application 2 is started next time, and reference may be made to steps S114 to S118, where steps S114 to S118 are the same as steps S103 to S107.
In practical applications, the sampling of the memory occupation size is usually performed after topActivity is started, and in order to avoid affecting the starting process, it is better to perform the killing work earlier, so that, although the two processes may be performed simultaneously as described above, in practical applications, the first aspect may be performed prior to the second aspect. Of course, the specific execution sequence (and completion sequence) is based on the internal processing result of the system, and is not specifically set.
S110, the memory size identification module obtains the memory occupation size in the historical starting process of the stored application 2 from the memory.
In the embodiment of the present application, the memory occupied size of the same application when the same application is started last time may be used as the size required by the memory when the same application is started this time, and certainly, under the condition that the sampling data when the same application is started last time is discarded as invalid data, the memory occupied size when the same application is started last time may also be used as the size required by the memory when the same application is started this time, that is, the memory occupied size corresponding to the latest storage (that is, the memory occupied size which is stored only under the condition of valid data) of the same application may be used as the size required by the memory when the same application is started this time.
In the embodiment of the present application, if only the memory occupied size of the application 2 in history 1 time is stored in the memory, the memory occupied size of the application 2 in history 1 time may be used as the required size of the memory when the application 2 is started this time. Of course, in practical applications, a value obtained by adding or multiplying a constant (a preset positive number, a preset negative number, a number greater than 1, or a number less than 1) to the memory occupation size of history 1 time may also be used as the memory required size at the time of the current startup according to practical situations.
And S111, the memory size identification module acquires the memory residual space from the memory information module.
And S112, the memory size identification module takes the occupied size of the memory as the required size of the memory, and the residual space of the memory is sent to the application searching and killing processing module.
And S113, determining whether to kill the application program in the background or not by the application killing processing module according to the required size of the memory, the residual space of the memory and the killing waterline. In the embodiment of the application, when the size of the current memory residual space minus the size of the memory required by the device is still larger than the killing waterline, the application program in the background does not need to be killed, and when the size of the current memory residual space minus the size of the memory required by the device is smaller than or equal to the killing waterline, the application program in the background needs to be killed.
It should be noted that the searching and killing waterline at this time may be a second-level searching and killing waterline or a first-level searching and killing waterline.
As described above, the second-level checking and killing waterline and the first-level checking and killing waterline can improve the survival rate of some applications with higher survival demand, so that applications with low survival demand running in the background need to be killed and the memory space needs to be released under the condition that the current memory residual space minus the required size of the memory is smaller than or equal to the second-level checking and killing waterline and the current memory residual space minus the required size of the memory is larger than the first-level checking and killing waterline. Under the condition that the size of the residual space of the current memory minus the size of the memory is smaller than or equal to the first-level killing waterline, the application program running in the background and having high keep-alive requirement can be killed, and certainly, the application program running in the background and having low keep-alive requirement is killed preferentially during killing.
As an example, the second-level kill-water line is 1000MB, the first-level kill-water line is 600MB, the memory residual space is 1200MB, and the required size of the memory for application startup is 500MB. And under the condition that the size (500 MB) of the current residual memory space (1200 MB) minus the size (500 MB) of the memory is smaller than or equal to the second-level checking and killing waterline (1000 MB), and the size (500 MB) of the current residual memory space (1200 MB) minus the size (600 MB) of the memory is larger than the first-level checking and killing waterline (600 MB), the application program running in the background and having low keep-alive requirements needs to be killed, and the memory space is released.
That is, if the application is not killed, the memory remaining space is reduced to 700MB in the application starting process, and the memory remaining space (700 MB) in the application starting process is smaller than the second-level killing waterline (1000 MB) and larger than the first-level killing waterline (600 MB), so that the killing needs to be performed, and the application program with low keep-alive requirement running in the background can be killed.
The difference between the memory residual space (700 MB) and the secondary kill waterline (1000 MB) during the application starting process is 300MB, so that at least 300MB of memory space needs to be killed and released.
And S114, the state monitoring module monitors the information of topActivity start end of the application 2.
And S115, after the state monitoring module monitors topActivity starting ending information of the application 2, the state monitoring module sends the topActivity starting ending information to the memory size identification module, and the topActivity starting ending information can also carry the unique identifier of the application 2.
S116, the memory size identification module samples the memory occupied size of the currently started application 2 in the starting process, and obtains the sample data of the memory occupied size.
And S117, the memory size identification module obtains the memory occupation size of the application 2 in the starting process according to the sampling data.
And S118, the memory size identification module stores the calculated memory occupation size of the application 2 at the starting time in the memory.
As described above, in the case where the storage stores only one historical memory occupation size of the same application, the memory occupation size is set as the size required by the memory of this time. When the memory stores a plurality of historical memory occupation sizes of the same application, the required size of the memory at the time of the current start-up can be calculated based on the plurality of historical memory occupation sizes.
As another example, the data characteristic value based on the memory usage size at the time of M times of activation that is stored latest in history is used as the memory required size at the time of this activation.
For example, if the current startup of the application 2 is the jth startup, and the memory stores a plurality of memory occupation sizes, the latest stored data characteristic values of the M memory occupation sizes may be selected as the required size of the memory during the current startup.
The latest stored data characteristic value of the sizes of the M memory footprints may be an average of the latest stored sizes of the M memory footprints. Since the memory footprint size stored is valid data that has been verified, the maximum and minimum values may no longer be removed from the M memory footprint sizes that are stored at the latest.
Of course, the data characteristic value of the latest stored M memory footprint sizes may also be a weighted average of the latest stored M memory footprint sizes. When the data characteristic value of the size occupied by the M latest stored memories is calculated, a sliding window filtering algorithm can be adopted.
The sliding window filtering algorithm is to set a slider with a width of a fixed value (e.g., 4) in a data queue composed of a plurality of data, the slider slides from left to right (or from right to left) on the data queue, when the slider is located at different positions of the data queue, calculate a difference value between the leftmost data and the rightmost data in the slider, find two groups (4) of data with the smallest difference value, and calculate an average value of the two groups (4) of data. If this method is adopted, at least 5 data (5 memory occupied sizes) need to exist in the data queue. Therefore, M can be set to be a value larger than or equal to 5, when the number of the memory occupation sizes of the same application stored in the memory is larger than or equal to M, the latest stored M memory occupation sizes are selected, and the average value is calculated by adopting a sliding window filtering algorithm to obtain the size required by the memory during the current starting; if the number of the memory occupation sizes of the same application stored in the memory is smaller than M, selecting all the stored memory occupation sizes, and if the size of all the memories is larger than or equal to 5, calculating an average value by adopting a sliding window filtering algorithm to obtain the size required by the memory during the starting; and if the size of the whole memory is less than 5, directly calculating the average value of the sizes of the whole memory occupied by the stored application.
Through the steps, the memory occupation size of the application during historical starting can be obtained from the memory during each starting of the application, and the required memory size during the current starting can be obtained according to the obtained memory occupation size or sizes stored latest. After the topActivity (top Activity) in the starting process is started, the memory occupation size in the starting process is sampled, so that the memory occupation size obtained at this time is stored in a memory under the condition that the sampled data is valid data, and the memory occupation size is convenient to use when the starting process is started next time.
In addition, it should be further described that the cold start process of the application is from the system start creation process to the start completion, so that the memory occupation size of the cold start process of the application is relatively stable, and the embodiment of the present application can be applied to the cold start process of the application.
As described above, after acquiring the sampling data in each starting process of the application, the memory occupation size in the starting process is obtained according to the sampling data, and the memory occupation size in the starting process of the application is stored in the memory; the latest memory occupation sizes of the application stored in the storage can be obtained when the application is started next time, and then the required memory size is determined based on the memory occupation sizes. However, the process of determining the required size of the memory based on the multiple historical memory occupation sizes consumes time, and if the setting is in the process of monitoring the application start or the application start, it is not favorable for early killing during the application start (the memory can be released in time by killing before the memory occupation size is stable), and the start process of the application may be affected. Therefore, in the embodiment of the present application, after the application acquires the sampling data in each starting process (at this time, topActivity of the memory is already started, and the memory occupation size is already stable), the memory occupation size in the current starting process is obtained according to the sampling data, and the memory occupation size in the current starting process of the application is stored in the storage; then, a plurality of memory occupation sizes of the application stored latest in the memory are obtained, the required size of the memory at the next starting is determined based on the memory occupation sizes, and the required size of the memory is stored in the memory. The size required by the memory can be directly obtained from the memory when the application is started next time, the process of calculating the size required by the memory according to the occupied sizes of the memories is not executed any more, the time is saved, the memory can be searched and killed in advance when the application is started next time (the memory can be searched and killed before the occupied size of the memory is stable, the memory can be released in time), and the application can be started quickly. Referring to fig. 7, the other killing process provided in the embodiment of the present application is shown.
S201, the state monitoring module monitors the state change information of the application.
S202, after the state monitoring module monitors that the application 2 (any application program in the application layer, which may also be recorded as a first application) starts to be started, the state monitoring module sends start information to the memory size identification module, where the start information carries a unique identifier of the application 2 that starts to be started currently.
It should be noted that, in an actual application, the information that the application 2 starts to be started may be generated by triggering an event that is monitored by the electronic device, where the event may be any event from the operation of the user starting the application 2 to the monitoring of the state monitoring module until the application 2 starts to be started. For example, the event may be an operation in which the user clicks an icon of the application 2 on the system desktop. For ease of distinction, this event may be denoted as a first event.
S203, the memory size identification module obtains the required size of the memory in the history starting process of the stored application 2 from the memory.
S204, the memory size identification module acquires the memory residual space from the memory information module.
And S205, the memory size identification module sends the required size of the memory and the residual space of the memory to the application killing processing module.
And S206, the application killing processing module determines whether to kill the application program in the background according to the required size of the memory, the residual space of the memory and the killing waterline.
And S207, the state monitoring module monitors the information of the topActivity start end of the application 2.
And S208, after the state monitoring module monitors the topActivity start ending information of the application 2, the state monitoring module sends the topActivity start ending information to the memory size identification module, and the topActivity start ending information can also carry the unique identifier of the application 2.
S209, after the memory size identification module receives the topActivity start completion of the application 2 or the first duration, the memory size identification module samples the memory occupied size of the application 2 currently being started in the starting process, and obtains the sample data of the memory occupied size.
It should be noted that, in this embodiment of the application, an event that triggers the memory size identification module to sample the memory occupied size of the currently-started application 2 in the starting process may be denoted as a second event, where the second event may be the completion of the topActivity start of the application 2, and may also be a first duration from a timer to the completion of the topActivity start of the application 2. Certainly, in actual application, the second event is an event that the memory usage size starts to be stable when the application 2 is started or after the memory usage size starts to be stable, so in actual application, if it is tested that the memory usage size of the application 2 can be measured to be stable by other events, the other events may also be the second event.
And S210, the memory size identification module obtains the memory occupation size in the starting process of the application 2 according to the sampling data.
S211, the memory size identifying module stores the memory occupied size of the application 2 in the starting process in the memory.
S212, the memory size identification module obtains the memory occupation size of the application 2 stored latest M times from the memory.
S213, the memory size identification module calculates the required size of the memory at the next start based on the latest stored memory occupation size of M times.
S214, the memory size identification module stores the size required by the memory at the next startup in the memory.
In practical application, the memory size identification module may also obtain the memory occupation size in the starting process according to the sampling data, then obtain the memory occupation size in the starting process at first without storing the memory occupation size in the starting process at this time, obtain the memory occupation size of the application stored in the memory at the latest for M-1 times, and then calculate the required size of the memory at the next starting time based on the obtained memory occupation size for M-1 times and the memory occupation size in the starting process at this time; and finally, storing the size required by the memory during the next starting and the occupied size of the memory during the starting process in a memory.
It should be noted that, although the killing process described in steps S203 to S206 precedes the sampling process described in steps S209 to S214, in practical applications, the killing process and the sampling process are two separate processes, and there may be temporal crossover, for example, the killing process has not ended yet, and the sampling process has already started.
In addition, in the embodiment of the present application, no matter the technical architecture or the division of each module in the above flow may be subdivided, in practical applications, a plurality of modules may be combined into one module, and one module may also be split into a plurality of modules.
In addition, functions implemented by steps executed by each module may also be rearranged, and in practical applications, the steps executed by one module or the implemented functions in the foregoing embodiments may also be implemented by other modules.
As another embodiment of the present application, the kill waterline may also be adjustable. In practical application, in order to improve user experience, the starting speed of the application needs to be increased, so that the checking and killing waterline is set to be higher before the topActivity of the application is started and then is reduced by a certain value after the topActivity of the application is started and ended. When the application is monitored to start, the checking and killing waterline is adjusted to be a first value, when the topActivity of the application is monitored to finish starting, the checking and killing waterline is adjusted to be a second value, and the first value is larger than the second value. By setting the high checking and killing waterline when the application is started, the residual memory space of the system in the application starting process is large, the system is not busy, and enough resources are allocated to the application being started, so that the application starting speed can be increased, and the user experience is improved.
Of course, in practical applications, when there are multiple killing waterlines, the multiple killing waterlines may all be set to be higher than the killing waterline during application startup (before topActivity startup ends) than after application startup (after topActivity startup ends).
For example, referring to fig. 8, the second-level kill waterline before the topActivity launch of the application ends may be set to 1200MB, the second-level kill waterline after the topActivity launch of the application ends to 1000MB, the first-level kill waterline before the topActivity launch of the application ends to 800MB, and the first-level kill waterline after the topActivity launch of the application ends to 600MB.
As can be appreciated based on the above example, the kill threshold (kill waterline) of the electronic device includes a first level threshold (first level kill waterline) and a second level threshold (second level kill waterline), the second level threshold being higher than the first level threshold, the second level threshold including the first threshold and the second threshold, the first level threshold including the third threshold and the fourth threshold.
Before topActivity starting is finished, if the difference value between the residual space of the memory of the electronic equipment and the required size of the memory is smaller than or equal to a first threshold value and larger than a third threshold value, the electronic equipment conducts searching and killing on a first type of application program running in a background;
if the difference value between the residual memory space of the electronic device and the required size of the memory is smaller than or equal to a third threshold value, the electronic device searches and kills the first type of application programs and the second type of application programs running in the background, and the keep-alive requirement of the second type of application programs is larger than that of the first type of application programs.
After the topActivity is started, if the residual memory space of the electronic equipment is smaller than or equal to the second threshold and larger than the fourth threshold, the electronic equipment kills the first type of application program running in the background.
And if the residual memory space of the electronic equipment is smaller than or equal to a fourth threshold, the electronic equipment checks and kills the first type of application programs and the second type of application programs running in the background, and the fourth threshold is smaller than the third threshold.
Of course, the above numerical values are only used for example, and in practical application, more levels of killing waterlines may be set according to the memory of the electronic device itself, and other numerical values may be used as the killing waterlines.
In practical application, whether the topActivty startup of the application is completed or not can be used as a basis for adjustment of the killing waterline, and certainly, in practical application, other time nodes in the application startup process can also be used as a basis for adjustment of the killing waterline.
As an example, the searching and killing method may refer to a flow chart shown in fig. 9.
After the application starts to be started, the electronic equipment acquires the residual space of the memory, the size required by the memory of the started application and a high-value checking and killing waterline; the memory required size may be a memory required size set for the application in advance at the time of starting, or may also be a memory required size learned in the foregoing embodiment, for example, a memory required size of the application acquired from the storage or a memory required size calculated from M memory occupied sizes of the latest stored applications acquired from the storage. When only one stage of checking and killing waterline exists, the high-value checking and killing waterline is the checking and killing waterline value before the application topActivty is started and completed, and the low-value checking and killing waterline is the checking and killing waterline value after the application topActivty is started and completed. When the multi-stage killing waterline exists, the high-value killing waterline is the water-killing value of each stage before the application topActivty is started and finished, and the low-value killing waterline is the water-killing value of each stage after the application topActivty is started and finished. For example, the high-value killing waterlines are 1200MB (the second-stage killing waterline before topActivty of the application is started and completed) and 800MB (the first-stage killing waterline before topActivty of the application is started and completed) in the embodiment shown in fig. 8; the low-value killing waterlines are 1000MB (second-stage killing waterline after topActivty startup of the application is completed) and 600MB (first-stage killing waterline after topActivty startup of the application is completed) in the embodiment shown in FIG. 8.
The electronic equipment determines whether to trigger killing according to the acquired residual space of the memory, the size required by the memory and the high-value killing waterline; for example, in the case that the size of the residual space of the memory minus the memory is smaller than or equal to the high-value second-level killing waterline (the second-level killing waterline before the topActivty of the application is started and completed), and the size of the residual space of the memory minus the memory is larger than the high-value first-level killing waterline (the first-level killing waterline before the topActivty of the application is started and completed), the killing will be triggered, and the application program with low keep-alive requirement will be killed. Under the condition that the size of the residual space of the memory minus the memory is smaller than or equal to the high-value first-level checking and killing waterline, checking and killing can be triggered, and the application programs with high keep-alive requirements can be checked and killed.
Certainly, in the killing process, whether the memory residual space is larger than the high-value killing waterline or not can be monitored, and if the memory residual space is larger than the high-value killing waterline, the killing is finished; if the residual space of the memory is not larger than the high-value killing waterline, continuously killing.
After the topActivity starting of the application is completed, the electronic equipment acquires the residual space of the memory and the low-value killing waterline.
The electronic equipment judges whether the residual space of the memory is larger than the low-value killing waterline or not so as to determine whether killing is triggered or not. For example, in the case that the memory remaining space is less than or equal to the low-value second-level killing waterline (the second-level killing waterline after the topActivty of the application is started up) and the memory remaining space is greater than the low-value first-level killing waterline (the first-level killing waterline after the topActivty of the application is started up), killing will be triggered and the application program with low keep-alive requirement will be killed. And under the condition that the residual space of the memory is less than or equal to the low-value first-level checking and killing waterline, checking and killing can be triggered, and the application programs with higher keep-alive requirements can be checked and killed.
Certainly, in the killing process, whether the memory residual space is larger than the low-value killing waterline or not can be monitored, and if the memory residual space is larger than the low-value killing waterline, the killing is finished; if the residual space of the memory is not larger than the low-value checking and killing waterline, continuing checking and killing.
In practical applications, after it is monitored that the application starts to be started, if the memory stores the historical memory occupation size of the application or the required size of the memory determined according to the historical memory occupation size, the embodiment shown in fig. 5 or fig. 7 may be executed. If the memory does not store the historical memory occupation size of the application or the required size of the memory determined according to the historical memory occupation size, the memory setting size (the pre-estimated memory consumption size when the first application is started) set for the application may be obtained, and the embodiment shown in fig. 9 is executed.
Of course, in practical applications, the embodiment shown in fig. 5 or fig. 7 and the embodiment shown in fig. 9 may be executed simultaneously. Namely, under the condition that the memory stores the historical memory occupation size of the application or the required size of the memory determined according to the historical memory occupation size, the required size of the memory is used as a basis for checking and killing, and meanwhile, different schemes of checking and killing waterlines before and after the topActivity starting of the application is completed are executed. The method can also be understood that the residual space of the memory, the required size of the memory and the high-value killing waterline are used as the killing basis before the topActivity of the application is started; and the residual memory space and the low-value killing waterline are used as the killing basis after the topActivity starting of the application is finished.
As another embodiment of the present application, refer to a timing chart of a killing method shown in fig. 10.
S401, the state monitoring module monitors the state change information of the application.
S402, after the state monitoring module monitors that the application 2 (any application program in the application layer) starts to be started, the state monitoring module sends starting information to the memory size identification module, and the starting information carries the unique identifier of the application 2 which starts to be started currently.
S403, the memory size identification module obtains the required size of the memory in the historical starting process of the stored application 2 from the memory.
S404, the memory size identification module acquires the memory residual space from the memory information module.
S405, the memory size identification module sends the required size of the memory and the residual space of the memory to the application searching and killing processing module.
S406, the application killing processing module determines whether to kill the application program in the background according to the required size of the memory, the residual space of the memory and the high-value killing waterline. It should be noted that the killing watermark may also be stored in the memory, and may also be set in an application program that applies the killing processing module. If the memory size identification module is arranged in the memory, the memory size identification module can acquire the checking and killing waterline and then send the checking and killing waterline to the application checking and killing processing module, and the application checking and killing processing module can also directly acquire the checking and killing waterline from the memory.
In practical applications, the application killing processing module may instruct other modules to perform the killing operation, for example, send a killing instruction to the other modules to instruct the other modules to perform the killing operation.
S407, the state monitoring module monitors the topActivity start end information of the application 2.
S408, after the state monitoring module monitors the topActivity start ending information of the application 2, the state monitoring module sends the topActivity start ending information to the memory size identification module, and the topActivity start ending information may also carry the unique identifier of the application 2.
And S409, after the memory size identification module receives the starting end information, acquiring the residual memory space from the memory information module.
S410, the memory size identification module sends the memory surplus space to the application searching and killing processing module.
S411, the application searching and killing processing module judges whether to trigger searching and killing based on the residual memory space and the low-value searching and killing waterline.
Of course, in case of triggering killing, killing will start.
S412, the memory size identifying module samples the memory occupation size of the application 2 for the first time period after receiving the topActivity start end information of the application 2, to obtain the sampled data.
S413, the memory size identification module obtains the memory occupied size of the application 2 in the starting process according to the sampling data.
S414, the memory size identifying module stores the memory occupied size of the application 2 in the starting process in the memory.
S415, the memory size identification module obtains M memory occupied sizes of the latest storage of the application 2 from the storage;
s416, the memory size identification module calculates the required size of the memory at the next startup based on the latest stored occupied sizes of M memories.
S417, the memory size identification module stores the size required by the memory when the application 2 is started next time in the memory.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by functions and internal logic of the process, and should not constitute any limitation to the implementation process of the embodiments of the present application.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments may be implemented.
Embodiments of the present application further provide a computer program product, which, when run on an electronic device, enables the electronic device to implement the steps in the above method embodiments.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above may be implemented by a computer program instructing related hardware to execute the computer program, and the computer program may be stored in a computer readable storage medium, and when executed by a processor, may implement the steps of the embodiments of the methods described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or apparatus capable of carrying computer program code to a first device, including recording media, computer Memory, read-Only Memory (ROM), random-Access Memory (RAM), electrical carrier signals, telecommunications signals, and software distribution media. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
An embodiment of the present application further provides a chip system, where the chip system includes a processor, the processor is coupled to the memory, and the processor executes a computer program stored in the memory to implement the steps of any of the method embodiments of the present application. The chip system may be a single chip or a chip module composed of a plurality of chips.
In the above embodiments, the description of each embodiment has its own emphasis, and reference may be made to the related description of other embodiments for parts that are not described or recited in any embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and method steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the technical solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (17)

1. A searching and killing method is characterized by comprising the following steps:
the electronic equipment monitors a first event, wherein the first event is related to the starting of a first application;
the electronic equipment acquires the required size of the memory of the first application during starting, wherein the required size of the memory is determined by the occupied size of the memory during historical starting of the first application;
and if the difference value between the residual space of the memory of the electronic equipment and the required size of the memory is smaller than or equal to a first threshold value, the electronic equipment checks and kills the application program running in the background.
2. The method of claim 1, wherein the method further comprises:
the electronic equipment monitors a second event, wherein the second event is related to whether the memory occupation size of the first application is stable or not when the first application is started;
the electronic equipment samples the memory occupation size of the first application to obtain a plurality of sampling data;
the electronic equipment obtains the memory occupation size of the first application when the first application is started according to the plurality of sampling data, and stores the memory occupation size of the first application when the first application is started, wherein the memory occupation size of the first application when the first application is started is used for determining the memory required size of the first application when the first application is started next time.
3. The method according to claim 2, wherein obtaining, by the electronic device, the memory occupation size of the first application at the time of the current startup according to the plurality of sampling data comprises:
and the electronic equipment calculates the data characteristic values of the plurality of sampling data, and the occupied memory size of the first application when the first application is started at this time is the data characteristic values of the plurality of sampling data.
4. The method of claim 3, wherein the electronic device calculating the data characteristic value for the plurality of sample data comprises:
the electronic equipment removes the maximum value and the minimum value of the plurality of sampling data to obtain a plurality of screening data;
the electronic equipment calculates data characteristic values of the plurality of screening data, and the data characteristic values of the plurality of sampling data are the data characteristic values of the plurality of screening data.
5. The method of claim 4, wherein prior to the electronic device calculating the data characteristic values for the plurality of filtered data, the method further comprises:
the electronic device calculating standard deviations of the plurality of screening data;
the electronic device determines that a standard deviation of the plurality of screening data is less than a first value.
6. The method according to any one of claims 2 to 5, wherein after the electronic device stores the memory footprint size of the first application at the time of the startup, the method further comprises:
the electronic equipment acquires a plurality of memory occupation sizes of the latest storage belonging to the first application;
and the electronic equipment performs sliding window filtering on the multiple memory occupation sizes to obtain an average value of the multiple memory occupation sizes, wherein the average value of the multiple memory occupation sizes is the size required by the memory when the first application is started next time.
7. The method of claim 6, wherein prior to the electronic device sliding window filtering the plurality of memory footprint sizes, the method further comprises:
the electronic device determines that the number of the occupied sizes of the plurality of memories is greater than or equal to 5.
8. The method of claim 7, wherein the method further comprises:
the electronic equipment determines that the number of the occupied sizes of the plurality of memories is less than 5;
the electronic device calculates an average value of the memory occupation sizes.
9. The method of any of claims 2 to 8, wherein the first event comprises: an event of starting the launch of the first application; the second event comprises: the top Activity of the first application launches the completed event.
10. The method of claim 9, wherein after the electronic device hears the second event, the method further comprises:
and if the memory residual space of the electronic equipment is smaller than or equal to a second threshold value, the electronic equipment kills the application program running in the background, wherein the second threshold value is smaller than or equal to the first threshold value.
11. The method of claim 10, wherein the second threshold is less than the first threshold;
the searching and killing threshold of the electronic equipment comprises a first level threshold and a second level threshold, the second level threshold is higher than the first level threshold, the second level threshold comprises the first threshold and the second threshold, and the first level threshold comprises a third threshold and a fourth threshold;
if the difference between the residual memory space of the electronic device and the required size of the memory is smaller than or equal to a first threshold, the electronic device performs searching and killing on the application program running in the background, including:
if the difference value between the residual space of the memory of the electronic equipment and the required size of the memory is smaller than or equal to a first threshold value and larger than a third threshold value, the electronic equipment conducts searching and killing on a first type of application program running in the background;
and if the difference value between the residual space of the memory of the electronic equipment and the required size of the memory is smaller than or equal to the third threshold, the electronic equipment checks and kills the first type of application programs and the second type of application programs running in the background, and the keep-alive requirement of the second type of application programs is greater than that of the first type of application programs.
12. The method of claim 11, wherein if the remaining memory space of the electronic device is less than or equal to a second threshold, the electronic device killing the application running in the background comprises:
if the memory residual space of the electronic equipment is smaller than or equal to the second threshold and larger than the fourth threshold, the electronic equipment checks and kills the first type of application program running in the background;
if the memory residual space of the electronic device is smaller than or equal to the fourth threshold, the electronic device performs searching and killing on the first type of application program and the second type of application program running in the background, and the fourth threshold is smaller than the third threshold.
13. The method of claim 10, wherein prior to the electronic device obtaining the required size of the memory of the first application at startup, the method further comprises:
the electronic device determines a required size of a memory in the electronic device, where the first application is stored, where the second threshold is equal to the first threshold.
14. The method of claim 10, wherein the method further comprises:
the electronic device monitors a first event;
the electronic equipment determines the size required by a memory which does not store the first application in the electronic equipment;
the electronic equipment acquires the memory setting size of the first application, the memory setting size of the first application is the pre-estimated memory consumption size when the first application is started, the second threshold is smaller than the first threshold, the checking and killing threshold of the electronic equipment comprises a first-level threshold and a second-level threshold, the second-level threshold is higher than the first-level threshold, the second-level threshold comprises the first threshold and the second threshold, and the first-level threshold comprises a third threshold and a fourth threshold;
if the difference value between the residual space of the memory of the electronic equipment and the set size of the memory is smaller than or equal to the first threshold value and larger than the third threshold value, the electronic equipment checks and kills the first type of application program running in the background;
and if the difference value between the residual memory space of the electronic equipment and the set memory size is smaller than or equal to the third threshold, the electronic equipment checks and kills the first type of application programs and the second type of application programs running in the background, and the keep-alive requirement of the second type of application programs is larger than that of the first type of application programs.
15. The method of claim 14, wherein the method further comprises:
after the electronic equipment monitors the second event, if the remaining memory space of the electronic equipment is smaller than or equal to the second threshold and larger than the fourth threshold, the electronic equipment checks and kills the first type of application programs running in the background;
if the memory residual space of the electronic device is smaller than or equal to the fourth threshold, the electronic device performs searching and killing on the first type of application program and the second type of application program running in the background, and the fourth threshold is smaller than the third threshold.
16. An electronic device, characterized in that the electronic device comprises a processor for executing a computer program stored in a memory, so that the electronic device implements the method according to any of claims 1 to 15.
17. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by one or more processors, implements the method of any one of claims 1 to 15.
CN202210986404.7A 2022-08-17 2022-08-17 Searching and killing method, electronic equipment and readable storage medium Active CN115437783B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210986404.7A CN115437783B (en) 2022-08-17 2022-08-17 Searching and killing method, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210986404.7A CN115437783B (en) 2022-08-17 2022-08-17 Searching and killing method, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN115437783A true CN115437783A (en) 2022-12-06
CN115437783B CN115437783B (en) 2023-08-04

Family

ID=84241705

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210986404.7A Active CN115437783B (en) 2022-08-17 2022-08-17 Searching and killing method, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN115437783B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150058867A1 (en) * 2012-11-20 2015-02-26 Huizhou Tcl Mobile Communication Co., Ltd. Method, an electronic device, and a storage medium for auto-cleaning up applications in a background
CN105824673A (en) * 2016-03-21 2016-08-03 乐视网信息技术(北京)股份有限公司 Method and device for operating application program
CN105975348A (en) * 2016-05-31 2016-09-28 宇龙计算机通信科技(深圳)有限公司 Memory optimization method, optimization device and terminal
CN106528216A (en) * 2016-10-26 2017-03-22 深圳市金立通信设备有限公司 Method for starting application and terminal
CN107346285A (en) * 2017-05-26 2017-11-14 郑州云海信息技术有限公司 A kind of method for detecting memory leakage and device
CN110221921A (en) * 2019-06-13 2019-09-10 深圳Tcl新技术有限公司 EMS memory management process, terminal and computer readable storage medium
CN112363841A (en) * 2020-11-27 2021-02-12 Oppo(重庆)智能科技有限公司 Application process searching and killing method and device, electronic equipment and storage medium
CN112882804A (en) * 2016-08-17 2021-06-01 华为技术有限公司 Method and device for starting application
CN113434288A (en) * 2021-06-16 2021-09-24 荣耀终端有限公司 Memory management method and electronic equipment
CN113626203A (en) * 2021-08-27 2021-11-09 广东九联科技股份有限公司 Memory environment real-time optimization method and system for android system
CN113986559A (en) * 2021-12-24 2022-01-28 荣耀终端有限公司 Memory management method and related device

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150058867A1 (en) * 2012-11-20 2015-02-26 Huizhou Tcl Mobile Communication Co., Ltd. Method, an electronic device, and a storage medium for auto-cleaning up applications in a background
CN105824673A (en) * 2016-03-21 2016-08-03 乐视网信息技术(北京)股份有限公司 Method and device for operating application program
CN105975348A (en) * 2016-05-31 2016-09-28 宇龙计算机通信科技(深圳)有限公司 Memory optimization method, optimization device and terminal
CN112882804A (en) * 2016-08-17 2021-06-01 华为技术有限公司 Method and device for starting application
CN106528216A (en) * 2016-10-26 2017-03-22 深圳市金立通信设备有限公司 Method for starting application and terminal
CN107346285A (en) * 2017-05-26 2017-11-14 郑州云海信息技术有限公司 A kind of method for detecting memory leakage and device
CN110221921A (en) * 2019-06-13 2019-09-10 深圳Tcl新技术有限公司 EMS memory management process, terminal and computer readable storage medium
CN112363841A (en) * 2020-11-27 2021-02-12 Oppo(重庆)智能科技有限公司 Application process searching and killing method and device, electronic equipment and storage medium
CN113434288A (en) * 2021-06-16 2021-09-24 荣耀终端有限公司 Memory management method and electronic equipment
CN113626203A (en) * 2021-08-27 2021-11-09 广东九联科技股份有限公司 Memory environment real-time optimization method and system for android system
CN113986559A (en) * 2021-12-24 2022-01-28 荣耀终端有限公司 Memory management method and related device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
EUNHWAN SHIN等: "Strata: Wait-Free Synchronization with Efficient Memory Reclamation by Using Chronological Memory Allocation", vol. 6786, pages 217 *
曹钱益: "面向移动终端的电源管理与能耗优化研究", no. 3, pages 032 - 37 *

Also Published As

Publication number Publication date
CN115437783B (en) 2023-08-04

Similar Documents

Publication Publication Date Title
US11244672B2 (en) Speech recognition method and apparatus, and storage medium
CN108320751B (en) Voice interaction method, device, equipment and server
CN108132790B (en) Method, apparatus and computer storage medium for detecting a garbage code
CN113448482B (en) Sliding response control method and device of touch screen and electronic equipment
KR20200015000A (en) Method for memory leak detection and electronic device thereof
JP2020511055A (en) Application control method and application control device
CN115858046B (en) Method for preloading memory pages, electronic equipment and chip system
CN114879894B (en) Function starting method, user interface and electronic equipment
CN112667844A (en) Method, device, equipment and storage medium for retrieving audio
CN111613213A (en) Method, device, equipment and storage medium for audio classification
CN112233689A (en) Audio noise reduction method, device, equipment and medium
CN111416996A (en) Multimedia file detection method, multimedia file playing device, multimedia file equipment and storage medium
CN112233688B (en) Audio noise reduction method, device, equipment and medium
CN114077519B (en) System service recovery method and device and electronic equipment
CN115437783B (en) Searching and killing method, electronic equipment and readable storage medium
CN117135721A (en) Network access method and terminal equipment
CN115601031A (en) Recommendation method and device for card resources, electronic equipment and storage medium
WO2021254294A1 (en) Method for switching audio output channel, apparatus, and electronic device
CN111028846B (en) Method and device for registration of wake-up-free words
CN115878500A (en) Memory recovery method and device, electronic equipment and readable storage medium
CN113593563A (en) Voice processing method, remote controller and system
CN116048679B (en) Layer processing method, electronic equipment and readable storage medium
CN116707050B (en) Method and device for recording charge and discharge times, electronic equipment and readable storage medium
CN115562742B (en) Application starting method, electronic device and readable storage medium
CN115543470B (en) Application starting method, electronic device and readable 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
GR01 Patent grant
GR01 Patent grant