WO2023051056A1 - 内存管理方法、电子设备、计算机存储介质和程序产品 - Google Patents

内存管理方法、电子设备、计算机存储介质和程序产品 Download PDF

Info

Publication number
WO2023051056A1
WO2023051056A1 PCT/CN2022/112034 CN2022112034W WO2023051056A1 WO 2023051056 A1 WO2023051056 A1 WO 2023051056A1 CN 2022112034 W CN2022112034 W CN 2022112034W WO 2023051056 A1 WO2023051056 A1 WO 2023051056A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
memory
application
application program
priority
Prior art date
Application number
PCT/CN2022/112034
Other languages
English (en)
French (fr)
Inventor
许虎
李宗峰
尚小京
王辉
王硕
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023051056A1 publication Critical patent/WO2023051056A1/zh

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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • 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]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present disclosure relates to the field of computers, and more specifically, to memory management methods, electronic equipment, computer storage media and program products.
  • Embodiments of the present disclosure provide an efficient memory management solution.
  • a memory management method includes: the electronic device determines the first available memory of the electronic device; if the first available memory is lower than the first set value, the electronic device determines at least based on the occupied memory of each of the multiple application programs in the background state The killing priorities of the multiple applications; and the electronic device kills at least one of the multiple applications based on the killing priorities of the multiple applications. Specifically, the larger the memory occupied by the application, the higher the killing priority of the application. That is, you can give priority to killing applications that take up a lot of memory.
  • the electronic device of the embodiment of the present disclosure can kill at least one application program in the background state in a timely manner at least based on the occupied memory when the available memory is lower than the first set value, so that the memory of at least one application program can be released. Occupancy, to ensure the available memory of the electronic device, so as to ensure the smoothness of the user's use of the electronic device and improve the user experience.
  • determining the first available memory includes: the electronic device periodically determines the first available memory based on the first cycle; Above the first set value, the electronic device determines the first available memory.
  • the electronic device in the embodiment of the present disclosure can determine the available memory based on the first period or based on the application program to be started, which can make the solution more targeted and avoid causing too much damage to the normal use of the user due to memory judgment. Influence.
  • the killing priority of each of the multiple applications is determined based on at least one of the following: the positions of the multiple applications in the background application list, the positions of the multiple applications in the preset The number of uses within a set duration, or the time spent when multiple applications are launched.
  • the positions of multiple application programs in the background application program list may be determined based on the sequence in which each of the multiple application programs switched from the foreground state to the background state for the last time. Specifically, the earlier the application program switched from the foreground state to the background state for the last time, the fewer times it is used within a preset period of time, and the shorter the time it takes to start, the higher the killing priority.
  • the total score of each level the larger the memory usage, the higher the score corresponding to this parameter; the higher the position in the background application list, the higher the score corresponding to this parameter; within the preset duration
  • the higher the total score the higher the priority of being killed.
  • the four parameters of occupied memory, position in the background application list, number of times used and startup time may have preset weights respectively. According to the preset weights, the scores corresponding to these four parameters can be weighted, so as to obtain the total score representing the killing priority.
  • the electronic device can determine the killing priority of the application program based on multiple factors, so that more comprehensive considerations are taken when killing the application program.
  • the electronic device determines the killing priority of each application program based on the preset weight, which is simple, efficient and easy to implement.
  • the method further includes: the electronic device adds related information of at least one application program that has been killed to the information list.
  • the relevant information of at least one application program includes information about at least one of the following: identification, memory usage after startup, number of times it is used within a preset period of time, or information about when it was last started time consuming.
  • the electronic device adds the information of the killed application program to the information list, so as to facilitate subsequent restoration of the application program.
  • the electronic device determines the second available memory of the electronic device; if the second available memory is higher than the second set value, the electronic device at least based on the startup of each application program in the information list Occupying memory, determining the starting priority of each application program in the information list, the second set value is higher than the first set value; and the electronic device starts one or more of the application programs in the background at least based on the starting priority of each application program Multiple applications.
  • the electronic device kills the application program, it can also restore the killed application program, avoiding the time-consuming restart when the user uses it again, so that the solution of the embodiment of the present disclosure can improve user experience.
  • determining the second available memory includes: the electronic device periodically determines the second available memory based on the second cycle; or, if it is determined that there is an exited application and the memory released by the exited application If the memory is higher than the first set value, determine the second available memory.
  • determining the startup priority includes: if the second available memory is higher than the second set value and at least one of the following is satisfied, the electronic device determines the startup priority: the processor occupancy rate is lower than The first threshold, the input/output bandwidth occupancy rate is lower than the second threshold, or the network bandwidth occupancy rate is lower than the third threshold.
  • the electronic device takes more comprehensive considerations when restoring the application program, and can ensure that the restoration of the application program will not affect or interrupt the ongoing operation of the user, thereby ensuring user experience.
  • the starting priority of each application program in the information list is determined based on at least one of the following: the position of each application program in the information list, and the use of each application program within a preset period of time times, or the elapsed time each application was last launched.
  • the position of each application program in the information list may be determined based on the sequence in which each application program is added to the information list from the background state. Specifically, the smaller the memory occupied after startup, the later it is added to the information list, the more times it is used within a preset time period, and the longer it takes to start, the higher the startup priority.
  • At least one of the memory occupied after startup, the position in the information list, the number of times it is used, and the time spent when it was last started has a preset value. Set weights.
  • the electronic device can determine the starting priority of the application program based on multiple factors, so that the consideration when starting the application program is more comprehensive. And the starting priority of each application program is determined based on the preset weight, which is simple, efficient and easy to implement.
  • a memory management device configured to include: a determination module configured to determine a first available memory of the electronic device; a determination module further configured to, if the first available memory is lower than a first set value, at least based on the number of applications in the background state The occupied memory of each application program determines the respective killing priorities of the multiple applications; and the killing application module is configured to at least one of the multiple application programs based on the respective killing priorities of the multiple application programs App kills.
  • the determining module is configured to periodically determine the first available memory based on the first period; or, if it is detected that the memory occupied by the application program in the state to be started is higher than the first Set the value to determine the first available memory.
  • the killing priority of each of the multiple applications is determined by the determining module based on at least one of the following: the positions of the multiple applications in the background application list, the respective positions of the multiple applications The number of times of use within a preset time period, or the time spent when multiple applications are launched.
  • the determining module determines the respective killing priorities of the multiple applications, at least one of the occupied memory, the position in the background application list, the number of times used and the time-consuming Each has a preset weight.
  • an adding list module configured to: add related information of at least one application program that has been killed to the information list.
  • the relevant information of at least one application program includes information about at least one of the following: identification, memory usage after startup, number of times it is used within a preset period of time, or information about when it was last started time consuming.
  • a starting application module further comprising a starting application module, a determining module further configured to determine a second available memory of the electronic device; and if the second available memory is higher than a second set value, at least based on the information
  • Each application program in the list occupies memory after starting, and determines the startup priority of each application program in the information list, and the second set value is higher than the first set value; and the start application program module is configured to at least be based on each application program
  • One or more applications in the information list are launched in the background by the startup priority.
  • the determining module is configured to periodically determine the second available memory based on the second period; or, if it is determined that there is an exited application and the memory released by the exited application is higher than the first A set value determines the second available memory.
  • the determination module is configured to determine the startup priority if the second available memory is higher than the second set value and at least one of the following is satisfied: the processor occupancy is lower than the first threshold , the input/output bandwidth occupancy rate is lower than the second threshold, or the network bandwidth occupancy rate is lower than the third threshold.
  • the starting priority of each application program in the information list is also determined by the determination module based on at least one of the following: the position of each application program in the information list, the time of each application program within a preset duration The number of times it was used, or the time it took each application to be launched the last time.
  • the determination module determines the startup priority
  • at least one of the memory occupied after startup, the position in the information list, the number of times it is used, and the time spent when it was last started are respectively Has a preset weight.
  • an electronic device including a processor and a memory, the memory stores instructions executed by the processor, and when the instructions are executed by the processor, the electronic device realizes the above first aspect or any implementation thereof The operation of the method in the example.
  • a computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by an electronic device, the above-mentioned first aspect or any implementation thereof is implemented.
  • a chip or system-on-a-chip includes a processing circuit configured to perform operations according to the method in the above first aspect or any embodiment thereof.
  • a computer program or computer program product is provided.
  • the computer program or computer program product is tangibly stored on a computer-readable medium and includes computer-executable instructions which, when executed by a computer, implement operations according to the method in the above-mentioned first aspect or any of its embodiments .
  • FIG. 1 shows a schematic diagram of a scenario where an application program occupies memory
  • FIG. 2 shows a schematic block diagram of an electronic device in which embodiments of the present disclosure can be implemented
  • FIG. 3 shows a software structural block diagram of an electronic device with an Android system with a layered architecture in which an embodiment of the present disclosure can be implemented;
  • FIG. 4 shows a schematic flowchart of a memory management process according to some embodiments of the present disclosure
  • FIG. 5 shows a schematic flowchart of a process of restarting at least one application program that has been killed according to some embodiments of the present disclosure
  • Fig. 6 shows a schematic flowchart of a process of determining startup priority according to some embodiments of the present disclosure.
  • FIG. 1 shows a schematic diagram of a scenario 100 in which an application program occupies memory.
  • the internal memory can include chip reservation 110, kernel 120, anonymous page 131, compressed anonymous page 132, compressed anonymous page extension 133, file page and free (free) memory 140, wherein anonymous page 131, compressed anonymous page 132 and compressed anonymous page extension 133 may be collectively referred to as total anonymous page distribution 130 .
  • application programs 150 such as APP1 to APP6 shown in FIG. 1
  • the application programs in the foreground state or the background state will occupy memory, specifically will occupy the total anonymous page distribution 130.
  • the embodiments of the present disclosure provide a memory management solution, which can kill applications in the background state to release memory when memory is insufficient, and can also kill applications that are killed when memory is sufficient Restart, so that the user experience can be guaranteed.
  • FIG. 2 shows a schematic block diagram of an electronic device 200 in which embodiments of the present disclosure may be implemented.
  • the electronic device 200 may include a processor 210, an external memory interface 292, an internal memory 296, a subscriber identity module (Subscriber Identification Module, SIM) card interface 294, a display screen 220, a camera 222, an indicator 224, a motor 226, button 228, universal serial bus (Universal Serial Bus, USB) interface 230, charging manager module 240, power management module 242, battery 244, mobile communication module 250, antenna 252, wireless communication module 260, antenna 262, audio Module 270, speaker 272, receiver 274, microphone 276, earphone interface 278, sensor module 280 and so on.
  • a processor 210 an external memory interface 292, an internal memory 296, a subscriber identity module (Subscriber Identification Module, SIM) card interface 294, a display screen 220, a camera 222, an indicator 224, a motor 226, button 228, universal serial bus (Universal Serial Bus, USB) interface 230, charging manager module 240, power management module 242, battery 244, mobile communication module 250, antenna 252, wireless communication module 260, antenna 262, audio Module
  • the sensor module 280 includes a pressure sensor 2802, a gyro sensor 2804, an air pressure sensor 2806, a magnetic sensor 2808, an acceleration sensor 2810, a distance sensor 2812, a proximity light sensor 2814, a fingerprint sensor 2816, a temperature sensor 2818, a touch sensor 2820 and an ambient light sensor 2822 et al.
  • FIG. 2 is only illustrative, and the electronic device 200 may include more or fewer components, or multiple components may be combined into one component, or one component may be split into multiple components. , or a combination of the above, etc.
  • the components shown in FIG. 2 can be implemented by hardware, software, or a combination of software and hardware.
  • the processor 210 may include one or more processing units, for example, may include a central processing unit (Central Processing Unit, CPU), an application processor (Application Processor, AP), a modem processor, a graphics processing unit (Graphics Processing Unit, GPU), image signal processor (Image Signal Processor, ISP), controller, video codec, digital signal processor (Digital Signal Processor, DSP), baseband processor, and/or neural network processor (Neural-Network Processing Unit, NPU), etc., where different processing units can be independent devices or integrated in one or more processors.
  • CPU Central Processing Unit
  • AP Application Processor
  • modem processor a graphics processing unit
  • ISP image signal processor
  • controller video codec
  • digital signal processor Digital Signal Processor
  • DSP Digital Signal Processor
  • NPU neural network Processing Unit
  • a memory may also be provided in the processor 210 for storing instructions and data.
  • the memory in the processor 210 is a cache memory.
  • the memory may hold instructions or data that the processor 210 has just used or recycled. If the processor 210 needs to use the instruction or data again, it can be directly recalled from the memory. Repeated access is avoided, and the waiting time of the processor 210 is reduced, thereby improving the efficiency of the system.
  • the interface can include an integrated circuit (Inter-Integrated Circuit, I2C) interface, an integrated circuit built-in audio (Inter-Integrated Circuit Sound, I2S) interface, a pulse code modulation (Pulse Code Modulation, PCM) interface, a universal asynchronous transmitter (Universal Asynchronous Receiver/Transmitter, UART) interface, mobile industry processor interface (Mobile Industry Processor Interface, MIPI), general-purpose input/output (General-Purpose Input/Output, GPIO) interface, SIM card interface 294, and/or USB interface 230, etc.
  • I2C Inter-Integrated Circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM Pulse Code Modulation
  • UART Universal Asynchronous Receiver/Transmitter
  • MIPI Mobile Industry Processor Interface
  • GPIO General-purpose input/output
  • SIM card interface 294 SIM card interface 294, and/or USB interface 230, etc.
  • the electronic device 200 may also adopt an interface connection manner different from that described above, or may adopt a combination of various interface connection manners.
  • the charging management module 240 is configured to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 240 may receive a charging input from the wired charger through the USB interface 230 .
  • the charging management module 240 may receive a wireless charging input through a wireless charging coil of the electronic device 200 . While the charging management module 240 is charging the battery 244 , it can also supply power to the electronic device 200 through the power management module 242 .
  • the power management module 242 is used for connecting the battery 244 , the charging management module 240 and the processor 210 .
  • the power management module 242 receives the input from the battery 244 and/or the charging management module 240 to provide power for the processor 210 , internal memory 296 , display 220 , camera 222 and wireless communication module 260 .
  • the power management module 242 can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (such as leakage, impedance).
  • the power management module 242 can also be disposed in the processor 210 .
  • the power management module 242 and the charging management module 240 can also be set in the same device.
  • the wireless communication function of the electronic device 200 can be realized by the mobile communication module 250, the antenna 252, the wireless communication module 260, the antenna 262, the modem processor and the baseband processor.
  • the antenna 252 and the antenna 262 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 200 may be used to cover single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas.
  • antenna 252 may be multiplexed as a diversity antenna for a wireless local area network.
  • an antenna can be used in conjunction with a tuning switch.
  • the mobile communication module 250 can provide wireless communication solutions including 2G/3G/4G/5G applied on the electronic device 200 .
  • the mobile communication module 250 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA) and the like.
  • the mobile communication module 250 can receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and send them to the modem processor for demodulation.
  • the mobile communication module 250 can also amplify the signal modulated by the modem processor, convert it into electromagnetic wave and radiate it through the antenna 252 .
  • at least part of the functional modules of the mobile communication module 250 may be set in the processor 210 .
  • at least part of the functional modules of the mobile communication module 250 and at least part of the modules of the processor 210 may be set in the same device.
  • the modem processor may include a modulator and a demodulator, wherein the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal, and the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Then the demodulator sends the demodulated low-frequency baseband signal to the baseband processor for processing. The low-frequency baseband signal is passed to the application processor after being processed by the baseband processor.
  • the application processor outputs sound signals through audio equipment (not limited to speaker 272 , receiver 274 , etc.), or displays images or videos through display screen 220 .
  • the modem processor may be a stand-alone device. In other scenarios, the modem processor may be independent of the processor 210, and be set in the same device as the mobile communication module 250 or other functional modules.
  • the wireless communication module 260 can provide wireless communication solutions including wireless local area network (Wireless Local Area Network, WLAN) applied on the electronic device 200, such as Wi-Fi network, BT, Global Navigation Satellite System (Global Navigation Satellite System, GNSS ), FM (Frequency Modulation, FM), NFC, infrared technology (infrared, IR).
  • the wireless communication module 260 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 260 receives electromagnetic waves via the antenna 262 , frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 210 .
  • the wireless communication module 260 can also receive the signal to be transmitted from the processor 210 , frequency-modulate and amplify it, and convert it into electromagnetic waves through the antenna 262 for radiation.
  • the antenna 252 of the electronic device 200 is coupled to the mobile communication module 250, and the antenna 262 is coupled to the wireless communication module 260, so that the electronic device 200 can communicate with the network and/or other devices through wireless communication technology.
  • the wireless communication technologies here can include Global System For Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), broadband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technologies, etc.
  • the electronic device 200 realizes the display function through the GPU, the display screen 220 , and the application processor.
  • GPU is a microprocessor for image processing, connected to display screen 220 and application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 210 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 220 is used for displaying text, images, videos and the like.
  • the display screen 220 includes a display panel, and the display panel can be a liquid crystal display (Liquid Crystal Display, LCD), an organic light-emitting diode (Organic Light-Emitting Diode, OLED), an active matrix organic light-emitting diode or an active matrix organic light-emitting diode.
  • Body Active-Matrix Organic Light Emitting Diode, AMOLED
  • Flexible Light-Emitting Diode Flexible Light-Emitting Diode (Flex Light-Emitting Diode, FLED) Mini-LED, Micro-LED, Micro-OLED, Quantum Dot Light Emitting Diodes (QLED) wait.
  • the electronic device 200 may include one or more display screens 220 .
  • the electronic device 200 can realize the shooting function through the ISP, the camera 222 , the video codec, the GPU, the display screen 220 , and the application processor.
  • the ISP is used for processing data fed back by the camera 222 .
  • the light is transmitted to the photosensitive element of the camera through the lens, and the optical signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some scenarios, the ISP may be located in the camera 222 .
  • Camera 222 is used to capture still images or video.
  • the object generates an optical image through the lens and projects it to the photosensitive element.
  • the photosensitive element can be a charge coupled device (Charge Coupled Device, CCD) or a complementary metal oxide semiconductor (Complementary Metal-Oxide-Semiconductor, CMOS) phototransistor.
  • CCD Charge Coupled Device
  • CMOS complementary metal oxide semiconductor
  • the photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other image signals.
  • the electronic device 200 may include one or more cameras 222 .
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 200 selects a frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 200 may support one or more video codecs.
  • the electronic device 200 can play or record videos in various encoding formats, for example, moving picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
  • MPEG moving picture experts group
  • NPU is a neural network (Neural-Network, NN) computing processor.
  • NN neural network
  • Applications such as intelligent cognition of the electronic device 200 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the indicator 224 can be an indicator light, and can be used to indicate charging status, power change, and can also be used to indicate messages, missed calls, notifications, and the like.
  • the motor 226 can generate a vibrating alert.
  • the motor 226 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback.
  • touch operations applied to different applications may correspond to different vibration feedback effects.
  • the motor 226 can also correspond to different vibration feedback effects for touch operations acting on different areas of the display screen 20 .
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the keys 228 include a power key, a volume key and the like.
  • the button 228 can be a mechanical button or a touch button.
  • the electronic device 200 may receive key input and generate key signal input related to user settings and function control of the electronic device 200 .
  • the SIM card interface 294 is used for connecting a SIM card.
  • the SIM card can be connected and separated from the electronic device 200 by inserting it into the SIM card interface 294 or pulling it out from the SIM card interface 294 .
  • the electronic device 200 can support one or more SIM card interfaces 294 .
  • SIM card interface 294 can support Nano SIM card, Micro SIM card, mini SIM card etc. Multiple cards can be inserted into the same SIM card interface 294 at the same time, and the types of multiple cards can be the same or different.
  • the SIM card interface 294 is also compatible with different types of SIM cards.
  • the SIM card interface 294 is also compatible with external memory cards.
  • the electronic device 200 interacts with the network through the SIM card to implement functions such as calling and data communication. In some scenarios, the electronic device 200 uses an embedded SIM (embedded SIM, eSIM) card, and the eSIM card can be embedded in the electronic device 200 and cannot be separated from the electronic device 200.
  • embedded SIM embedded SIM
  • eSIM embedded SIM
  • the external memory interface 292 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 200.
  • the external memory card communicates with the processor 210 through the external memory interface 292 to realize the data storage function. Such as saving music, video and other files in the external memory card.
  • Internal memory 296 may be used to store computer-executable program code, including instructions.
  • the internal memory 296 may include an area for storing programs and an area for storing data.
  • the storage program area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function) and the like.
  • the storage data area can store data (such as audio data, phone book) etc. created during the use of the electronic device 200 .
  • the internal memory 296 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (Universal Flash Storage, UFS) and the like.
  • the processor 210 executes various functional applications and data processing of the electronic device 200 by executing instructions stored in the internal memory 296 and/or instructions stored in a memory provided in the processor.
  • the electronic device 200 can implement audio functions through an audio module 270 , a speaker 272 , a receiver 274 , a microphone 276 , an earphone interface 278 , and an application processor. Such as music playback, recording, etc.
  • the audio module 270 is used to convert digital audio signals into analog audio signals for output, and is also used for converting analog audio input into digital audio signals.
  • the audio module 270 may also be used to encode and decode audio signals.
  • the audio module 270 may be set in the processor 210 , or some functional modules of the audio module 270 may be set in the processor 210 .
  • Receiver 274 also called “earpiece” is used to convert audio electrical signals into audio signals.
  • the receiver 274 can be placed close to the human ear to listen to the voice.
  • Microphone 276, also called “microphone” or “microphone”, is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by approaching the microphone 276 with a human mouth, and input the sound signal to the microphone 276 .
  • the electronic device 200 may be provided with at least one microphone 276 .
  • the electronic device 200 may be provided with two microphones 276, which may also implement a noise reduction function in addition to collecting sound signals.
  • the electronic device 200 can also be provided with three, four or more microphones 276 to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions, etc.
  • the earphone interface 278 is used for connecting wired earphones.
  • the headphone interface 278 can be a USB interface 230, or a 3.5mm open mobile terminal platform (open mobile terminal platform, OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface, etc. .
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 2802 is used to sense the pressure signal and convert the pressure signal into an electrical signal.
  • the pressure sensor 2802 may be disposed on the display screen 220 .
  • the type of the pressure sensor 2802 may be a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like.
  • the gyro sensor 2804 can be used to determine the motion posture of the electronic device 200 .
  • Air pressure sensor 2806 may be used to measure air pressure.
  • the magnetic sensor 2808 includes a Hall sensor.
  • the electronic device 200 can use the magnetic sensor 2808 to detect the opening and closing of the flip leather case.
  • the acceleration sensor 2810 can be used to detect the acceleration of the electronic device 200 in various directions (generally three axes).
  • a distance sensor 2812 may be used to measure distance.
  • the electronic device 200 may measure the distance by infrared or laser. In a shooting scene, for example, the electronic device 200 can use the distance sensor 2812 to measure a distance to achieve fast focusing.
  • Proximity light sensor 2814 may include, for example, LEDs and light detectors, such as photodiodes.
  • the light emitting diodes may be infrared light emitting diodes.
  • the electronic device 200 emits infrared light through a light emitting diode, and uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it may be determined that there is an object near the electronic device 200 . When insufficient reflected light is detected, the electronic device 200 may determine that there is no object nearby.
  • the electronic device 200 can use the proximity light sensor 2814 to detect that the user holds the electronic device 200 close to the ear to make a call, so as to automatically turn off the display screen 220 to save power.
  • Proximity light sensor 2814 can also be used in leather case mode, automatic unlock and lock screen in pocket mode.
  • Fingerprint sensor 2816 may be used to capture fingerprints.
  • the electronic device 200 can use the collected fingerprint characteristics to implement fingerprint unlocking, access to the application lock, take pictures with the fingerprint, answer calls with the fingerprint, and the like.
  • a temperature sensor 2818 may be used to detect temperature.
  • the touch sensor 2820 is also called “touch device” or “touch panel”.
  • the touch sensor 2820 can be disposed on the display screen 220 , and the touch sensor 2820 and the display screen 220 form a touch screen.
  • the touch sensor 2820 is used to detect a touch operation on or near it.
  • the touch sensor 2820 can transmit the detected touch operation to the application processor to determine the type of the touch event.
  • Visual output related to the touch operation can be provided through the display screen 220 .
  • the touch sensor 2820 may also be disposed on the surface of the electronic device 200 , which is different from the position of the display screen 220 .
  • the ambient light sensor 2822 is used for sensing ambient light brightness.
  • the electronic device 200 can adaptively adjust the brightness of the display screen 220 according to the perceived ambient light brightness.
  • the ambient light sensor 2822 can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 2822 can also cooperate with the proximity light sensor 2814 to detect whether the electronic device 200 is in the pocket, so as to prevent accidental touch.
  • the sensor module 280 may further include an infrared sensor, an ultrasonic sensor, an electric field sensor, etc., for assisting the electronic device 200 in recognizing gestures in the air.
  • electronic device 200 in FIG. 2 is only schematic, and it may include more or less components when it is implemented as a different type of device.
  • electronic device 200 may not have SIM card interface 294 when implemented as a laptop computer.
  • the software system of the electronic device 200 may adopt a layered architecture, a Harmony OS architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture.
  • FIG. 3 shows a software structural block diagram of an electronic device 300 with an Android system having a layered architecture in which embodiments of the present disclosure can be implemented.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate through software interfaces. As shown in FIG. 3 , the Android system can be divided into four layers, which are an application program layer 310 , an application program framework layer 320 , a kernel layer 330 , and a network transport layer 340 from top to bottom.
  • the application layer 310 may include a series of application packages, including but not limited to camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications (Application, APP).
  • the application framework layer 320 provides an application programming interface (Application Programming Interface, API) and a programming framework for the applications of the application program layer 310.
  • the application framework layer 320 may include some predefined functions, including but not limited to window manager, content provider, view system, phone manager, resource manager, notification manager and so on.
  • a window manager is used to manage window programs.
  • the window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc.
  • Content providers are used to store and retrieve data and make it accessible to applications.
  • Data can include video, images, audio, calls made and received, browsing history and bookmarks, phonebook, and more.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on.
  • the view system can be used to build applications.
  • a display interface can consist of one or more views.
  • a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide communication functions of the electronic device 300 . For example, the management of call status (including connected, hung up, etc.).
  • the resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
  • the notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also be a notification that appears on the top status bar of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device 300 vibrates, and the indicator light flashes, etc.
  • the kernel layer 330 includes at least a display driver, a camera driver, an audio driver, and a transmission driver. Different drivers of the kernel layer 330 are used to call hardware devices of the electronic device 300 to perform corresponding operations.
  • the display driver is used to support the interface display of the electronic device 300, etc.
  • the audio driver is used to support the electronic device 300 to play audio, etc.
  • the transmission driver is used to support content sharing between the electronic device 300 and another electronic device.
  • the network transport layer 340 may be used for communication, data transmission, etc. between the electronic device 300 and another electronic device. It may include: a Bluetooth module, a Wi-Fi module, an NFC module, a discovery connection module, a pairing module, and a connection transmission module.
  • the discovery connection module can be used to discover another electronic device that can establish a communication connection.
  • the pairing module can be used to authenticate another electronic device that requests to establish a connection during the process of establishing a communication connection.
  • the connection transmission module can be used to transmit data or messages, instructions, etc. with another electronic device that has established a connection.
  • the electronic device 300 shown in FIG. 3 has an Android system
  • the present disclosure is not limited thereto.
  • embodiments of the present disclosure can also be applied to electronic devices with other operating systems.
  • the above-mentioned electronic device 200 and electronic device 300 are only illustrative, and should not be construed as limiting the following embodiments of the present disclosure.
  • FIG. 4 shows a schematic flowchart of a memory management process 400 according to some embodiments of the present disclosure.
  • the process 400 may be executed by an electronic device, such as the electronic device 200 shown in FIG. 2 or the electronic device 300 shown in FIG. 3 .
  • step 410 a first available memory of the electronic device is determined.
  • the electronic device may determine the first available memory periodically or based on an event trigger.
  • the first available memory may be determined periodically based on the first cycle.
  • a first timer may be set in the electronic device, and the first timer may have an initial value when started, and when the value of the first timer reaches a predetermined value, the first available memory is determined. Additionally or alternatively, after the value of the first timer reaches a predetermined value, it can be reset to an initial value and start counting again.
  • the initial value may be equal to 0, and the predetermined value may be equal to the first period.
  • the initial value may be equal to the first period, and the predetermined value may be equal to zero.
  • the value of the first period may be preset based on actual needs.
  • the electronic device may have a factory-set first period, or the user may adjust the first period according to his own needs, which is not limited in the present disclosure.
  • the first timer may be running.
  • the first timer may be running. That is to say, if the electronic device is turned on, but there is no application program in the background state, the first timer can be set to an initial value and stop running, that is, it does not count.
  • the first available memory can be determined based on the application program in the state to be started. Specifically, the memory occupied by the application program in the state to be started may be detected, and if it is determined that the memory occupied by the application program in the state to be started is higher than the first set value, then the first available memory is determined.
  • applications that occupy memory higher than the first set value after startup may be called large-memory applications, such as cameras or mobile games.
  • the first set value may be preset based on the total memory of the electronic device, the processing speed of the processor of the electronic device, and the like.
  • the form of the first setting value can be a specific memory size, and its dimension is MB or kB; or the form of the first setting value can be a ratio relative to the total memory, and its dimension is 1, such as a percentage form. This disclosure is not limited thereto.
  • the determined form of the first available memory may be a specific memory size, whose dimension is MB or kB, etc.; or the form of the first available memory may be a ratio relative to the total memory, whose dimension is 1, such as a percentage form.
  • This disclosure is not limited thereto. However, it should be understood that the first available memory and the first set value in the embodiment of the present disclosure have the same dimension.
  • the first available memory may represent the available memory in the total anonymous page distribution 130 (dimension is MB or kB, etc.) or the available memory in the total anonymous page distribution 130 relative to the total anonymous page distribution 130 proportion.
  • the first available memory may also represent other meanings, such as the amount available in the entire memory, which is not limited in the present disclosure.
  • step 412 it is determined whether the first available memory is lower than a first set value. If it is determined that the first available memory is not lower than the first set value, return to step 410 . If it is determined that the first available memory is lower than the first set value, step 420 is executed.
  • step 420 at least based on the occupied memory of each of the multiple application programs in the background state, the killing priority of each of the multiple application programs is determined.
  • the killing priority of each of the multiple application programs in the background state is determined.
  • the first available memory cannot guarantee the normal use of the application program in the startup state, and may not even guarantee the normal startup of the application program in the startup state.
  • multiple application programs in the background state have different occupied memory, so respective killing priorities may be determined based on the size of the occupied memory. For example, the application that takes up the most memory has the highest priority to be killed. For example, suppose there are three applications in the background state, wherein the memory occupied by application 1 is S1, the memory occupied by application 2 is S2, and the memory occupied by application 3 is S3. If S3>S1>S2, then application 3 has the first killing priority, application 1 has the second killing priority, and application 2 has the third killing priority.
  • determining the killing priority of multiple application programs in addition to being based on occupied memory, it can be further based on one or more of the following: multiple application programs are in the background application program list The location of the multiple application programs, the number of times each of the multiple application programs is used within a preset time period, or the time consumption of each of the multiple application programs when they are started.
  • the position of APP01 in the background application program list can be expressed as a serial number, such as 1, 2, ... and so on.
  • the location may be determined based on the time when APP01 was last used (last time it was in the foreground state). Specifically, the closer the last used time, the smaller the serial number of the location; on the contrary, the farther the last used time, the larger the serial number of the location. For example, suppose there are two applications in the background state: APP01 and APP02. The last time APP01 was used is closer, then the position of APP01 in the background application list is represented as 1, and APP02 is in the background application list. The position in is denoted as 2.
  • the number of times each of the multiple application programs are used within the preset time period may represent the number of times the applications are switched to the foreground state within the preset time period.
  • the preset duration may be a preset parameter, such as 10 minutes or 1 hour or other values.
  • the elapsed time of each of the multiple applications when they are started may represent the duration of the application from the unstarted state to the foreground state.
  • the time-consuming period may be the time period between when the user clicks the icon of the desktop application program and when the interface of the application program is displayed in full screen.
  • the time-consuming period may be the time period between when the user clicks the icon of the desktop application program and when the interface of the application program is presented and the number of words on the interface reaches the word-count threshold. Specifically, the number of words presented on the interface of the application program may be counted until the number of words reaches the word count threshold.
  • the time-consuming period may be the time period between when the user clicks the icon of the desktop application program and when the proportion of the content presented on the interface of the application program reaches the proportion threshold.
  • the ratio threshold could be 80% or 100% or other values. In this way, factors such as network conditions or processing speeds of electronic devices can be fully considered.
  • the position of the application program in the background application program list may be determined based on the order in which the application programs were last switched from the foreground state to the background state. And, the earlier the last switch from the foreground state to the background state, the higher the priority of being killed. In addition, the fewer times it is used within the preset duration, the higher the priority of being killed. The shorter the time it takes to be activated, the higher the priority of being killed.
  • the first score can be determined based on the memory usage of the application
  • the second score can be determined based on the position of the application in the background application list
  • the third score can be determined based on the number of times the application is used within a preset period of time.
  • Score the fourth score is determined based on the startup time of the application program, and the total score representing the killing priority can be obtained based on the first to fourth scores.
  • At least one of the occupied memory, the position in the background application list, the number of times used and the startup time has a preset weight respectively.
  • the application program in the background state may be referred to as background application program for short.
  • the score of each application in the multiple applications in the background state can be determined by the following formula, and the priority of killing can be determined based on the score, wherein a higher score indicates a higher priority of killing:
  • score k represents the score of the kth background application among multiple background applications
  • w1, w2, w3 and w4 represent weights respectively
  • w1+w2+w3+w4 1
  • mem k represents the kth background application
  • posorder k indicates the position of the kth background application in multiple background applications
  • postime k indicates the time-consuming from long to short based on the time when the kth background application is started
  • the position of the kth background application in multiple background applications The sorting among the background applications
  • posnumber k indicates the ordering of the kth background application among multiple background applications based on the number of uses within the preset time period from most to least
  • n1 indicates the ordering of multiple background applications quantity.
  • posorder k in Formula 1 its value ranges from 1 to n1.
  • postime k in Formula 1 its value ranges from 1 to n1.
  • posnumber k in Formula 1 its value ranges from 1 to n1.
  • step 430 at least one application program among the plurality of application programs is killed based on respective killing priorities of the plurality of application programs.
  • a preset number of applications with the highest killing priority can be killed if the first available memory is determined based on the first period in step 410.
  • the preset number can be any positive integer, such as 1.
  • an application program (in the background state) with the highest killing priority can be killed.
  • step 430 if the first available memory is determined based on the application program to be started in step 410, then in step 430, at least one application program with the highest killing priority can be killed, so that at least one application program is killed The subsequent memory satisfies the memory occupied by the application program in the state to be started after startup.
  • the memory occupied by the application program in the state to be started after startup can be represented as S01
  • the first available memory can be represented as S02
  • the application with the highest killing priority can be killed.
  • the memory occupied by the application with the highest killing priority is S21
  • the memory occupied by the application with the second highest killing priority is S22
  • S21+S02 ⁇ S01, S21+S22+S02> S01 then the application program with the highest killing priority and the application program with the second highest killing priority may be killed.
  • killing (killing) an application refers to closing a process of the application and releasing memory occupied by the application.
  • the killing priority is determined based on the occupied memory, so that when the available memory is insufficient, the application program occupying a large memory can be killed in time, so that the memory can be released more effectively. Business needs can be met more quickly when there are applications to launch.
  • the killing priority can also be determined based on the position in the background application list, so that when the memory is insufficient, the earlier used application can be killed first, because relatively speaking, the user may The re-use demand for the earlier used application program is low, so killing the earlier used application program has less impact on the user's use demand.
  • the killing priority can also be determined based on the number of uses, so that when the memory is insufficient, the infrequently used applications can be killed first, so as to prevent the user from using frequently used applications. The time consumption of restarting is required, which improves the user experience.
  • the killing priority can also be determined based on the startup time, so that when the memory is insufficient, the application with the short startup time can be killed first, preventing the user from using the killed application , it takes too long to wait for the startup time again, which improves the user experience.
  • the embodiments of the present disclosure can kill at least one application program in the background state based on the occupied memory of the application program in the background state when the memory of the electronic device is insufficient, so that the memory used by the electronic device can be determined, and the memory used by the electronic device can be avoided.
  • the performance of electronic equipment caused by insufficient memory is degraded or even unavailable, which improves the user experience.
  • the at least one application program in the background state may be killed, the at least one application program that has been killed may be restarted if the memory is sufficient.
  • FIG. 5 shows a schematic flowchart of a process 500 of restarting at least one application program that has been killed according to some embodiments of the present disclosure.
  • step 510 the relevant information of at least one application program that has been killed is added to the information list.
  • the relevant information of the application may include information about at least one of the following: identification, memory occupied after startup, number of times of use within a preset period of time, or time elapsed when the application was last started.
  • the identification may be expressed as the name of the application, an identifier of the application, or other forms.
  • the information list may include entries, and one entry corresponds to one application program.
  • step 520 a second available memory of the electronic device is determined.
  • the electronic device may determine the second available memory periodically or based on an event trigger.
  • the second available memory may be determined periodically based on the second period.
  • a second timer may be set in the electronic device, and the second timer may have an initial value when it is started, and when the value of the second timer reaches a predetermined value, the second available memory is determined. Additionally or alternatively, after the value of the second timer reaches a predetermined value, it can be reset to an initial value and start counting again.
  • the initial value may be equal to 0, and the predetermined value may be equal to the second period.
  • the initial value may be equal to the second period, and the predetermined value may be equal to zero.
  • the value of the second period may be preset based on actual needs.
  • the electronic device may have a factory-set second period, or the user may adjust the second period according to his own needs, which is not limited in the present disclosure.
  • the second timer may be running. In other words, when the information list is empty, the second timer may stop timing. When at least one application-related information is added to the information list, the second timer is started.
  • the second available memory can be determined based on application exit. Specifically, the memory occupied by the exited application program may be detected, and if it is determined that there is an exited application program and the memory released by the exited application program is higher than the first set value, then the second available memory is determined.
  • an application that occupies a memory higher than the first set value may be called a large-memory application, such as a camera or a mobile game.
  • the first set value may be preset based on the total memory of the electronic device, the processing speed of the processor of the electronic device, and the like.
  • the form of the first setting value can be a specific memory size, and its dimension is MB or kB; or the form of the first setting value can be a ratio relative to the total memory, and its dimension is 1, such as a percentage form. This disclosure is not limited thereto.
  • killing and exiting in the embodiments of the present disclosure are different operations for application programs.
  • the exit is based on a user instruction.
  • the user can exit the application program in the foreground or background state, for example, the user deletes an application program from the background application program, and then exits the application program.
  • killing is not based on user operations.
  • Electronic devices can dynamically kill applications in the background state based on memory usage. The killed applications are not completely exited, but their related information is added to the to the information list, and after that, it can be launched into the background state again based on the memory usage when the user does not operate on the application.
  • the explanations for killing and exiting here are only schematic to facilitate understanding of the difference between the two, but should not be construed as limiting the embodiments of the present disclosure.
  • the form of the determined second available memory can be a specific memory size, and its dimension is MB or kB, etc.; or the form of the second available memory can be a ratio relative to the total memory, and its dimension is 1, such as a percentage form.
  • This disclosure is not limited thereto. However, it should be understood that the second memory and the first set value in the embodiment of the present disclosure have the same dimension.
  • step 522 it is determined whether the second available memory is higher than a second set value. If it is determined that the second available memory is not higher than the second set value, then return to step 520 . If it is determined that the second available memory is higher than the second set value, continue to execute step 530 .
  • step 530 at least based on the memory occupied by each application program in the information list, the startup priority of each application program in the information list is determined, wherein the second set value is higher than the first set value.
  • the starting priority of each application program in the information list is determined.
  • the second available memory is higher than the second set value and satisfies at least one of the following (1)-(3), determine the startup priority of each application in the information list, where (1) The processor occupancy is lower than the first threshold, (2) the input/output bandwidth occupancy is lower than the second threshold, and (3) the network bandwidth occupancy is lower than the third threshold.
  • FIG. 6 shows a schematic flow chart of a process 600 of determining a startup priority according to some embodiments of the present disclosure.
  • a second available memory is determined.
  • step 620 it is determined whether the second available memory is higher than a second set value. If it is determined that the second available memory is higher than the second set value, continue to execute step 630 , otherwise return to execute step 610 .
  • the second set value is higher than the first set value, for example, the second set value is equal to 1.5 times of the first set value or other multiples greater than 1.
  • step 630 it is determined whether the processor occupancy is below a first threshold. If it is determined that the processor usage is lower than the first threshold, continue to execute step 640 , otherwise return to execute step 610 .
  • the first threshold may be set based on the processing capability of the processor (such as processing speed, etc.). For example, the first threshold is equal to 25% or 30% or other values.
  • step 640 it is determined whether the input/output (Input/Output, I/O) bandwidth occupancy rate is lower than a second threshold. If it is determined that the I/O usage rate is lower than the second threshold, continue to execute step 650 , otherwise return to execute step 610 .
  • I/O input/output
  • the second threshold can be set based on the transfer rate of the input/output bus or the like.
  • the second threshold is equal to 64kB/s or 200kB/s or other values.
  • step 650 it is determined whether the network bandwidth occupancy rate is lower than a third threshold. If it is determined that the network bandwidth occupancy rate is lower than the third threshold, continue to execute step 660 , otherwise return to execute step 610 .
  • the third threshold may be set based on the bandwidth transmission rate of the electronic device and the like.
  • the third threshold is equal to 64kB/s or 100kB/s or other values.
  • returning to step 610 may include: resetting the second timer, or re-determining whether there is an exited application and the memory released by the exited application is higher than the first set value.
  • step 660 the starting priority of each application program in the information list is determined.
  • step 630 is executed first, and then step 640 and step 650 are executed in sequence.
  • any one of steps 630-650 may be performed first, and then the remaining two steps are performed.
  • the starting priority of each application program in the information list may be determined at least based on the memory occupied by each application program in the information list after startup.
  • the starting priority of each application program may be further determined based on at least one of the following: the position of each application program in the information list, the number of times each application program is used within a preset period of time, or each application program The elapsed time when it was last started.
  • the position of each application program in the information list may be expressed in the form of a serial number, such as 1, 2, . . . and so on.
  • the position of each application program in the information list may depend on the order in which the application programs are killed (or added to the information list). Specifically, the closer the time of being killed, the smaller the sequence number of the location; on the contrary, the farther the time of being killed, the larger the sequence number of the location. That is to say, the longer the time in the information list, the greater the sequence number of the position in the information list.
  • the position of the application programs in the information list may be determined based on the order in which they are added to the information list from the background state. And, the later it is added to the information list, the higher the startup priority. In addition, the more times of use within the preset duration, the higher the startup priority. The longer it takes to be activated, the higher the activation priority.
  • the memory occupied by the application program after it is started the position of the application program in the information list, the number of times the application program is used within a preset period of time, and the startup time of the application program.
  • the total point value of the priority can be determined based on the memory occupied by the application after startup, the sixth score can be determined based on the position of the application in the information list, and the seventh score can be determined based on the number of times the application is used within a preset period of time.
  • the eighth score is determined based on the startup time of the application program, and the total score representing the startup priority can be obtained based on the fifth to eighth scores.
  • At least one of the memory occupied after startup, the position in the information list, the number of times used, and the time spent when it was last started has respectively Default weight.
  • the score of each application program in the information list can be determined by the following formula, and the startup priority can be determined based on the score, wherein the lower the score, the higher the startup priority:
  • score t represents the score of the t-th application in the information list
  • w1, w2, w3 and w4 represent the weights respectively
  • w1+w2+w3+w4 1
  • mem t represents the t-th application
  • posorder t indicates the position of the tth application in the information list
  • postime t indicates the time consumption based on the last startup from long to short
  • the tth application has multiple applications in the information list
  • the sorting in the program posnumber t indicates the sorting of the tth application among multiple applications in the information list based on the number of times it is used within a preset time period
  • n2 indicates the number of applications in the information list .
  • one or more applications in the information list are launched in the background based at least on the launch priorities of the respective applications.
  • a preset number of applications with the highest launch priority (corresponding to the lowest score of Equation 2) may be launched.
  • the preset number can be any positive integer, such as 1.
  • the second available memory is determined based on the memory released by the exited application being higher than the first predetermined value, then at step 540 at least one application with the highest launch priority may be launched, After at least one application program is started, the available memory is still higher than the first set value.
  • the memory occupied by the application with the highest startup priority (assumed to be APP11) after startup is S31
  • the memory occupied by the application with the second highest startup priority (assumed to be APP12) after startup is S32. If the available memory is still higher than the first set value after both APP11 and APP12 are activated, both APP11 and APP12 can be activated. On the contrary, if APP11 is started, the available memory is higher than the first set value; but after both APP11 and APP12 are started, the available memory is lower than the first set value, then only APP11 can be started, and the relevant information of APP12 remains the same. is kept in the information list.
  • the killed application program can be recovered more efficiently and quickly, and the time-consuming restarting when the user uses it again can be avoided, so that the solutions of the embodiments of the present disclosure can improve user experience.
  • starting an application program from the information list may also be referred to as restoring the application program in the information list to the background state, that is, the application program launched from the information list will be in the background state.
  • the interface and sound of the application may be turned off, so as to avoid affecting other applications being used by the user.
  • step 540 related information of one or more started application programs may also be deleted from the information list.
  • At least one application program in the background state can be killed in a timely manner at least based on the occupied memory when the memory is insufficient, so as to ensure the smoothness of the user's use of the electronic device and improve the user experience.
  • the startup can be resumed at least based on the application program that occupies the memory and will be killed after startup, so as to avoid the time-consuming manual startup when the user uses it again.
  • FIG. 2 or FIG. 3 above can be used to implement the processes of the embodiments of the present disclosure as described in conjunction with FIG. 4 to FIG. 6 .
  • Embodiments of the present disclosure also provide a chip, which may include an input interface, an output interface, and a processing circuit.
  • a chip which may include an input interface, an output interface, and a processing circuit.
  • the interaction of signaling or data may be completed by the input interface and the output interface, and the generation and processing of signaling or data information may be completed by the processing circuit.
  • Embodiments of the present disclosure also provide a chip system, including a processor, configured to support an electronic device to implement the functions involved in any of the foregoing embodiments.
  • the system-on-a-chip may further include a memory for storing necessary program instructions and data, and when the processor runs the program instructions, the device installed with the system-on-a-chip can implement the program described in any of the above-mentioned embodiments.
  • the chip system may consist of one or more chips, and may also include chips and other discrete devices.
  • Embodiments of the present disclosure further provide a processor, configured to be coupled with a memory, where instructions are stored in the memory, and when the processor executes the instructions, the processor executes the methods and functions involved in any of the foregoing embodiments.
  • Embodiments of the present disclosure also provide a computer program product containing instructions, which, when run on a computer, cause the computer to execute the methods and functions involved in any of the above embodiments.
  • Embodiments of the present disclosure also provide a computer-readable storage medium, on which computer instructions are stored, and when the electronic device executes the instructions, the electronic device executes the methods and functions involved in any of the foregoing embodiments.
  • the various embodiments of the present disclosure may be implemented in hardware or special purpose circuits, software, logic or any combination thereof. Some aspects may be implemented in hardware, while other aspects may be implemented in firmware or software, which may be executed by a controller, microprocessor or other computing device. While various aspects of the embodiments of the present disclosure are shown and described as block diagrams, flowcharts, or using some other pictorial representation, it should be understood that the blocks, devices, systems, techniques or methods described herein can be implemented as, without limitation, Exemplary, hardware, software, firmware, special purpose circuits or logic, general purpose hardware or controllers or other computing devices, or some combination thereof.
  • the present disclosure also provides at least one computer program product tangibly stored on a non-transitory computer-readable storage medium.
  • the computer program product comprises computer-executable instructions, eg included in program modules, which are executed in a device on a real or virtual processor of a target to perform the process/method as above with reference to the accompanying drawings.
  • program modules include routines, programs, libraries, objects, classes, components, data structures, etc. that perform particular tasks or implement particular abstract data types.
  • the functionality of the program modules may be combined or divided as desired among the program modules.
  • Machine-executable instructions for program modules may be executed within local or distributed devices. In a distributed device, program modules may be located in both local and remote storage media.
  • Computer program codes for implementing the methods of the present disclosure may be written in one or more programming languages. These computer program codes can be provided to processors of general-purpose computers, special-purpose computers, or other programmable data processing devices, so that when the program codes are executed by the computer or other programmable data processing devices, The functions/operations specified in are implemented.
  • the program code may execute entirely on the computer, partly on the computer, as a stand-alone software package, partly on the computer and partly on a remote computer or entirely on the remote computer or server.
  • computer program code or related data may be carried by any suitable carrier to enable a device, apparatus or processor to perform the various processes and operations described above.
  • carriers include signals, computer readable media, and the like.
  • signals may include electrical, optical, radio, sound, or other forms of propagated signals, such as carrier waves, infrared signals, and the like.
  • a computer readable medium may be any tangible medium that contains or stores a program for or related to an instruction execution system, apparatus, or device.
  • the computer readable medium may be a computer readable signal medium or a computer readable storage medium.
  • a computer readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination thereof. More detailed examples of computer-readable storage media include electrical connections with one or more wires, portable computer diskettes, hard disks, random storage access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash), optical storage, magnetic storage, or any suitable combination thereof.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)

Abstract

本公开的实施例提供了一种内存管理方法、电子设备、计算机存储介质和程序产品。该方法包括:电子设备确定其第一可用内存;如果第一可用内存低于第一设定值,至少基于处于后台状态的多个应用程序中各个应用程序的占用内存,确定多个应用程序各自的被杀优先级;以及基于多个应用程序各自的被杀优先级,将多个应用程序中的至少一个应用程序杀掉。以此方式,本公开的实施例的电子设备能够在可用内存低于第一设定值时及时地至少基于占用内存来杀掉处于后台状态的至少一个应用程序,这样能够释放至少一个应用程序的内存占用,确保电子设备的可用内存,以此能够确保用户使用电子设备的顺畅感,提升了用户体验。

Description

内存管理方法、电子设备、计算机存储介质和程序产品
本申请要求于2021年09月30日提交中国国家知识产权局、申请号为202111161913.8、申请名称为“内存管理方法、电子设备、计算机存储介质和程序产品”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开涉及计算机领域,更具体地,涉及内存管理方法、电子设备、计算机存储介质和程序产品。
背景技术
随着计算机技术的发展,操作***也得到了快速发展,被应用到了各种各样的电子产品中。借助于操作***,大量的应用程序可以被使用,并且应用程序在操作***上运行时需使用内存。
由于内存资源是有限的,因此在被开启的应用程序过多时,可能会造成内存不足,进而使***运行出现故障,影响用户体验。
发明内容
本公开的实施例提供了一种高效的内存管理方案。
在第一方面,提供了一种内存管理方法。该方法包括:电子设备确定该电子设备的第一可用内存;如果第一可用内存低于第一设定值,电子设备至少基于处于后台状态的多个应用程序中各个应用程序的占用内存,确定多个应用程序各自的被杀优先级;以及电子设备基于多个应用程序各自的被杀优先级,将多个应用程序中的至少一个应用程序杀掉。具体而言,若应用程序占用的内存越大,则该应用程序的被杀优先级越高。即可以优先杀掉内存占用大的应用程序。
由此,本公开的实施例的电子设备能够在可用内存低于第一设定值时及时地至少基于占用内存来杀掉处于后台状态的至少一个应用程序,这样能够释放至少一个应用程序的内存占用,确保电子设备的可用内存,以此能够确保用户使用电子设备的顺畅感,提升了用户体验。
在第一方面的一些实施例中,确定第一可用内存包括:电子设备基于第一周期,周期性地确定第一可用内存;或者,如果检测到处于待启动状态的应用程序的启动后占用内存高于第一设定值,电子设备确定第一可用内存。
由此,本公开的实施例的电子设备可以基于第一周期或基于待启动的应用程序来确定可用内存,能够使得该方案更有针对性,避免因内存判断对用户的正常使用造成太大的影响。
在第一方面的一些实施例中,多个应用程序各自的被杀优先级还基于以下至少一项被确定:多个应用程序各自在后台应用程序列表中的位置,多个应用程序各自在预设时长内的被使用次数,或者多个应用程序各自在被启动时的耗时。具体地,可以基于多个应用程序各自在最后一次从前台状态切换为后台状态的先后顺序来确定各自在后台应用程序列表中的位置。具体地,应用程序最后一次从前台状态切换为后台状态的时间越早、在预设时长内的被使用次数越少、在被启动时的耗时越短,则被杀优先级越高。例如:可以基于应用程序的内存占用、应用程序在后台应用程序列表中的位置、应用程序在预设时长内的被使用次数、应用程 序的启动耗时这四个参数一起来确定表示被杀优先级的总分值;其中,内存占用越大,则该参数对应的分值越高;在后台应用程序列表中的位置越靠前,则该参数对应的分值越高;在预设时长内的被使用次数越少,则该参数对应的分值越高;启动耗时越短,则该参数对应的分值越高;根据这四个参数分别对应的分值可以得到表示被杀优先级的总分值,该总分值越高,则被杀优先级越高。例如占用内存、在后台应用程序列表中的位置、被使用次数和启动耗时这四个参数可以分别具有预设权重。根据预设权重,可以对这四个参数对应的分值进行加权,从而得到表示被杀优先级的总分值。
由此,电子设备可以基于多个因素来确定应用程序的被杀优先级,使得在杀掉应用程序时的考虑更加全面。
由此,电子设备基于预设权重来确定各个应用程序的被杀优先级,该方式简单高效,易于实现。
在第一方面的一些实施例中,还包括:电子设备将被杀掉的至少一个应用程序的相关信息添加到信息列表中。
在第一方面的一些实施例中,至少一个应用程序的相关信息包括关于以下至少一项的信息:标识、启动后占用内存、在预设时长内的被使用次数、或者上一次被启动时的耗时。
由此,电子设备将被杀的应用程序的信息添加在信息列表中,便于后续对应用程序的恢复。
在第一方面的一些实施例中,还包括:电子设备确定电子设备的第二可用内存;如果第二可用内存高于第二设定值,电子设备至少基于信息列表中各个应用程序的启动后占用内存,确定信息列表中各个应用程序的启动优先级,第二设定值高于第一设定值;以及电子设备至少基于各个应用程序的启动优先级,在后台启动信息列表中的一个或多个应用程序。
由此,本公开的实施例中,电子设备在杀掉应用程序之后,还能够恢复被杀掉的应用程序,避免用户再次使用时重新启动的耗时,从而本公开实施例的方案能够提升用户体验。
在第一方面的一些实施例中,确定第二可用内存包括:电子设备基于第二周期,周期性地确定第二可用内存;或者,如果确定存在退出的应用程序且退出的应用程序所释放的内存高于第一设定值,确定第二可用内存。
在第一方面的一些实施例中,确定启动优先级包括:如果第二可用内存高于第二设定值并且以下至少一项被满足,电子设备确定启动优先级:处理器的占用率低于第一阈值,输入/输出带宽占用率低于第二阈值,或网络带宽占用率低于第三阈值。
由此,电子设备在恢复应用程序时的考虑因素更加全面,能够确保应用程序的恢复不会对用户正在进行的操作造成影响或中断,确保用户体验。
在第一方面的一些实施例中,信息列表中各个应用程序的启动优先级还基于以下至少一项被确定:各个应用程序在信息列表中的位置,各个应用程序在预设时长内的被使用次数,或者各个应用程序上一次被启动时的耗时。具体地,可以基于各个应用程序从后台状态被加入到信息列表中的先后顺序来确定各个应用程序在信息列表中的位置。具体地,启动后占用内存越小、被加入到信息列表中的时间越晚、在预设时长内的被使用次数越多、在被启动时的耗时越长,则启动优先级越高。
在第一方面的一些实施例中,在确定启动优先级时,启动后占用内存、以及在信息列表中的位置、被使用次数和上一次被启动时的耗时中的至少一项分别具有预设权重。
由此,电子设备可以基于多个因素来确定应用程序的启动优先级,使得在启动应用程序 时的考虑更加全面。并且基于预设权重来确定各个应用程序的启动优先级,该方式简单高效,易于实现。
在第二方面,提供了一种内存管理装置。该装置包括:确定模块,被配置为确定电子设备的第一可用内存;确定模块,还被配置为如果第一可用内存低于第一设定值,至少基于处于后台状态的多个应用程序中各个应用程序的占用内存,确定多个应用程序各自的被杀优先级;以及杀掉应用程序模块,被配置为基于多个应用程序各自的被杀优先级,将多个应用程序中的至少一个应用程序杀掉。
在第二方面的一些实施例中,确定模块被配置为基于第一周期,周期性地确定第一可用内存;或者,如果检测到处于待启动状态的应用程序的启动后占用内存高于第一设定值,确定第一可用内存。
在第二方面的一些实施例中,多个应用程序各自的被杀优先级还基于以下至少一项被确定模块确定:多个应用程序各自在后台应用程序列表中的位置,多个应用程序各自在预设时长内的被使用次数,或者多个应用程序各自在被启动时的耗时。
在第二方面的一些实施例中,确定模块在确定多个应用程序各自的被杀优先级时,占用内存、以及在后台应用程序列表中的位置、被使用次数和耗时中的至少一项分别具有预设权重。
在第二方面的一些实施例中,还包括添加列表模块,被配置为:将被杀掉的至少一个应用程序的相关信息添加到信息列表中。
在第二方面的一些实施例中,至少一个应用程序的相关信息包括关于以下至少一项的信息:标识、启动后占用内存、在预设时长内的被使用次数、或者上一次被启动时的耗时。
在第二方面的一些实施例中,还包括启动应用程序模块,确定模块,还被配置为确定电子设备的第二可用内存;以及如果第二可用内存高于第二设定值,至少基于信息列表中各个应用程序的启动后占用内存,确定信息列表中各个应用程序的启动优先级,第二设定值高于第一设定值;以及启动应用程序模块,被配置为至少基于各个应用程序的启动优先级,在后台启动信息列表中的一个或多个应用程序。
在第二方面的一些实施例中,确定模块被配置为基于第二周期,周期性地确定第二可用内存;或者,如果确定存在退出的应用程序且退出的应用程序所释放的内存高于第一设定值,确定第二可用内存。
在第二方面的一些实施例中,确定模块被配置为如果第二可用内存高于第二设定值并且以下至少一项被满足,确定启动优先级:处理器的占用率低于第一阈值,输入/输出带宽占用率低于第二阈值,或网络带宽占用率低于第三阈值。
在第二方面的一些实施例中,信息列表中各个应用程序的启动优先级还基于以下至少一项被确定模块确定:各个应用程序在信息列表中的位置,各个应用程序在预设时长内的被使用次数,或者各个应用程序上一次被启动时的耗时。
在第二方面的一些实施例中,确定模块在确定启动优先级时,启动后占用内存、以及在信息列表中的位置、被使用次数和上一次被启动时的耗时中的至少一项分别具有预设权重。
在第三方面,提供了一种电子设备,包括处理器以及存储器,存储器上存储有由处理器执行的指令,当指令被处理器执行时使得该电子设备实现上述第一方面或其任一实施例中的方法的操作。
在第四方面,提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机 可执行指令,该计算机可执行指令被电子设备执行时实现根据上述第一方面或其任一实施例中的方法的操作。
在第五方面,提供了一种芯片或芯片***。该芯片或芯片***包括处理电路,被配置为执行根据上述第一方面或其任一实施例中的方法的操作。
在第六方面,提供了一种计算机程序或计算机程序产品。该计算机程序或计算机程序产品被有形地存储在计算机可读介质上并且包括计算机可执行指令,计算机可执行指令在被计算机执行时实现根据上述第一方面或其任一实施例中的方法的操作。
附图说明
图1示出了应用程序占用内存的场景的一个示意图;
图2示出了本公开的实施例可以实现于其中的电子设备的一个示意框图;
图3示出了本公开的实施例可以实现于其中的具有分层架构的安卓***的电子设备的软件结构框图;
图4示出了根据本公开的一些实施例的内存管理过程的示意流程图;
图5示出了根据本公开的一些实施例的被杀掉的至少一个应用程序重新启动的过程的示意流程图;以及
图6示出了根据本公开的一些实施例的确定启动优先级的过程的示意流程图。
具体实施方式
在本公开的实施例的描述中,术语“包括”及其类似用语应当理解为开放性包含,即“包括但不限于”。术语“基于”应当理解为“至少部分地基于”。术语“一个实施例”或“该实施例”应当理解为“至少一个实施例”。术语“第一”、“第二”等等可以指代不同的或相同的对象。下文还可能包括其他明确的和隐含的定义。
得益于计算机技术的发展,现在的电子设备变得越来越普遍,并且电子设备上通常可以安装有大量的应用程序。用户在使用电子设备的过程中,可以将应用程序完全退出,即关于应用程序对应的进程以释放内存空间。或者用户可以仅将应用程序的界面关掉,从而该应用程序被转换为后台状态,此时该应用程序依然占用内存。
图1示出了应用程序占用内存的场景100的一个示意图。如图1所示,内存可以包括芯片预留110、内核120、匿名页131、压缩匿名页132、压缩匿名页扩展133、文件页和自由(free)内存140,其中匿名页131、压缩匿名页132和压缩匿名页扩展133可以被统称为总匿名页分布130。示例性地,在一个或多个应用程序150(如图1中所示出的APP1至APP6)被启动后,处于前台状态或者后台状态的应用程序会占用内存,具体地会占用总匿名页分布130。
在一般情况下,为了保证用户体验,***服务和应用程序等会被尽量地保持在运行中。但是受限于***的内存资源大小,保持运行中的应用程序的数量是有限的。在内存不足时,一种方式是将运行中的应用程序进行压缩,以便占用较少的内存资源,但是这样的话需要频繁地进行压缩和解压缩操作;另一种方式是将应用程序占用的内存换出,例如使应用程序占用其他的存储器资源,但是这样会影响各种器件的使用寿命,增加了内存与其他存储器之间的输入输出接口的占用率,而且也需要频繁地进行换入和换出。可见,目前的方案不够高效,存在弊端,且会影响用户体验。
有鉴于此,本公开的实施例提供了一种内存管理方案,能够在内存不足时将后台状态的应用程序杀掉以释放内存,并且还能够在内存充足的情况下将被杀掉的应用程序重新启动,这样能够保证用户体验。下面将结合附图描述本公开的具体实施例。
图2示出了本公开的实施例可以实现于其中的电子设备200的一个示意框图。
如图2所示,电子设备200可以包括处理器210、外部存储器接口292、内部存储器296、订户身份模块(Subscriber Identification Module,SIM)卡接口294、显示屏220、摄像头222、指示器224、马达226、按键228、通用串行总线(Universal Serial Bus,USB)接口230、充电管理器模块240、电源管理模块242、电池244、移动通信模块250、天线252、无线通信模块260、天线262、音频模块270、扬声器272、受话器274、麦克风276、耳机接口278以及传感器模块280等。传感器模块280包括压力传感器2802、陀螺仪传感器2804、气压传感器2806、磁传感器2808、加速度传感器2810、距离传感器2812、接近光传感器2814、指纹传感器2816、温度传感器2818、触控传感器2820和环境光传感器2822等。
可理解的是,图2仅是示意,电子设备200可以包括更多或更少的部件,或者可以将其中的多个部件组合为一个部件,或者可以将其中的一个部件拆分为多个部件,或者上述组合等。另外可理解的是,图2中所示的部件可以通过硬件、软件、或软件和硬件组合的方式实现。
处理器210可以包括一个或多个处理单元,例如可以包括中央处理单元(Central Processing Unit,CPU)、应用处理器(Application Processor,AP)、调制解调处理器、图形处理单元(Graphics Processing Unit,GPU)、图像信号处理器(Image Signal Processor,ISP)、控制器、视频编解码器、数字信号处理器(Digital Signal Processor,DSP)、基带处理器、和/或神经网络处理器(Neural-Network Processing Unit,NPU)等,其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
处理器210中还可以设置存储器,用于存储指令和数据。作为一例,处理器210中的存储器为高速缓冲存储器。该存储器可以保存处理器210刚用过或循环使用的指令或数据。如果处理器210需要再次使用该指令或数据,可从存储器中直接调用。避免了重复存取,减少了处理器210的等待时间,因而提高了***的效率。
处理器210可以包括一个或多个接口。接口可以包括集成电路(Inter-Integrated Circuit,I2C)接口,集成电路内置音频(Inter-Integrated Circuit Sound,I2S)接口,脉冲编码调制(Pulse Code Modulation,PCM)接口,通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)接口,移动产业处理器接口(Mobile Industry Processor Interface,MIPI),通用输入/输出(General-Purpose Input/Output,GPIO)接口,SIM卡接口294、和/或USB接口230等。
可以理解的是,本公开中仅示意性地列举了各模块间的接口连接关系,但是这些示意不应解释成对电子设备200的结构限定。电子设备200也可以采用与上面所述的不同的接口连接方式,或可以采用多种接口连接方式的组合。
充电管理模块240用于从充电器接收充电输入。充电器可以是无线充电器,也可以是有线充电器。在有线充电的情形中,充电管理模块240可以通过USB接口230接收有线充电器的充电输入。在无线充电的情形中,充电管理模块240可以通过电子设备200的无线充电线圈接收无线充电输入。充电管理模块240为电池244充电的同时,还可以通过电源管理模块242为电子设备200供电。
电源管理模块242用于连接电池244、充电管理模块240以及处理器210。电源管理模块242接收电池244和/或充电管理模块240的输入,为处理器210、内部存储器296,显示220、摄像头222和无线通信模块260等供电。电源管理模块242还可以用于监测电池容量、电池循环次数、电池健康状态(如漏电,阻抗)等参数。在一些情形中,电源管理模块242也可以设置于处理器210中。在另一些情形中,电源管理模块242和充电管理模块240也可以设置于同一个器件中。
电子设备200的无线通信功能可以通过移动通信模块250、天线252、无线通信模块260、天线262、调制解调处理器以及基带处理器等实现。
天线252和天线262用于发射和接收电磁波信号。电子设备200中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如,可以将天线252复用为无线局域网的分集天线。例如,天线可以和调谐开关结合使用。
移动通信模块250可以提供应用在电子设备200上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块250可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块250可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块250还可以对经调制解调处理器调制后的信号放大,经天线252转为电磁波辐射出去。在一些场景中,移动通信模块250的至少部分功能模块可以被设置于处理器210中。在一些场景中,移动通信模块250的至少部分功能模块可以与处理器210的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器,其中,调制器用于将待发送的低频基带信号调制成中高频信号,解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器272、受话器274等)输出声音信号,或通过显示屏220显示图像或视频。在一些场景中,调制解调处理器可以是独立的器件。在另一些场景中,调制解调处理器可以独立于处理器210,与移动通信模块250或其他功能模块设置在同一个器件中。
无线通信模块260可以提供应用在电子设备200上的包括无线局域网(Wireless Local Area Network,WLAN)等无线通信的解决方案,如Wi-Fi网络、BT、全球导航卫星***(Global Navigation Satellite System,GNSS)、调频(Frequency Modulation,FM)、NFC、红外技术(infrared,IR)。无线通信模块260可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块260经由天线262接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器210。无线通信模块260还可以从处理器210接收待发送的信号,对其进行调频、放大,经天线262转为电磁波辐射出去。
在一些场景中,电子设备200的天线252和移动通信模块250耦合,天线262和无线通信模块260耦合,使得电子设备200可以通过无线通信技术与网络和/或其他设备通信。这里的无线通信技术可以包括全球移动通讯***(Global System For Mobile Communications,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址接入(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、时分码分多址(Time-Division Code Division Multiple Access,TD-SCDMA)、长期演进(Long Term Evolution,LTE)、BT、GNSS、WLAN、NFC、FM、和/或IR技术等。
电子设备200通过GPU、显示屏220、以及应用处理器等实现显示功能。GPU为图像处 理的微处理器,连接显示屏220和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器210可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏220用于显示文本、图像、视频等。显示屏220包括显示面板,显示面板可以采用液晶显示屏(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)、有源矩阵有机发光二极体或主动矩阵有机发光二极体(Active-Matrix Organic Light Emitting Diode,AMOLED),柔性发光二极管(Flex Light-Emitting Diode,FLED)Mini-LED、Micro-LED、Micro-OLED、量子点发光二极管(Quantum Dot Light Emitting Diodes,QLED)等。在一些场景中,电子设备200可以包括1个或多个显示屏220。
电子设备200可以通过ISP、摄像头222、视频编解码器、GPU、显示屏220以及应用处理器等实现拍摄功能。
ISP用于处理摄像头222反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些场景中,ISP可以设置在摄像头222中。
摄像头222用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(Charge Coupled Device,CCD)或互补金属氧化物半导体(Complementary Metal-Oxide-Semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些场景中,电子设备200可以包括1个或多个摄像头222。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备200在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备200可以支持一种或多种视频编解码器。这样,电子设备200可以播放或录制多种编码格式的视频,例如,动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(Neural-Network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备200的智能认知等应用,例如:图像识别、人脸识别、语音识别、文本理解等。
指示器224可以是指示灯,可以用于指示充电状态、电量变化,也可以用于指示消息、未接来电、通知等。
马达226可以产生振动提示。马达226可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏20不同区域的触摸操作,马达226也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
按键228包括开机键,音量键等。按键228可以是机械按键,也可以是触摸式按键。电子设备200可以接收按键输入,产生与电子设备200的用户设置以及功能控制有关的键信号输入。
SIM卡接口294用于连接SIM卡。SIM卡可以通过***SIM卡接口294,或从SIM卡接口294拔出,实现和电子设备200的接触和分离。电子设备200可以支持1个或多个SIM卡接口294。SIM卡接口294可以支持Nano SIM卡、Micro SIM卡、mini SIM卡等。同一个SIM卡接口294可以同时***多张卡,多张卡的类型可以相同,也可以不同。SIM卡接口294也可以兼容不同类型的SIM卡。SIM卡接口294也可以兼容外部存储卡。电子设备200通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些场景中,电子设备200采用嵌入式SIM(embedded SIM,eSIM)卡,eSIM卡可以嵌在电子设备200中,不能和电子设备200分离。
外部存储器接口292可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备200的存储能力。外部存储卡通过外部存储器接口292与处理器210通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器296可以用于存储计算机可执行程序代码,该可执行程序代码包括指令。内部存储器296可以包括存储程序区和存储数据区。其中,存储程序区可存储操作***,至少一个功能所需的应用程序(诸如声音播放功能,图像播放功能)等。存储数据区可存储电子设备200使用过程中所创建的数据(诸如音频数据,电话本)等。此外,内部存储器296可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(Universal Flash Storage,UFS)等。处理器210通过运行存储在内部存储器296的指令,和/或存储在设置于处理器中的存储器的指令,执行电子设备200的各种功能应用以及数据处理。
电子设备200可以通过音频模块270、扬声器272、受话器274、麦克风276、耳机接口278以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块270用于将数字音频信号转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块270还可以用于对音频信号编码和解码。在一些场景中,音频模块270可以设置于处理器210中,或将音频模块270的部分功能模块设置于处理器210中。
受话器274,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备200接听电话或语音信息时,可以通过将受话器274靠近人耳接听语音。
麦克风276,也称“话筒”或“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风276发声,将声音信号输入到麦克风276。电子设备200可以设置至少一个麦克风276。例如,电子设备200可以设置两个麦克风276,除了采集声音信号,还可以实现降噪功能。例如,电子设备200还可以设置三个、四个或更多麦克风276,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口278用于连接有线耳机。耳机接口278可以是USB接口230,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口等。
压力传感器2802用于感受压力信号,可以将压力信号转换成电信号。在一些场景中,压力传感器2802可以设置于显示屏220。压力传感器2802的种类可以为电阻式压力传感器,电感式压力传感器,电容式压力传感器等。
陀螺仪传感器2804可以用于确定电子设备200的运动姿态。
气压传感器2806可以用于测量气压。
磁传感器2808包括霍尔传感器。电子设备200可以利用磁传感器2808检测翻盖皮套的开合。
加速度传感器2810可以用于检测电子设备200在各个方向上(一般为三轴)加速度的大小。
距离传感器2812可以用于测量距离。电子设备200可以通过红外或激光测量距离。在诸如拍摄场景中,电子设备200可以利用距离传感器2812测距以实现快速对焦。
接近光传感器2814可以包括例如LED和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备200通过发光二极管向外发射红外光,使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备200附近有物体。当检测到不充分的反射光时,电子设备200可以确定附近没有物体。电子设备200可以利用接近光传感器2814检测用户手持电子设备200贴近耳朵通话,以便自动熄灭显示屏220达到省电的目的。接近光传感器2814也可用于皮套模式,口袋模式自动解锁与锁屏。
指纹传感器2816可以用于采集指纹。电子设备200可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器2818可以用于检测温度。
触控传感器2820也称“触控器件”或“触摸面板”等。触控传感器2820可以设置于显示屏220,由触控传感器2820与显示屏220组成触控屏。触控传感器2820用于检测作用于其上或附近的触控操作。触控传感器2820可以将检测到的触控操作传递给应用处理器,以确定触控事件类型。可以通过显示屏220提供与触控操作相关的视觉输出。在另一些场景中,触控传感器2820也可以设置于电子设备200的表面,与显示屏220所处的位置不同。
环境光传感器2822用于感知环境光亮度。电子设备200可以根据感知的环境光亮度自适应调节显示屏220的亮度。环境光传感器2822也可用于拍照时自动调节白平衡。环境光传感器2822还可以与接近光传感器2814配合,检测电子设备200是否在口袋里,以防误触。
可选地,传感器模块280还可以包括红外传感器、超声波传感器及电场传感器等,以用于辅助电子设备200进行隔空手势的识别。
应理解的是,图2中的电子设备200仅是示意,其实现为不同类型的设备时,可以包括更多或更少的部件。例如,电子设备200被实现为膝上型计算机时,可以不具有SIM卡接口294。
电子设备200的软件***可以采用分层架构、鸿蒙***(Harmony OS)架构、事件驱动架构、微核架构、微服务架构、或云架构等。
图3示出了本公开的实施例可以实现于其中的具有分层架构的安卓(Android)***的电子设备300的软件结构框图。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。如图3所示,Android***可以被分为四层,从上至下依次为应用程序层310、应用程序框架层320、内核层330、以及网络传输层340。
应用程序层310可以包括一系列应用程序包,包括但不限于相机、图库、日历、通话、地图、导航、WLAN、蓝牙、音乐、视频、短信息等应用(Application,APP)。
应用程序框架层320为应用程序层310的应用程序提供应用编程接口(Application Programming Interface,API)和编程框架。应用程序框架层320可以包括一些预先定义的函数,包括但不限于窗口管理器、内容提供器、视图***、电话管理器、资源管理器、通知管理器等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏, 锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。数据可以包括视频、图像、音频、拨打和接听的电话、浏览历史和书签、电话簿等。
视图***包括可视控件,例如显示文字的控件、显示图片的控件等。视图***可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
电话管理器用于提供电子设备300的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,诸如本地化字符串、图标、图片、布局文件、视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在***顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备300振动,指示灯闪烁等。
内核层330至少包含显示驱动、摄像头驱动、音频驱动、传输驱动。内核层330的不同驱动用于调用电子设备300的硬件设备,执行相应的操作。例如,显示驱动用于支持电子设备300的界面显示等,音频驱动用于支持电子设备300的播放音频等,传输驱动用于支持电子设备300与另一电子设备之间的内容分享等。
网络传输层340可以用于电子设备300与另一电子设备之间的通信、数据传输等。可以包括:蓝牙模块、Wi-Fi模块、NFC模块、发现连接模块、配对模块和连接传输模块等。发现连接模块可以用于发现可建立通信连接的另一电子设备。配对模块可以用于在建立通信连接过程中对请求建立连接的另一电子设备进行认证。连接传输模块可以用于与已建立连接的另一电子设备传输数据或消息、指令等。
应理解的是,尽管图3中示出的电子设备300具有安卓***,但是本公开对此不限定,例如本公开的实施例还可以应用于具有其它操作***的电子设备等。另外,如上所述的电子设备200以及电子设备300仅是示意,不应解释为对本公开如下所述实施例的限制。
图4示出了根据本公开的一些实施例的内存管理过程400的示意流程图。过程400可以由电子设备执行,如上图2所示的电子设备200或图3所示的电子设备300。
在步骤410,确定电子设备的第一可用内存。
电子设备上安装有应用程序,应用程序被启动后会占用内存。例如,用户可以通过点击应用程序对应的图标来启动应用程序,使该应用程序变为前台状态,呈现界面等。针对处于前台状态的应用程序,用户可以通过点击“关闭”按钮、或者通过点击诸如“Home”键、或者通过点击其他应用程序的图标等方式使得该应用程序的界面被关闭,并变为后台状态。可理解,处于前台状态或者处于后台状态的应用程序都会占用内存。应注意的是,本公开的实施例中,内存、内存空间、内存资源等可以代表相同的含义,下文中不再进行区分。
在一些实施例中,电子设备可以周期性地或者基于事件触发地来确定第一可用内存。
举例而言,可以基于第一周期而周期性地确定第一可用内存。电子设备中可以设置有第一定时器,该第一定时器启动时可以具有初始值,当该第一定时器的值达到预定值时,确定第一可用内存。附加地或可选地,在该第一定时器的值达到预定值后,可以被重置为初始值,并重新计时。作为一例,初始值可以等于0,预定值可以等于第一周期。作为另一例,初始 值可以等于第一周期,预定值可以等于0。第一周期的值可以是基于实际需求所预先设定的,例如电子设备可以具有出厂设置的第一周期,或者,用户可以根据自己的需求调整第一周期,本公开对此不限定。
在电子设备处于开机的期间,第一定时器可以处于运行中。或者可选地,在电子设备包括处于后台状态的应用程序时,第一定时器可以处于运行中。也就是说,如果电子设备处于开机状态,但是不存在任何处于后台状态的应用程序,此时第一定时器可以被置为初始值且停止运行,即不计时。
举例而言,可以基于处于待启动状态的应用程序而确定第一可用内存。具体地,可以检测处于待启动状态的应用程序的启动后占用内存,如果确定该处于待启动状态的应用程序的启动后占用内存高于第一设定值,则确定第一可用内存。可选地,本公开的实施例中可以将启动后占用内存高于第一设定值的应用程序称为大内存应用程序,例如相机或手游等。示例性地,第一设定值可以基于电子设备的总内存、电子设备的处理器的处理速度等进行预先设定。另外第一设定值的形式可以是具体的内存大小,其量纲为MB或kB等;或者第一设定值的形式可以是相对于总内存的比例,其量纲为1,如百分比的形式。本公开对此不限定。
被确定的第一可用内存的形式可以是具体的内存大小,其量纲为MB或kB等;或者第一可用内存的形式可以是相对于总内存的比例,其量纲为1,如百分比的形式。本公开对此不限定。但是应理解,本公开实施例的中第一可用内存和第一设定值具有相同的量纲。
结合图1的场景100,第一可用内存可以表示在总匿名页分布130中的可用内存(量纲为MB或kB等)或者在总匿名页分布130中的可用内存相对于总匿名页分布130的比例。但是应理解,第一可用内存也可以表示其他的含义,如整个内存中的可用量,本公开对此不限定。
在步骤412,确定第一可用内存是否低于第一设定值。如果确定第一可用内存不低于第一设定值,则返回步骤410。如果确定第一可用内存低于第一设定值,则执行步骤420。
在步骤420,至少基于处于后台状态的多个应用程序中各个应用程序的占用内存,确定多个应用程序各自的被杀优先级。
也就是说,如果第一可用内存低于第一设定值,则确定处于后台状态的多个应用程序中各个应用程序的被杀优先级。
在一些实施例中,可理解,假设存在处于待启动状态的应用程序,并且该于待启动状态的应用程序的启动后占用内存高于第一设定值,那么在第一可用内存低于第一设定值时,第一可用内存将无法保证该处于启动状态的应用程序的正常使用,甚至可能无法保证该处于启动状态的应用程序的正常启动。
在一些实施例中,处于后台状态的多个应用程序各自的占用内存不同,那么可以基于占用内存的大小来确定各自的被杀优先级。例如,占用内存最大的应用程序的被杀优先级最大。举例而言,假设处于后台状态的应用程序为3个,其中应用程序1的占用内存为S1,应用程序2的占用内存为S2,应用程序3的占用内存为S3。如果S3>S1>S2,那么应用程序3具有第一被杀优先级,应用程序1具有第二被杀优先级,应用程序2具有第三被杀优先级。
在一些实施例中,在确定多个应用程序各自的被杀优先级时,除了基于占用内存外,还可以进一步基于下列中的一项或多项:多个应用程序各自在后台应用程序列表中的位置,多个应用程序各自在预设时长内的被使用次数,或者多个应用程序各自在被启动时的耗时。
以多个应用程序中的一个应用程序(假设为APP01)为例,APP01在后台应用程序列表 中的位置可以被表示为序号的形式,如1、2、…等。示例性地,位置可以是基于APP01上一次被使用(上一次处于前台状态)的时间所确定的。具体的,上一次被使用的时间越近,位置的序号越小;相反,上一次被使用的时间越远,位置的序号越大。举例而言,假设处于后台状态的应用程序有两个:APP01和APP02,APP01上一次被使用的时间更近,那么APP01在后台应用程序列表中的位置被表示为1,APP02在后台应用程序列表中的位置被表示为2。
多个应用程序各自在预设时长内的被使用次数可以表示在预设时长内被切换到前台状态的次数。示例性地,预设时长可以是预先设置的参数,例如10分钟或1小时或其他值等。
多个应用程序各自在被启动时的耗时可以表示应用程序从未启动状态变为前台状态的时长。在一些实施例中,耗时可以是从用户点击桌面应用程序图标开始,到该应用程序的界面全屏显示之间的时长。在一些实施例中,耗时可以是从用户点击桌面应用程序图标开始,到该应用程序的界面呈现且界面上的字数达到字数阈值之间的时长。具体而言,可以统计在应用程序的界面上呈现的字数,直到字数达到字数阈值。在一些实施例中,耗时可以是从用户点击桌面应用程序图标开始,到该应用程序的界面呈现内容的比例达到比例阈值之间的时长。例如,比例阈值可以是80%或100%或其他值。这样能够充分考虑网络条件或电子设备的处理速度等因素。
应用程序在后台应用程序列表中的位置可以是基于应用程序在最后一次从前台状态切换为后台状态的先后顺序被确定的。并且,最后一次从前台状态切换为后台状态越早,则被杀优先级越高。另外,在预设时长内的被使用次数越少,被杀优先级越高。在被启动时的耗时越短,被杀优先级越高。
可选地,可以基于应用程序的内存占用、应用程序在后台应用程序列表中的位置、应用程序在预设时长内的被使用次数、应用程序的启动耗时这四个参数一起来确定表示被杀优先级的总分值。作为一例,可以基于应用程序的内存占用确定第一分值,可以基于应用程序在后台应用程序列表中的位置确定第二分值,可以基于应用程序在预设时长内的被使用次数确定第三分值,基于应用程序的启动耗时确定第四分值,并且可以基于第一分值至第四分值得到表示被杀优先级的总分值。
示例性地,在确定多个应用程序各自的被杀优先级时,占用内存、以及在后台应用程序列表中的位置、被使用次数和启动耗时中的至少一项分别具有预设权重。
在一些实施例中,可以将处于后台状态的应用程序简称为后台应用程序。并且可以通过下式确定处于后台状态的多个应用程序中各个应用程序的得分,并基于得分来确定被杀优先级,其中得分越高表示被杀优先级越高:
Figure PCTCN2022112034-appb-000001
在上式中,score k表示多个后台应用程序中第k个后台应用程序的得分,w1、w2、w3和w4分别表示权重,且w1+w2+w3+w4=1,mem k表示第k个后台应用程序的占用内存,posorder k表示第k个后台应用程序在多个后台应用程序中的位置,postime k表示基于被启动时的耗时从长到短,第k个后台应用程序在多个后台应用程序中的排序,posnumber k表示基于在预设时长内的被使用次数从多到少,第k个后台应用程序在多个后台应用程序中的排序, n1表示多个后台应用程序的数量。
对于公式1中的posorder k,其取值范围为1至n1。具体而言,n1个后台应用程序中,最晚切换到后台状态的应用程序假设为后台应用程序i1,其位置为1,即posorder i1=1。最早切换到后台状态的应用程序假设为后台应用程序j1,其位置为n1,即posorder j1=n1。
对于公式1中的postime k,其取值范围为1至n1。具体而言,n1个后台应用程序中,被启动时的耗时最长的应用程序假设为后台应用程序i2,其排序为1,即postime i2=1。被启动时的耗时最短的应用程序假设为后台应用程序j2,其排序为n1,即postime j2=n1。
对于公式1中的posnumber k,其取值范围为1至n1。具体而言,n1个后台应用程序中,在预设时长内的被使用次数最多的应用程序假设为后台应用程序i3,其排序为1,即posnumber i3=1。在预设时长内的被使用次数最少的应用程序假设为后台应用程序j3,其排序为n1,即posnumber j3=n1。
可理解的是,在关于score k的表达式中,0<w1≤1,0≤w2<1,0≤w3<1且0≤w4<1。例如,如果在确定被杀优先级时不考虑被使用次数,那么可以设定w4=0。
在步骤430,基于多个应用程序各自的被杀优先级,将多个应用程序中的至少一个应用程序杀掉。
在一些实施例中,如果在步骤410基于第一周期确定第一可用内存,那么在步骤430,可以将具有最高被杀优先级(对应公式1的得分最高)的预设数量的应用程序杀掉。预设数量可以为任一正整数,如1。在一例,可以将具有最高被杀优先级的一个应用程序(处于后台状态)杀掉。
在一些实施例中,如果在步骤410基于待启动应用程序确定第一可用内存,那么在步骤430,可以将具有最高被杀优先级的至少一个应用程序杀掉,使得至少一个应用程序被杀掉之后的内存满足处于待启动状态的应用程序的启动后占用内存。
举例而言,假设处于待启动状态的应用程序的启动后占用内存可以被表示为S01,第一可用内存可以被表示为S02,且S02<S01。在一例中,如果具有最高被杀优先级的应用程序的占用内存为S11,且S11+S02>S01,那么可以将具有最高被杀优先级的应用程序杀掉。在另一例中,如果具有最高被杀优先级的应用程序的占用内存为S21,具有次高被杀优先级的应用程序的占用内存为S22,且S21+S02<S01,S21+S22+S02>S01,那么可以将具有最高被杀优先级的应用程序和具有次高被杀优先级的应用程序杀掉。
本公开的实施例中,杀掉(kill)应用程序是指将应用程序的进程关闭并释放该应用程序的占用内存。
如上,本公开的实施例中基于占用内存来确定被杀优先级,这样可以在可用内存不足时,及时将占用内存较大的应用程序杀掉,从而能够更有效地实现内存释放。在存在要启动的应用程序时,能够更快地满足业务需求。另外附加地或可选地,还可以基于在后台应用程序列表中的位置来确定被杀优先级,这样可以在内存不足时,优先杀掉更早使用过的应用程序,由于相对而言用户可能对更早使用过的应用程序的再次使用的需求较低,因此将更早使用过的应用程序杀掉对用户的使用需求的影响较小。另外附加地或可选地,还可以基于被使用次 数来确定被杀优先级,这样可以在内存不足时,优先将不频繁使用的应用程序杀掉,避免用户在使用哪些频繁使用的应用程序时需要重新启动的时间消耗,提升了用户体验。另外附加地或可选地,还可以基于启动耗时来确定被杀优先级,这样在内存不足时,可以优先将启动耗时短的应用程序杀掉,避免用户要使用被杀掉的应用程序时,再次等待过长的启动耗时,提升了用户体验。
如此,本公开的实施例可以在电子设备的内存不足时,基于处于后台状态的应用程序的占用内存,将处于后台状态的至少一个应用程序杀掉,这样能够确定电子设备的使用内存,避免因内存不足导致的电子设备性能变差甚至不可用,提升用户的体验。
附加地或可选地,在将处于后台状态的至少一个应用程序杀掉之后,还可以在内存充足的情况下,将被杀掉的至少一个应用程序重新启动。
图5示出了根据本公开的一些实施例的被杀掉的至少一个应用程序重新启动的过程500的示意流程图。
在步骤510,将被杀掉的至少一个应用程序的相关信息添加到信息列表。
在一些实施例中,应用程序的相关信息可以包括关于以下至少一项的信息:标识、启动后占用内存、在预设时长内的被使用次数、或者上一次被启动时的耗时。标识可以被表示为应用程序的名称、应用程序的标识符或者其他形式等。
本公开的实施例对信息列表的具体形式不作限定,例如信息列表可以包括条目,一个条目对应一个应用程序。
在步骤520,确定电子设备的第二可用内存。
在一些实施例中,电子设备可以周期性地或者基于事件触发地来确定第二可用内存。
举例而言,可以基于第二周期而周期性地确定第二可用内存。电子设备中可以设置有第二定时器,该第二定时器启动时可以具有初始值,当该第二定时器的值达到预定值时,确定第二可用内存。附加地或可选地,在该第二定时器的值达到预定值后,可以被重置为初始值,并重新计时。作为一例,初始值可以等于0,预定值可以等于第二周期。作为另一例,初始值可以等于第二周期,预定值可以等于0。第二周期的值可以是基于实际需求所预先设定的,例如电子设备可以具有出厂设置的第二周期,或者,用户可以根据自己的需求调整第二周期,本公开对此不限定。
在信息列表不为空的情况下,第二定时器可以处于运行中。换句话说,当信息列表为空时,第二定时器可以停止计时。当信息列表中被加入至少一个应用程序的相关信息时,启动第二定时器。
举例而言,可以基于应用程序退出而确定第二可用内存。具体地,可以检测被退出的应用程序的占用内存,如果确定存在退出的应用程序且退出的应用程序所释放的内存高于第一设定值,则确定第二可用内存。可选地,本公开的实施例中可以将占用内存高于第一设定值的应用程序称为大内存应用程序,例如相机或手游等。示例性地,第一设定值可以基于电子设备的总内存、电子设备的处理器的处理速度等进行预先设定。另外第一设定值的形式可以是具体的内存大小,其量纲为MB或kB等;或者第一设定值的形式可以是相对于总内存的比例,其量纲为1,如百分比的形式。本公开对此不限定。
应理解的是,本公开实施例中的杀掉和退出是针对应用程序的不同的操作。一般地,退出是基于用户指令的,举例而言,用户可以将处于前台或后台状态的应用程序退出,例如用户将某应用程序从后台应用程序中删除,进而将该应用程序退出。一般地,杀掉不是基于用 户操作的,电子设备可以基于内存占用的情况,动态地将处于后台状态的应用程序杀掉,被杀掉的应用程序没有被完全退出,而是将其相关信息添加到信息列表中,并且在此之后可以在用户针对该应用程序无操作的情况下,基于内存占用的情况再次启动到后台状态。但是应注意,这里对于杀掉和退出的解释仅是示意性的,便于理解两者的区别,但是不应解释为对本公开的实施例的限定。
被确定的第二可用内存的形式可以是具体的内存大小,其量纲为MB或kB等;或者第二可用内存的形式可以是相对于总内存的比例,其量纲为1,如百分比的形式。本公开对此不限定。但是应理解,本公开实施例的中第二用内存和第一设定值具有相同的量纲。
在步骤522,确定第二可用内存是否高于第二设定值。如果确定第二可用内存不高于第二设定值,则返回步骤520。如果确定第二可用内存高于第二设定值,则继续执行步骤530。
在步骤530,至少基于信息列表中各个应用程序的启动后占用内存,确定信息列表中各个应用程序的启动优先级,其中第二设定值高于第一设定值。
也就是说,如果第二可用内存高于第二设定值,则确定信息列表中各个应用程序的启动优先级。
可选地,可以在第二可用内存高于第二设定值并且满足下面的(1)-(3)中至少一项时,确定信息列表中各个应用程序的启动优先级,其中(1)处理器的占用率低于第一阈值,(2)输入/输出带宽占用率低于第二阈值,(3)网络带宽占用率低于第三阈值。
在一些实施例中,可以在第二可用内存高于第二设定值并且同时满足(1)-(3)时,确定各个应用程序的启动优先级。如结合图6所描述的。图6示出了根据本公开的一些实施例的确定启动优先级的过程600的示意流程图。
在步骤610,确定第二可用内存。
在步骤620,确定第二可用内存是否高于第二设定值。如果确定第二可用内存高于第二设定值,则继续执行步骤630,否则返回执行步骤610。
在一些实施例中,第二设定值高于第一设定值,举例而言,第二设定值等于第一设定值的1.5倍或者其他的大于1的倍数。
在步骤630,确定处理器的占用率是否低于第一阈值。如果确定处理器的占用率低于第一阈值,则继续执行步骤640,否则返回执行步骤610。
第一阈值可以基于处理器的处理能力(如处理速度等)进行设定。举例而言,第一阈值等于25%或30%或其他值。
在步骤640,确定输入/输出(Input/Output,I/O)带宽占用率是否低于第二阈值。如果确定I/O占用率低于第二阈值,则继续执行步骤650,否则返回执行步骤610。
第二阈值可以基于输入输出总线的传输速率等进行设定。举例而言,第二阈值等于64kB/s或者200kB/s或其他值。
在步骤650,确定网络带宽占用率是否低于第三阈值。如果确定网络带宽占用率低于第三阈值,则继续执行步骤660,否则返回执行步骤610。
第三阈值可以基于电子设备的带宽传输速率等进行设定。举例而言,第三阈值等于64kB/s或者100kB/s或其他值。
在过程600,返回执行步骤610可以包括:重置第二定时器,或者重新确定是否存在退出的应用程序且该退出的应用程序所释放的内存高于第一设定值。
在步骤660,确定信息列表中各个应用程序的启动优先级。
可理解,图6的过程600仅是示意,例如本公开的实施例对图6中的步骤630-650的执行顺序的先后不做限定。尽管图6中示出的是先执行步骤630,再依次执行步骤640和步骤650。但是在实际场景中,可以先执行步骤630-650中的任一步骤,然后再执行剩余的两个步骤。
本公开的实施例中,可以至少基于信息列表中各个应用程序的启动后占用内存,确定信息列表中各个应用程序的启动优先级。可选地,各个应用程序的启动优先级还可以进一步地基于以下至少一项被确定:各个应用程序在信息列表中的位置,各个应用程序在预设时长内的被使用次数,或者各个应用程序上一次被启动时的耗时。
各个应用程序在信息列表中的位置可以被表示为序号的形式,如1、2、…等。示例性地,各个应用程序在信息列表中的位置可以取决于应用程序被杀掉(或被添加到信息列表中)的先后。具体的,被杀掉的时间越近,位置的序号越小;相反,被杀掉的时间越远,位置的序号越大。也就是说,在信息列表中的时间越长,在信息列表中的位置的序号越大。
另外,关于各个应用程序在预设时长内的被使用次数或者各个应用程序上一次被启动时的耗时的具体含义,可以参照上述结合图4所描述的实施例,这里不再重复。
应用程序在信息列表中的位置可以是基于从后台状态被加入到信息列表中的先后顺序而被确定的。并且,被加入到信息列表中越晚,则启动优先级越高。另外,在预设时长内的被使用次数越多,启动优先级越高。在被启动时的耗时越长,启动优先级越高。
可选地,可以基于应用程序的启动后占用内存、应用程序在信息列表中的位置、应用程序在预设时长内的被使用次数、应用程序的启动耗时这四个参数一起来确定表示启动优先级的总分值。作为一例,可以基于应用程序的启动后占用内存确定第五分值,可以基于应用程序在信息列表中的位置确定第六分值,可以基于应用程序在预设时长内的被使用次数确定第七分值,基于应用程序的启动耗时确定第八分值,并且可以基于第五分值至第八分值得到表示启动优先级的总分值。
示例性地,在确定信息列表中各个应用程序的启动优先级时,启动后占用内存、以及在信息列表中的位置、被使用次数和上一次被启动时的耗时中的至少一项分别具有预设权重。
在一些实施例中,可以通过下式确定信息列表中各个应用程序的得分,并基于得分来确定启动优先级,其中得分越低表示启动优先级越高:
Figure PCTCN2022112034-appb-000002
在上式中,score t表示信息列表中第t个应用程序的得分,w1、w2、w3和w4分别表示权重,且w1+w2+w3+w4=1,mem t表示第t个应用程序被启动后的占用内存,posorder t表示第t个应用程序在信息列表中的位置,postime t表示基于上一次被启动时的耗时从长到短,第t个应用程序在信息列表中多个应用程序中的排序,posnumber t表示基于在预设时长内的被使用次数从多到少,第t个应用程序在信息列表中多个应用程序中的排序,n2表示信息列表中的应用程序的数量。
可理解的是,在关于score t的表达式中,0<w1≤1,0≤w2<1,0≤w3<1且0≤w4<1。例如,如果在确定启动优先级时不考虑被使用次数,那么可以设定w4=0。可理解的是,公式2中的w1、w2、w3和w4与公式1中w1、w2、w3和w4可以是对应相等的,也就是说,在考虑启动优先级和被杀优先级时各项的权重分别相等,如此能够确保在杀掉和 启动时的一致性。
在步骤540,至少基于各个应用程序的启动优先级,在后台启动信息列表中的一个或多个应用程序。
在一些实施例中,如果在步骤520基于第二周期而确定第二可用内存,那么在步骤540,可以将具有最高启动优先级(对应公式2的得分最低)的预设数量的应用程序启动。预设数量可以为任一正整数,如1。
在一些实施例中,如果在步骤520基于退出的应用程序释放的内存高于第一预定值而确定第二可用内存,那么在步骤540,可以将具有最高启动优先级的至少一个应用程序启动,使得至少一个应用程序被启动之后,可用内存依然高于第一设定值。
举例而言,假设具有最高启动优先级的应用程序(假设为APP11)启动后占用内存为S31,具有次高启动优先级的应用程序(假设为APP12)启动后占用内存为S32。如果APP11和APP12都被启动后,可用内存依然高于第一设定值,则可以将APP11和APP12都启动。相反,如果APP11被启动后,可用内存高于第一设定值;但是APP11和APP12都被启动后,可用内存低于第一设定值,则可以仅将APP11启动,而APP12的相关信息依然被保留在信息列表中。
这样,能够更高效地且更快地恢复被杀掉的应用程序,避免用户再次使用时重新启动的耗时,从而本公开实施例的方案能够提升用户体验。
本公开的实施例中,从信息列表中启动应用程序也可以被称为将信息列表中的应用程序恢复为后台状态,也就是说,从信息列表中被启动的应用程序将处于后台状态。具体的,在从信息列表中启动应用程序时,可以关闭该应用程序的界面和声音等,避免对用户正在使用的其他应用程序造成影响。
另外,可理解,在步骤540之后,还可以将启动的一个或多个应用程序的相关信息从信息列表中删除。
以上结合图4至图6较为详细的描述了本公开的实施例的过程,但是应当理解,上述的实施例仅是示意,例如过程可以包括更多或更少的步骤。另外,尽管上述实施例分别以公式1和公式2示出了被杀优先级和启动优先级的一种确定方式,但是本公开的实施例也可以通过其他的方式来分别确定被杀优先级和启动优先级,或者本公开的实施例可以将公式1和公式1结合,由一种方式来表示确定被杀优先级和启动优先级的过程。
通过本公开的内存管理的方案,能够在内存不足时及时地至少基于占用内存来杀掉处于后台状态的至少一个应用程序,以此能够确保用户使用电子设备的顺畅感,提升了用户体验。另外,在内存恢复充足时还可以至少基于启动后占用内存将被杀掉的应用程序恢复启动,避免用户再次使用时手动启动的耗时。
另外,可理解的是,如上图2或图3所示的电子设备可以用于实现如结合图4至图6所描述的本公开的实施例的过程。
本公开的实施例还提供了一种芯片,该芯片可以包括输入接口、输出接口和处理电路。在本公开的实施例中,可以由输入接口和输出接口完成信令或数据的交互,由处理电路完成信令或数据信息的生成以及处理。
本公开的实施例还提供了一种芯片***,包括处理器,用于支持电子设备以实现上述任一实施例中所涉及的功能。在一种可能的设计中,芯片***还可以包括存储器,用于存储必要的程序指令和数据,当处理器运行该程序指令时,使得安装该芯片***的设备实现上述任 一实施例中所涉及的方法。示例性地,该芯片***可以由一个或多个芯片构成,也可以包含芯片和其他分立器件。
本公开的实施例还提供了一种处理器,用于与存储器耦合,存储器存储有指令,当处理器运行所述指令时,使得处理器执行上述任一实施例中涉及的方法和功能。
本公开的实施例还提供了一种包含指令的计算机程序产品,其在计算机上运行时,使得计算机执行上述各实施例中任一实施例中涉及的方法和功能。
本公开的实施例还提供了一种计算机可读存储介质,其上存储有计算机指令,当电子设备运行所述指令时,使得电子设备执行上述任一实施例中涉及的方法和功能。
通常,本公开的各种实施例可以以硬件或专用电路、软件、逻辑或其任何组合来实现。一些方面可以用硬件实现,而其他方面可以用固件或软件实现,其可以由控制器,微处理器或其他计算设备执行。虽然本公开的实施例的各个方面被示出并描述为框图,流程图或使用一些其他图示表示,但是应当理解,本文描述的框,装置、***、技术或方法可以实现为,如非限制性示例,硬件、软件、固件、专用电路或逻辑、通用硬件或控制器或其他计算设备,或其某种组合。
本公开还提供有形地存储在非暂时性计算机可读存储介质上的至少一个计算机程序产品。该计算机程序产品包括计算机可执行指令,例如包括在程序模块中的指令,其在目标的真实或虚拟处理器上的设备中执行,以执行如上参考附图的过程/方法。通常,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、库、对象、类、组件、数据结构等。在各种实施例中,可以根据需要在程序模块之间组合或分割程序模块的功能。用于程序模块的机器可执行指令可以在本地或分布式设备内执行。在分布式设备中,程序模块可以位于本地和远程存储介质中。
用于实现本公开的方法的计算机程序代码可以用一种或多种编程语言编写。这些计算机程序代码可以提供给通用计算机、专用计算机或其他可编程的数据处理装置的处理器,使得程序代码在被计算机或其他可编程的数据处理装置执行的时候,引起在流程图和/或框图中规定的功能/操作被实施。程序代码可以完全在计算机上、部分在计算机上、作为独立的软件包、部分在计算机上且部分在远程计算机上或完全在远程计算机或服务器上执行。
在本公开的上下文中,计算机程序代码或者相关数据可以由任意适当载体承载,以使得设备、装置或者处理器能够执行上文描述的各种处理和操作。载体的示例包括信号、计算机可读介质、等等。信号的示例可以包括电、光、无线电、声音或其它形式的传播信号,诸如载波、红外信号等。
计算机可读介质可以是包含或存储用于或有关于指令执行***、装置或设备的程序的任何有形介质。计算机可读介质可以是计算机可读信号介质或计算机可读存储介质。计算机可读介质可以包括但不限于电子的、磁的、光学的、电磁的、红外的或半导体***、装置或设备,或其任意合适的组合。计算机可读存储介质的更详细示例包括带有一根或多根导线的电气连接、便携式计算机磁盘、硬盘、随机存储存取器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或闪存)、光存储设备、磁存储设备,或其任意合适的组合。
此外,尽管在附图中以特定顺序描述了本公开的方法的操作,但是这并非要求或者暗示必须按照该特定顺序来执行这些操作,或是必须执行全部所示的操作才能实现期望的结果。相反,流程图中描绘的步骤可以改变执行顺序。附加地或备选地,可以省略某些步骤,将多个步骤组合为一个步骤执行,和/或将一个步骤分解为多个步骤执行。还应当注意,根据本公 开的两个或更多装置的特征和功能可以在一个装置中具体化。反之,上文描述的一个装置的特征和功能可以进一步划分为由多个装置来具体化。
以上已经描述了本公开的各实现,上述说明是示例性的,并非穷尽的,并且也不限于所公开的各实现。在不偏离所说明的各实现的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在很好地解释各实现的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其他普通技术人员能理解本文公开的各个实现方式。

Claims (14)

  1. 一种内存管理方法,包括:
    电子设备确定所述电子设备的第一可用内存;
    如果所述第一可用内存低于第一设定值,所述电子设备至少基于处于后台状态的多个应用程序中各个应用程序的占用内存,确定所述多个应用程序各自的被杀优先级;以及
    所述电子设备基于所述多个应用程序各自的被杀优先级,将所述多个应用程序中的至少一个应用程序杀掉。
  2. 根据权利要求1所述的方法,其中确定第一可用内存包括:
    所述电子设备基于第一周期,周期性地确定所述第一可用内存;或者,
    如果检测到处于待启动状态的应用程序的启动后占用内存高于所述第一设定值,所述电子设备确定所述第一可用内存。
  3. 根据权利要求1或2所述的方法,其中所述多个应用程序各自的被杀优先级还基于以下至少一项被确定:
    所述多个应用程序各自在后台应用程序列表中的位置,所述位置基于所述多个应用程序各自在最后一次从前台状态切换为后台状态的先后顺序被确定,
    所述多个应用程序各自在预设时长内的被使用次数,或者
    所述多个应用程序各自在被启动时的耗时;
    其中,应用程序最后一次从前台状态切换为后台状态的时间越早、在预设时长内的被使用次数越少、在被启动时的耗时越短,则被杀优先级越高。
  4. 根据权利要求3所述的方法,其中在确定所述多个应用程序各自的被杀优先级时,所述占用内存、以及在所述后台应用程序列表中的所述位置、所述被使用次数和所述耗时中的至少一项分别具有预设权重。
  5. 根据权利要求1至4中任一项所述的方法,还包括:
    所述电子设备将被杀掉的所述至少一个应用程序的相关信息添加到信息列表中。
  6. 根据权利要求5所述的方法,其中所述至少一个应用程序的相关信息包括关于以下至少一项的信息:标识、启动后占用内存、在预设时长内的被使用次数、或者上一次被启动时的耗时。
  7. 根据权利要求5或6所述的方法,还包括:
    所述电子设备确定所述电子设备的第二可用内存;
    如果所述第二可用内存高于第二设定值,所述电子设备至少基于所述信息列表中各个应用程序的启动后占用内存,确定所述信息列表中各个应用程序的启动优先级,所述第二设定值高于所述第一设定值;以及
    所述电子设备至少基于所述各个应用程序的启动优先级,在后台启动所述信息列表中的一个或多个应用程序。
  8. 根据权利要求7所述的方法,其中确定第二可用内存包括:
    所述电子设备基于第二周期,周期性地确定所述第二可用内存;或者,
    如果确定存在退出的应用程序且所述退出的应用程序所释放的内存高于所述第一设定值,所述电子设备确定所述第二可用内存。
  9. 根据权利要求7或8所述的方法,其中确定所述启动优先级包括:
    如果所述第二可用内存高于所述第二设定值并且以下至少一项被满足,所述电子设备确定所述启动优先级:
    处理器的占用率低于第一阈值,
    输入/输出带宽占用率低于第二阈值,或
    网络带宽占用率低于第三阈值。
  10. 根据权利要求7至9中任一项所述的方法,其中所述信息列表中各个应用程序的启动优先级还基于以下至少一项被确定:
    所述各个应用程序在所述信息列表中的位置,所述在所述信息列表中的位置基于所述各个应用程序从后台状态被加入到所述信息列表中的先后顺序被确定,
    所述各个应用程序在预设时长内的被使用次数,或者
    所述各个应用程序上一次被启动时的耗时;
    其中,应用程序被加入到信息列表中的时间越晚、在预设时长内的被使用次数越多、在被启动时的耗时越长,则启动优先级越高。
  11. 根据权利要求10所述的方法,其中在确定所述启动优先级时,所述启动后占用内存、以及在所述信息列表中的所述位置、所述被使用次数和所述上一次被启动时的耗时中的至少一项分别具有预设权重。
  12. 一种电子设备,包括处理器和存储器,所述存储器上存储有由所述处理器执行的指令,当所述指令被所述处理器执行时使得所述电子设备实现根据权利要求1至11中任一项所述的方法。
  13. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可执行指令,所述计算机可执行指令被电子设备执行时,使得所述电子设备实现根据权利要求1至11中任一项所述的方法。
  14. 一种计算机程序产品,所述计算机程序产品上包含计算机可执行指令,所述计算机可执行指令在被计算机执行时,使得计算机实现根据权利要求1至11中任一项所述的方法。
PCT/CN2022/112034 2021-09-30 2022-08-12 内存管理方法、电子设备、计算机存储介质和程序产品 WO2023051056A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111161913.8A CN115904686A (zh) 2021-09-30 2021-09-30 内存管理方法、电子设备、计算机存储介质和程序产品
CN202111161913.8 2021-09-30

Publications (1)

Publication Number Publication Date
WO2023051056A1 true WO2023051056A1 (zh) 2023-04-06

Family

ID=85729484

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/112034 WO2023051056A1 (zh) 2021-09-30 2022-08-12 内存管理方法、电子设备、计算机存储介质和程序产品

Country Status (2)

Country Link
CN (1) CN115904686A (zh)
WO (1) WO2023051056A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2538327A1 (en) * 2011-06-16 2012-12-26 Samsung Electronics Co., Ltd. Adaptive Termination and Pre-Launching Policy for Improving Application Startup Time
CN106371913A (zh) * 2015-07-21 2017-02-01 赤子城网络技术(北京)有限公司 内存清理方法及装置
CN107220076A (zh) * 2016-09-27 2017-09-29 华为技术有限公司 一种内存回收方法及装置
CN109117256A (zh) * 2018-07-12 2019-01-01 维沃移动通信有限公司 一种后台应用程序的管理方法及终端
CN109614168A (zh) * 2018-12-11 2019-04-12 深圳美图创新科技有限公司 内存优化方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2538327A1 (en) * 2011-06-16 2012-12-26 Samsung Electronics Co., Ltd. Adaptive Termination and Pre-Launching Policy for Improving Application Startup Time
CN106371913A (zh) * 2015-07-21 2017-02-01 赤子城网络技术(北京)有限公司 内存清理方法及装置
CN107220076A (zh) * 2016-09-27 2017-09-29 华为技术有限公司 一种内存回收方法及装置
CN109117256A (zh) * 2018-07-12 2019-01-01 维沃移动通信有限公司 一种后台应用程序的管理方法及终端
CN109614168A (zh) * 2018-12-11 2019-04-12 深圳美图创新科技有限公司 内存优化方法及装置

Also Published As

Publication number Publication date
CN115904686A (zh) 2023-04-04

Similar Documents

Publication Publication Date Title
WO2020259452A1 (zh) 一种移动终端的全屏显示方法及设备
US11573829B2 (en) Task processing method and apparatus, terminal, and computer readable storage medium
WO2021115007A1 (zh) 一种网络切换方法及电子设备
WO2021052415A1 (zh) 资源调度方法及电子设备
CN109981885B (zh) 一种电子设备在来电时呈现视频的方法和电子设备
CN112492193B (zh) 一种回调流的处理方法及设备
CN111913750B (zh) 一种应用程序管理方法、装置及设备
WO2021159746A1 (zh) 文件共享方法、***及相关设备
WO2021052200A1 (zh) 一种设备能力调度方法及电子设备
WO2021036898A1 (zh) 折叠屏设备中应用打开方法及相关装置
WO2021036830A1 (zh) 一种折叠屏显示应用方法及电子设备
EP4152782A1 (en) Message pushing method and apparatus
CN112181616B (zh) 任务处理方法及相关装置
CN110636554B (zh) 数据传输方法及装置
CN111078376A (zh) 一种进程管理方法及设备
CN113805797A (zh) 网络资源的处理方法、电子设备及计算机可读存储介质
CN113760191B (zh) 数据读取方法、装置、存储介质和程序产品
WO2022188511A1 (zh) 语音助手唤醒方法及装置
CN115729684B (zh) 输入输出请求处理方法和电子设备
WO2023051056A1 (zh) 内存管理方法、电子设备、计算机存储介质和程序产品
CN116700913A (zh) 嵌入式文件***的调度方法、设备及存储介质
CN115878500A (zh) 内存回收方法、装置、电子设备及可读存储介质
WO2024007970A1 (zh) 线程调度方法及电子设备
CN116723384B (zh) 进程的控制方法、电子设备及可读存储介质
WO2023005783A1 (zh) 数据处理方法及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22874451

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE