CN115525404B - Method, device and storage medium for releasing memory - Google Patents

Method, device and storage medium for releasing memory Download PDF

Info

Publication number
CN115525404B
CN115525404B CN202210161930.XA CN202210161930A CN115525404B CN 115525404 B CN115525404 B CN 115525404B CN 202210161930 A CN202210161930 A CN 202210161930A CN 115525404 B CN115525404 B CN 115525404B
Authority
CN
China
Prior art keywords
application
memory
frozen
foreground
notification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210161930.XA
Other languages
Chinese (zh)
Other versions
CN115525404A (en
Inventor
王红照
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202210161930.XA priority Critical patent/CN115525404B/en
Publication of CN115525404A publication Critical patent/CN115525404A/en
Application granted granted Critical
Publication of CN115525404B publication Critical patent/CN115525404B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • 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

Landscapes

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

Abstract

The embodiment of the application provides a method, equipment and a storage medium for releasing a memory, wherein the method comprises the following steps: when the application is put in the background, determining a process corresponding to the application as a process to be frozen; releasing the memory occupied by the process to be frozen in a forced recovery mode; freezing the process to be frozen. Before the process is frozen, the method actively triggers the process to be frozen to release the memory in a forced recovery mode, so that memory resources which can be released by the process to be frozen are increased, and the problem that the process of the background application occupies excessive memory resources of the electronic equipment is solved.

Description

Method, device and storage medium for releasing memory
Technical Field
The present application relates to the field of memory management technologies, and in particular, to a method, an apparatus, and a storage medium for releasing a memory.
Background
In an electronic device, each process of an application includes a memory allocator, through which the process obtains memory (also called random access memory, random Access Memory, RAM) required for operation from an Operating System (OS). When the application is switched to background operation, the corresponding process releases the memory to the OS through the memory allocator. When the memory is released, some memory allocators only release a portion of the acquired memory, and the remaining portion of the memory is still held by the memory allocator.
The process of the background application occupies excessive memory of the electronic device, so that the operation of other processes is adversely affected.
Disclosure of Invention
The application provides a method, equipment and a storage medium for releasing memory, which are used for avoiding excessive memory occupation of a process of background application.
In order to achieve the above object, the present application provides the following technical solutions:
the first aspect of the present application provides a method for releasing a memory, including:
when an application is placed in a background, determining a process corresponding to the application as a process to be frozen;
releasing the memory occupied by the process to be frozen in a forced recovery mode;
and freezing the process to be frozen.
The beneficial effects of this embodiment lie in:
after the application is put in the background, the memory is released by actively triggering the process to be frozen corresponding to the application in the background in a forced recovery mode, so that the memory occupied by the process to be frozen can be released to the operating system as much as possible, the problem that the process of the background application occupies excessive memory resources is solved, and the smoothness of application operation of the foreground of the electronic equipment is improved.
In some optional embodiments, when the application is placed in the background, before determining the process corresponding to the application as the process to be frozen, the method further includes:
And responding to the user operation, and putting the application currently running in the foreground in the background.
The user operation may be an operation of returning to the desktop, opening other applications, and the like.
Illustratively, when the video application is running in the foreground, the electronic device opens the chat application in response to a click operation of the chat message popped up from the top of the display screen by the user, while placing the video application currently running in the foreground in the background
In some optional embodiments, when the application is placed in the background, before determining the process corresponding to the application as the process to be frozen, the method further includes:
and when the electronic equipment is in screen off state, putting the application running in the foreground in the background.
The beneficial effects of this embodiment lie in:
after the screen is turned off, the application running in the foreground is switched to the background, so that the power consumption of the electronic equipment can be reduced.
In some optional embodiments, when the application is placed in the background, before determining the process corresponding to the application as the process to be frozen, the method further includes:
judging whether the application has a foreground perceivable function or not;
and if the application has no foreground perceivable function, executing the step of determining the process corresponding to the application as a process to be frozen.
The beneficial effects of this embodiment lie in:
The application with the foreground perceivable function is prevented from being frozen, so that the electronic equipment can provide partial functions of the application running in the background while running the foreground application.
By way of example, the function of broadcasting navigation information by the navigation application belongs to the foreground perceivable function, and by the method of the embodiment, the navigation application in the background can be prevented from being frozen, so that the electronic device can broadcast the navigation information while running other applications.
In some alternative embodiments, the determining whether the application has a foreground perceivable function includes:
judging whether the application has a foreground perceivable function according to a foreground perceivable application list, wherein the foreground perceivable application list is used for recording the application with the foreground perceivable function.
In some alternative embodiments, the operating system of the electronic device includes a power saving application and a memory management service; the process to be frozen comprises a function library and a memory allocator;
the releasing the memory occupied by the process to be frozen by the forced recycling mode comprises the following steps:
the power saving application sends a prefreezing notification to the memory management service, wherein the prefreezing notification carries a process identifier of the process to be frozen;
The memory management service sends a memory release signal to a function library of the process to be frozen according to the process identification of the process to be frozen;
the function library responds to the memory release signal and calls a forced release interface of the memory distributor;
and the memory allocator releases the memory occupied by the process to be frozen according to a forced recovery mode.
In some alternative embodiments, the operating system of the electronic device further comprises a freezer;
the freezing the process to be frozen comprises the following steps:
the power saving application transmits a process freezing notification to the freezer, wherein the process freezing notification carries a process identifier of the process to be frozen;
and the freezer freezes the process to be frozen according to the process identification of the process to be frozen.
In some alternative embodiments, the power saving application issues a process freeze notification to the freezer, comprising:
and after the power saving application obtains the notification of the completion of the memory release reported by the memory distributor, issuing a process freezing notification to the freezer.
The beneficial effects of this embodiment lie in:
the power saving application freezes the process after receiving the notification of the completion of the memory release, and can ensure that the process to be frozen is frozen after the memory distributor releases the memory as much as possible, thereby avoiding the frozen process from occupying the memory resource of the electronic equipment.
In some alternative embodiments, the power saving application issues a process freeze notification to the freezer, comprising:
and the power-saving application transmits a process freezing notification to the freezer after transmitting the prefreezing notification and the preset waiting time.
A second aspect of the application provides an electronic device comprising a memory and one or more processors;
the memory is used for storing a computer program.
The one or more processors are configured to execute the computer program, and in particular, to implement the method for freeing memory provided in any one of the first aspects of the present application.
A third aspect of the present application provides a computer storage medium storing a computer program, which when executed is specifically adapted to carry out the method for freeing memory provided in any one of the first aspects of the present application.
The embodiment of the application provides a method, equipment and a storage medium for releasing a memory, wherein the method comprises the following steps: when the application is put in the background, determining a process corresponding to the application as a process to be frozen; releasing the memory occupied by the process to be frozen in a forced recovery mode; freezing the process to be frozen. Before the process is frozen, the method actively triggers the process to be frozen to release the memory in a forced recovery mode, so that memory resources which can be released by the process to be frozen are increased, and the problem that the process of the background application occupies excessive memory resources of the electronic equipment is solved.
Drawings
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 2 is a schematic diagram of a user interface of an electronic device according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a user interface of another electronic device according to an embodiment of the present application;
fig. 4 is a schematic diagram of a software architecture according to an embodiment of the present application;
FIG. 5 is a timing diagram of a method for releasing a memory according to an embodiment of the present application;
FIG. 6 is a timing diagram illustrating another method for releasing memory according to an embodiment of the present application;
FIG. 7 is a flowchart of a method for releasing memory according to an embodiment of the present application;
fig. 8 is a flowchart of another method for releasing memory according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. The terminology used in the following examples is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include, for example, "one or more" such forms of expression, unless the context clearly indicates to the contrary. It should also be understood that in embodiments of the present application, "one or more" means one, two, or more than two; "and/or", describes an association relationship of the association object, indicating that three relationships may exist; for example, a and/or B may represent: a alone, a and B together, and B alone, wherein A, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship.
For clarity and conciseness in the description of the following embodiments, related technical terms or techniques related to the present application will be briefly described first:
a memory allocator. In a hierarchical system, both the kernel layer and Native layer have their own memory allocators, which may also be referred to as custom memory allocators. The process in the system can call the user-state memory allocator through the malloc or new function, thereby applying for memory resources. Common user-state memory allocators are Scudo, jemuloc, etc. For convenience of distinction, hereinafter, the user-mode memory allocator will be collectively referred to as a memory allocator, and the memory allocator of the kernel layer will be referred to as a memory management module.
The user-state memory allocator may release the applied memory resources by daily reclamation or forced reclamation.
Daily reclamation (lazy garbage collection, lazyGC), a way for memory allocators to release memory. When the memory allocator releases the memory in a daily reclamation mode, based on performance consideration, the memory allocator does not return all idle memory occupied by the process to the operating system, but sets a certain reclamation threshold, and the memory exceeding the reclamation threshold is released to the operating system, and the memory in the reclamation threshold is still held by the memory allocator. When the process calls the free function to release the memory, the memory allocator of the process can release the memory resources in a daily recovery mode.
Forced reclamation (Force garbage collection, forceGC), another way for memory allocators to free memory. The memory allocator is typically configured with a forced release interface that, when invoked, releases memory in a forced reclamation manner. When the memory is released in a forced reclamation mode, a reclamation threshold is not set, and the memory allocator releases the idle memory occupied by the process to the operating system as much as possible. That is, the memory allocator may typically release more memory resources by forced reclamation than by daily reclamation.
And (5) compressing the memory. A method for recovering memory by a system kernel. Android systems typically implement memory compression based on zram swap technology. The basic principle of the zram swap technology is that a block of area is divided in the memory of the electronic equipment in advance to serve as a swap partition, when the allocatable memory resources are less, the kernel compresses the data in the occupied memory, and then the compressed data is stored in the swap partition of the memory. For example, the system kernel compresses data in the memory space occupied by 50MB, if the compression rate is 0.4, the compressed data only occupies 20MB of memory, i.e. through memory compression, the kernel recovers 30MB of allocable memory space.
The electronic equipment applying the method for releasing the memory provided by the application can be a mobile phone, a tablet personal computer, a handheld computer, a netbook, a personal digital assistant (Personal Digital Assistant, PDA), a wearable electronic equipment and other equipment, and the specific form of the electronic equipment applying the memory recycling method is not particularly limited.
Fig. 1 is a schematic structural diagram of an electronic device 100 to which the present application is applied. The electronic device 100 may include: processor 110, external memory 120, internal memory 121, universal serial bus (universal serial bus, USB) interface 130, charge management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headset interface 170D, sensor module 180, keys 190, motor 191, indicator 192, camera 193, display 194, and subscriber identity module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a communication processor (communication processor, CP, which may also be referred to as a modem), a graphics processor (graphics processing unit, GPU), and the like. The internal memory 121 may also be referred to as a random access memory (Random Access Memory, RAM), which is simply referred to as a memory, and the processor may exchange data directly with the RAM. RAM can be read from and written to at any time and has a high read-write speed, and therefore is typically used as a temporary data storage medium for an operating system or other program in operation.
The external memory 120 is typically a memory employing a nonvolatile storage medium, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), or the like.
The nonvolatile memory 130 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image, a video playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device (e.g., audio data, photos, videos, etc.), and so on.
The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 194 is used to display images, videos, and the like. The display 194 includes a display panel. The display panel may employ a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED) or an active-matrix organic light-emitting diode (matrix organic light emitting diode), a flexible light-emitting diode (flex), a mini, a Micro-OLED, a quantum dot light-emitting diode (quantum dot light emitting diodes, QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
A series of graphical user interfaces (graphical user interface, GUIs) may be displayed on the display 194 of the electronic device 100, all of which are home screens of the electronic device 100. Generally, the size of the display 194 of the electronic device 100 is fixed and only limited controls can be displayed in the display 194 of the electronic device 100. A control is a GUI element that is a software component contained within an application program that controls all data processed by the application program and interactive operations on that data, and a user can interact with the control by direct manipulation (direct manipulation) to read or edit information about the application program. In general, controls may include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, and the like.
For example, in an embodiment of the present application, when an application is running in the foreground, the display screen of the electronic device 100 may display the graphical user interface of the application, and when the application running in the foreground is switched to the background, the display screen does not display the graphical user interface of the application.
The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or a portion of the functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also referred to as a "horn," is used to convert audio electrical signals into sound signals. The electronic device 100 may listen to music, or to hands-free conversations, through the speaker 170A.
A receiver 170B, also referred to as a "earpiece", is used to convert the audio electrical signal into a sound signal. When electronic device 100 is answering a telephone call or voice message, voice may be received by placing receiver 170B in close proximity to the human ear.
Microphone 170C, also referred to as a "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can sound near the microphone 170C through the mouth, inputting a sound signal to the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, and may implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four, or more microphones 170C to enable collection of sound signals, noise reduction, identification of sound sources, directional recording functions, etc.
The earphone interface 170D is used to connect a wired earphone. The headset interface 170D may be a USB interface 130 or a 3.5mm open mobile electronic device platform (open mobile terminal platform, OMTP) standard interface, a american cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
In the embodiment of the present application, the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, and the earphone interface 170D may be occupied by an application running in the foreground or by an application running in the background.
For example, after a user starts a music application, the music application runs in the foreground, playing music using the audio module 170 and speaker 170A (or headphone interface 170D) of the electronic device 100. When the user exits the music application and opens the chat application, the music application enters background operation, which may still occupy the audio module 170 and speaker 170A (or headphone interface 170D) of the electronic device 100 to play music.
In the process of using the electronic device, a plurality of applications may be opened, and in this case, the electronic device runs the application that was opened last time in the foreground mode, and switches the application that was opened to the background. An application in foreground mode occupies a display device (e.g., a touch screen) and an input device of the electronic device and can interact with a user.
Applications that switch to the background may be in a background running or frozen state.
The background running means that the application program is in a background mode, does not occupy a display device and an input device of the electronic equipment, cannot interact with a user, and also occupies certain system resources, such as memory resources and CPU resources.
The frozen state refers to that an application program is frozen by the system, the application program in the frozen state stops running, does not occupy CPU resources, does not occupy (or occupies little) memory resources, and can be restored to the previous state to continue running when the application program in the frozen state is switched to the foreground running again.
In an actual scene, if the application switched to the background has a function perceivable by the foreground, for example, the navigation information is continuously broadcasted through voice when the navigation application is switched to the background, and music is continuously broadcasted when the music application is switched to the background, the electronic device continuously operates the application in the background mode.
If the application switched to the background has no perceivable function of the foreground, the electronic equipment freezes each process corresponding to the application, and the application enters a frozen state after the corresponding processes are frozen.
When a user opens a video application, the video application enters a foreground operation, at this time, a display screen of the electronic device is occupied by the video application, an interface of the video application shown in fig. 2 is displayed on the display screen, and the electronic device plays the video on the display screen through the video application.
When the user exits from the video application and opens the chat application, for example, when the user clicks on a message of the chat application popped up from the top of the display screen in fig. 2, the chat application enters into the foreground operation, and the video application is switched to the background. Accordingly, the display screen of the electronic device is occupied by the chat application, the interface of the chat application shown in fig. 3 is displayed on the display screen, and the video application switched to the background does not occupy the display screen any more.
The video application in the background mode does not have a foreground perceivable function, and thus the electronic device freezes the video application in the background. When the user restarts the video application in the frozen state, the video application can resume the video playing progress at the previous exit to continue playing the video.
Because the memory resources of the electronic device are limited, the operating system can actively recover the memory resources of the frozen process for other running processes.
In the related art, since the frozen process does not actively call the forced release interface, the operating system can only retrieve a part of the memory resources applied by the process from the frozen process, and the other part of the memory resources are reserved by the memory allocator of the process, and the part of the memory resources are still occupied by the frozen process, so that the memory resources cannot be allocated to other running processes by the operating system.
As an example, when the video application runs in the foreground, the process a corresponding to the video application applies for 10MB of memory through the memory allocator, and when the video application is switched to the background, the process a is frozen, and the operating system recovers the memory from the process a.
When the memory is recovered, the process A does not actively call the forced release interface, so the memory allocator does not release the memory in a forced recovery mode, so that a part of the memory (for example, 5MB memory) applied before is reserved by the memory allocator of the process A, and only a part of the memory is released to the operating system.
Therefore, if the memory is not released by the forced recovery before the process is frozen, the memory resources occupied by the frozen process may be excessive, and when the user opens a plurality of applications, the memory resources that can be allocated in the electronic device are too few, so that problems that the application running in the foreground cannot run smoothly and the like are caused.
The method for releasing the memory provided by the application can be applied to any memory distributor, and the specific type of the memory distributor is not limited in the embodiment. The memory allocator of the present application may be jemuloc or Scudo, for example.
In order to solve the problems, the application provides a method for releasing the memory, and by implementing the method, the electronic equipment can call the forced release interface of the memory distributor before the freezing process, so that the memory distributor releases the memory occupied by the process to be frozen in a forced recovery mode, thereby greatly reducing the memory resources occupied by the frozen process and ensuring the normal operation of other processes in an operation state.
The method for releasing the memory provided by the application can be applied to the electronic equipment based on the Android operating system. The software architecture of the electronic device to which the present application is applied will be described below by taking an Android system as an example.
Fig. 4 is a schematic diagram of a software architecture of an electronic device according to an embodiment of the present application.
In this embodiment, the software system of the electronic device adopts a layered architecture, and is specifically divided into an application layer, an application framework layer, a system library (also called Native layer) and a kernel layer.
Only some of the layers and components associated with embodiments of the present application are shown in fig. 4, and in practice, layers and components not shown in fig. 4 may be included. Of course, only some of the components shown in fig. 4 may be included.
The application layer includes a variety of applications, such as in this embodiment, cell phone steward 201, chat, video, and navigation applications. Wherein the cell phone manager application includes a power saving application component 202. The power saving application is common power saving software in the electronic equipment based on the Android system, in the practical application, the power saving application can start a power saving mode based on user operation, control some power consuming hardware and setting items conveniently, and find and prompt the application and service with larger background power consumption.
In this embodiment, the power saving application may also discover an application that is switched from the foreground to the background, and issue a process freeze notification to the kernel layer when discovering an application that is switched to the background, thereby freezing a process corresponding to the application that is switched to the background.
In some alternative embodiments, other components of other applications may discover applications that switch to the background and issue a process freeze notification, and this embodiment is not limited to applications that specifically implement this function, and the above power saving application component is only an example.
The application framework layer includes a memory management service 203, and a notification manager, content providing modules such as a window manager, a resource manager, a telephony manager, and a view system. The memory management service is used for managing and controlling memory resources of the scheduling electronic device, and the memory management service can be integrated into one component by using other services of the scheduling electronic device hardware resources of the application framework layer, and can also be used as an independent component of the application framework layer.
In this embodiment, the memory management service may trigger the memory allocator of the process to be frozen to perform forced reclamation by sending a signal to the process to be frozen.
The system library may include a plurality of functional modules such as a surface manager, a three-dimensional graphics processor library, a two-dimensional graphics engine, a media library, and the like. In this embodiment, the system library may include at least one function library and at least one memory allocator. Each process running on the electronic device has a corresponding function library and memory allocator in the system library. For example, in fig. 4, the electronic device runs a process to be frozen a (204) and a process to be frozen B (205), wherein the process to be frozen a includes a function library and a memory allocator, and the process to be frozen B also includes a function library and a memory allocator.
In some alternative embodiments, the library of functions may be libc.
The function library comprises a plurality of functions which are preconfigured, and when the functions in the function library are called, the function library can realize the functions corresponding to the functions. For example, when a signal is received by the function library, the memory release signal processing function corresponding to the signal in the function library is called by the process, so that the function library realizes the function corresponding to the memory release signal processing function.
And the memory allocator is used for applying the memory resources required by the running of the process to the memory management module of the kernel layer and releasing the memory resources occupied by the process at a proper time, for example, when the process calls a function for releasing the memory, such as a free function, the memory allocator releases the memory resources.
The memory management module generally divides the memory of the electronic device into a plurality of memory pages (i.e., pages), and manages the memory page by page. When the process skips the memory allocator to directly apply for the memory resource to the memory management module, the memory management module can only allocate the memory resource to the process by taking the page as a unit, but the memory size applied at a time when one process runs is mostly smaller than one memory page, which causes the waste of the memory resource. And the memory resource can be applied to the memory resource smaller than one memory page according to the actual requirement of the process by the memory distributor, so that the utilization rate of the memory resource is improved, and the memory resource is prevented from being wasted.
The kernel layer comprises a system layer security mechanism, memory management, a file system, process management, a network stack and a series of driving modules, and is a layer between hardware and software for providing interaction with the hardware.
In this embodiment, as shown in fig. 4, the kernel layer includes a freezer 206 (freezer) and a Memory Manager (MM). The memory management module is used for managing memory resources of the electronic equipment, and particularly provides interfaces for acquiring memory and releasing the memory.
For a clearer understanding of the above architecture diagram, please refer to fig. 5, which is a timing diagram illustrating a method for releasing memory based on the software architecture implementation shown in fig. 4.
Firstly, in order to implement the method provided by the application, the memory release signal quantity and the memory release signal processing function need to be preconfigured in the function library, and the operating system can load the memory release signal quantity and the memory release signal processing function into the function library when the electronic equipment is started.
The memory release signal processing function comprises a code triggering the memory distributor to execute forced recovery, and when the memory release signal processing function of the function library is called, the function library triggers the memory distributor to execute forced recovery.
A semaphore is understood to be a correspondence between a particular signal and an operation indicated by that signal. In this embodiment, the memory release signal is used to instruct the function library to trigger the memory allocator to perform forced recovery, and the operation of triggering the memory allocator to perform forced recovery is implemented by the memory release signal processing function, so that the memory release signal may be a correspondence between the memory release signal and the memory release signal processing function.
That is, based on the configured memory release signal amount and memory release signal processing function in the function library, after the process receives the memory release signal, the process can determine that the memory release signal processing function needs to be called according to the memory release signal amount, then the process calls the memory release signal processing function in the function library, and then the function library can trigger the memory allocator to execute forced recovery.
S01, the application is switched from the foreground to the background.
In some alternative embodiments, the application is executed in the foreground, and in response to a user' S put-in-background operation, step S01 is executed to switch from the foreground to the background.
In other alternative embodiments, the system may actively trigger the application to put in the background without requiring the user to perform the put in the background operation. For example, when the user does not operate the mobile phone for a period of time (for example, the mobile phone is not operated for 2 minutes), the mobile phone can automatically turn off the screen, and when the mobile phone turns off the screen, the mobile phone can actively trigger the current application to switch from the foreground to the background.
The application may be any application installed by the electronic device. By way of example, the application may be a video application, a navigation application, or a chat application as shown in FIG. 5.
Background operations, including any operations performed by a user, may cause an application currently running in the foreground to be switched to the background. In some examples, the put-in-background operation may be an operation to return to the desktop from the application currently running in the foreground, or an operation to switch from the application currently running in the foreground to another application.
As an example, after a user opens a video application of an electronic device, the electronic device runs the video application in the foreground, the user views the video in the video application, after a period of time, the user returns to the desktop from the video application through gesture operation or key operation, at this time, the video application is switched from the foreground to the background, and when the user returns to the desktop, the gesture operation or key operation performed by the user is the background operation.
As another example, referring to fig. 2, when the electronic device runs the video application in the foreground, the chat application running in the background mode receives a chat message sent by the server, and then pops up the chat message on top of the display screen of the electronic device, and the user clicks on the popped message on top of the display screen. The electronic device exits from the video application and opens the chat application in response to the clicking operation of the user, the chat application running in the background is switched to the foreground running, the display screen displays the interface of the chat application as shown in fig. 3, and at the same time, the video application executes step S01 and switches from the foreground to the background. At this time, the user clicks the chat message on the top of the display screen, i.e. the background operation is put.
S02, the application notifies the application to put in the background.
After the application executes step S01, step S02 is executed to the power saving application, that is, the power saving application is notified that the corresponding application is put in the background.
Continuing with the example of fig. 2, when the user clicks on the message of the chat application, the video application is put in the background, and then the video application performs step S02, thereby notifying the power saving application that the video application is switched to the background.
The application may notify the power saving application of the information of the application in the background in a plurality of ways, and the embodiment does not limit a specific notification manner.
In some alternative embodiments, the application may actively push the notification message switched to the background to the power saving application, where the notification message may carry an application identifier of the application, for example, a name of the application, and the power saving application may determine that the application is cut to the background after receiving the notification message. Or the power saving application can subscribe the event that each application is switched to the background in advance, and when the event that the application is switched to the background from the foreground occurs, the power saving application can find that the application is switched to the background through an event subscription mechanism.
S03, the power saving application judges whether the application has a foreground perceivable function.
After finding that an application cuts to the background, the power saving application executes step S03 to determine whether the application has a foreground perceivable function. If the application has no foreground perceivable function, step S04 is executed, if the application has a foreground perceivable function, the application cannot be frozen, and the application needs to be continuously operated in the background mode, and correspondingly, the memory occupied by the process corresponding to the application cannot be released, so that the method is ended.
In some alternative embodiments, when an application is put in the background, the electronic device may directly freeze the process corresponding to the application, regardless of whether the application has a foreground-perceivable function, and in this scenario, step S03 may not be performed. That is, step S03 is an optional step.
When the power saving mode of the electronic device is started, the electronic device can prohibit the application from running in the background, and the electronic device can directly freeze the process corresponding to the application when the application is placed in the background no matter whether the application has a foreground perceivable function or not, so that the power consumption is reduced.
When the electronic device installs the application from the application market, the class of the installed application, such as chat class, navigation class, shopping class, game class, etc., can be obtained from the application market, wherein some classes of application have the foreground perceivable function, and other classes of application do not have the foreground perceivable function. For example, music, navigation and chat applications have foreground perceivable functions, while shopping and gaming applications do not.
Thus, the power saving application may maintain a list of foreground-perceivable applications, which are marked as having a foreground-perceivable function or not having a foreground-perceivable function according to categories of newly installed applications obtained from the application market when the electronic device installs the new application. In this way, in step S03, the power saving application can query from the foreground-perceivable application list whether the application currently switched to the background has the foreground-perceivable function.
Further, the electronic device may prohibit a portion of the applications from running in the background based on the configuration of the user to reduce power consumption of the electronic device. When an application is prohibited from running in the background, the power saving application may mark the application as having no foreground perceivable function in the foreground perceivable application list, so that when the application is put in the background, the power saving application may freeze the application as follows.
Continuing with the example of fig. 2, after the video application is placed in the background, the electronic device queries whether the video application has a foreground perceivable function in the foreground perceivable application list, determines that the video application does not have the foreground perceivable function after the query, and then the electronic device executes step S04.
It should be noted that the above is only an exemplary implementation manner for determining whether the application has the foreground perceivable function by the power saving application, and in other embodiments of the present application, the power saving application may also determine whether the application has the foreground perceivable function by other manners, for example, the application may actively notify whether the power saving application itself has the foreground perceivable function. The specific determination method is not limited in this embodiment.
S04, the power saving application determines a process to be frozen.
After judging that the application switched to the background does not have the foreground perceivable function, the power saving application needs to freeze the process corresponding to the application, so that the power saving application executes step S04 to determine the process to be frozen.
One running application may correspond to one or more processes, and the process to be frozen described in S04 includes each process corresponding to the application currently being backed up. Taking fig. 4 as an example, an application corresponds to a process a and a process B, and when the application is put in the background, the determined process to be frozen includes a process to be frozen a and a process to be frozen B.
That is, in S04, the power saving application finds each process corresponding to the application runtime according to the application identifier of the application placed in the background, and determines the processes as the processes to be frozen.
The power saving application can find the process corresponding to the application in the background in various ways, and the specific searching way is not limited in this embodiment.
The power saving application may send an application identifier of the application placed in the background to the process management module of the kernel layer, and after the process management module finds each process corresponding to the application based on the application identifier, send the process identifiers (may be process names or process numbers) of the processes to the power saving application, so that the power saving application may determine that the processes corresponding to the process identifiers are processes to be frozen.
Continuing with the example of fig. 2, after the power-saving application determines that the video application is put in the background, the application identifier of the video application is sent to the kernel layer, so as to obtain the process identifier of the process corresponding to the video application fed back by the kernel layer, and determine that the process corresponding to the video application is the process to be frozen.
S05, the power saving application sends a prefreezing notification.
After determining the process to be frozen, the power saving application executes step S05 on the memory management service and sends a prefreezing notification.
The prefreezing notification carries a process identifier corresponding to the process to be frozen. The prefreezing notification is used for explaining to the memory management service that the process carried by the notification identifies that the corresponding process is to be frozen.
Continuing the previous example, after determining the process corresponding to the video application, the power saving application sends the process identifier of the process corresponding to the video application to the memory management service through the prefreezing notification described in S05, so as to indicate to the memory management service that the processes corresponding to the video application are to be frozen.
S06, the memory management service sends a memory release signal.
After receiving the prefreezing notification, the memory management service executes step S06 for each process to be frozen, and sends a memory release signal.
The specific form of the memory release signal may be configured according to the actual situation, so long as it is ensured that the memory release signal is different from other signals existing in the electronic device, which is not limited in this embodiment.
Continuing the previous example, after receiving the prefreezing notification, the memory management service obtains process identifiers of processes corresponding to the video application from the prefreezing notification, and then sends a memory release signal to the processes corresponding to the video application based on the process identifiers.
S07, calling the forced release interface by the function library.
After the process to be frozen receives the memory release signal, the function library of the process to be frozen executes step S07 to the memory distributor of the process, and the forced release interface is called.
As described above, the function library of the process to be frozen is preconfigured with the memory release semaphore and the memory release signal processing function, where the memory release semaphore may be regarded as a correspondence between the memory release signal and the memory release signal processing function.
It can be seen that after the process to be frozen receives the memory release signal, it can determine that the memory release signal processing function needs to be invoked according to the pre-configured memory release signal amount. Then, the process to be frozen calls the memory release signal processing function in the function library, so that the function library performs step S07.
The forced release interfaces provided by different memory allocators may or may not be identical. The specific form of the forced release interface is not limited in this embodiment.
As an example, when the memory allocator is Scudo, the forced release interface provided by Scudo may be mallopt (m_purge), i.e. in step S07, the function library may call mallopt (m_purge) to trigger the memory allocator Scudo to perform forced reclamation.
Continuing the previous example, after the video application corresponding processes receive the memory release signals, the function libraries of the processes call the forced release interfaces of the memory allocators, so as to trigger the memory allocators of the video application corresponding processes to execute forced recovery.
S08, the memory distributor releases the memory according to the forced recovery mode.
After the function library calls the forced release interface, the memory allocator of the process to be frozen calls the release memory interface of the memory management module of the kernel to execute step S08, and releases the memory in a forced recovery mode.
As described above, in step S08, the memory allocator releases the free memory occupied by the process to be frozen to the operating system as much as possible. Therefore, the memory allocator is triggered to release the memory in a forced recovery mode, so that the memory occupied by the process in the frozen state can be effectively reduced, and the operating system is ensured to have more memory resources which can be allocated to other running processes. Enabling running processes to run efficiently.
For ease of understanding, the present embodiment exemplifies steps S06 to S08 with only one process to be frozen. In an actual scenario, when an application is put in the background, the power-saving application may determine a plurality of applications to be frozen, so that the memory management service may send a memory release signal to each process to be frozen, and after each process to be frozen receives the memory release signal, each process to be frozen may call a memory release signal processing function in its function library, so that the function library of each process to be frozen may execute step S07, that is, call a forced release interface of a memory allocator of the process to be frozen, and finally, each memory allocator of the process to be frozen may release the memory occupied by the process in a forced recovery manner.
Continuing the previous example, after the function library of the corresponding process of the video application invokes the forced release interface, the memory allocator in the processes responds to the invocation of the forced release interface to start to release the memory occupied by the process corresponding to the video application in the forced recovery mode.
S09, the power saving application issues a process freezing notification.
The process freezing notification can carry the process identifier corresponding to each process to be frozen determined by the power saving application, and after the process freezing notification is received, the freezer of the kernel can freeze the process to be frozen corresponding to the process identifier carried by the notification, thereby realizing the freezing of the application placed in the background.
The power saving application may perform step S09 after transmitting the prefreezing notification. In this embodiment, in order to avoid being frozen before the process to be frozen completes the memory release, the power saving application may preset a waiting time, and after sending the prefreezing notification and the waiting time, the power saving application executes step S09 again, so as to ensure that each process to be frozen can release the memory completely within the waiting time.
The specific value of the waiting time may be set according to the actual situation, which is not limited in this embodiment. As one example, the latency may be set to 10 milliseconds (ms). That is, the power saving application waits 10ms after sending the prefreezing notification to the memory management service, and then issues the process freeze notification to the freezer.
Continuing the previous example, after sending the prefreezing notification to the memory management service, the power-saving application waits for 10ms, then sends the process freezing notification to the freezer of the kernel, the process freezing notification carries the process identifier of the corresponding process of the video application, and the freezer receives the process freezing notification and freezes the process corresponding to the video application.
The embodiment has the following beneficial effects:
by sending the memory release command before the freezing process, the memory allocator of each process to be frozen is triggered to release the idle memory occupied by the process to the maximum extent, so that the memory resources occupied by the process frozen in the background are reduced, and the electronic equipment is ensured to have enough memory resources which can be allocated to the running process.
In another embodiment of the present application, the power saving application may issue the process freeze notification after determining that the memory release is completed. Referring to fig. 6, a timing diagram of another method for releasing memory implemented based on the software architecture shown in fig. 6 is shown.
As shown in fig. 6, in this embodiment, steps S01 to S08 are identical to the embodiment corresponding to fig. 5, and the specific implementation manner of the method can refer to the embodiment corresponding to fig. 5, which is not repeated.
And A08, the memory distributor informs the function library that the memory release is finished.
And (3) after the memory allocator of the process to be frozen releases the idle memory of the process to be frozen, executing the step A08 on the function library, and informing that the memory release is finished.
And A09, the function library informs the memory management service that the memory release is finished.
After the function library is notified, the notification is transmitted to the memory management service, that is, step a09 is executed to notify that the memory is released.
A10, the memory management service informs the power saving application that the memory release is finished.
And finally, the memory management service transmits the notification to the power saving application, namely, the step A10 is executed, and the completion of the memory release is notified.
After obtaining the notification that the memory management service has completed releasing the memory, the power saving application executes step S09, i.e. issues a process freeze notification to the freezer.
It should be noted that fig. 6 is an example of a process to be frozen. When there are multiple processes to be frozen, the function library of each process to be frozen notifies the memory management service that the memory is released, and the memory management service may execute step a10 after obtaining the notification of the memory release completion of each process to be frozen.
The beneficial effects of this embodiment lie in:
after the process is frozen, the system can only recover part of the memory held by the memory allocator of the process in a memory compression mode, and the memory compression occupies the space of the swap partition. In the scheme, the power-saving application freezes the process after receiving the notification of the completion of the memory release, and can ensure that the process to be frozen is frozen after the memory distributor releases the memory as much as possible, thereby avoiding the frozen process from occupying the memory resource of the electronic equipment.
Referring to fig. 7, a flowchart of a method for releasing memory provided by the present application may include the following steps:
in some alternative embodiments, the electronic device as shown in FIG. 1 may execute pre-stored computer instructions to implement the steps in the flow described below.
S701, a function library adds a memory recovery signal quantity and a memory release signal processing function.
Step S701 is executed by the electronic device after the electronic device is powered on, and definition and function of the memory reclamation signal amount and the memory release signal processing function are described in the corresponding embodiment of fig. 5, which is not repeated here.
S702, responding to a background putting operation of a user, and putting the application from the foreground to the background.
The background operation of the user refers to an operation performed by the user and triggering the application currently running in the foreground to switch to the background, and the background operation may be an operation of returning to the desktop, or an operation that the user directly switches to another application from the application currently running in the foreground, for example, clicking on a message popped up by another application.
The specific implementation process of step S702 may be referred to as S01 in the embodiment corresponding to fig. 5.
S703, the power saving application obtains notification of the application placement background.
The power saving application can obtain the notification through subscribing in advance or actively pushing the application in the background, and can know which application is specifically switched from the foreground to the background through the notification of the application in the background.
The specific implementation of step S703 may be referred to S02 in the corresponding example of fig. 5.
S704, judging whether the application in the background has a foreground perceivable function or not.
If the application in the background has no foreground perceivable function, step S705 is executed, and if the application in the background has the foreground perceivable function, the process is ended.
For example, the music application can still play music in the background, the navigation application can still broadcast navigation information in the background, and the playing of music and the broadcasting of navigation information belong to the perceivable functions of the foreground.
As previously described, step S704 is an optional step. In some scenarios, the electronic device may freeze the application directly when the application is in the background, regardless of whether the application has foreground-perceivable functionality, at which point step S704 may not be performed.
The specific implementation of step S704 may be referred to S03 in the corresponding example of fig. 5.
S705, sending the prefreezing notice to the memory management service.
The pre-freeze notification carries a process identifier of a process to be frozen, and the pre-freeze notification is used for indicating to the memory management service that the corresponding process is to be frozen. The process to be frozen is a process corresponding to the application in the background. For example, in S702 the video application is cut from the foreground to the background, the prefreezing notification carries a process identifier of a corresponding process of the video application.
The process to be frozen is determined by the power saving application according to the application identification of the application placed in the background.
The specific implementation of step S705 can be seen in steps S04 and S05 of the example shown in fig. 5.
S706, the memory management service sends a memory release signal to the process to be frozen.
In S706, the memory management service sends a memory release signal to the process corresponding to the process identifier carried by the prefreezing notification, so as to trigger the processes to perform forced reclamation.
For example, after the video application is put in the background, the memory management service sends a memory release signal to the process corresponding to the video application in S706.
The specific implementation of step S706 may be referred to as step S06 in the corresponding embodiment of fig. 5.
S707, the process to be frozen performs forced reclamation.
After the process to be frozen receives the memory release signal, the function library of the process to be frozen can respond to the memory release signal to call the forced release interface of the memory distributor, so that forced recovery is executed.
The specific implementation of step S707 may be referred to steps S07 and S08 of the corresponding embodiment of fig. 5.
S708, the process to be frozen is frozen.
In step S708, the power saving application may issue a process freeze notification to the freezer of the kernel, where the process freeze notification carries a process identifier of the process to be frozen, and after receiving the process freeze notification, the freezer may freeze a process corresponding to the process identifier therein.
The specific implementation of step S709 may be referred to as step S09 of the corresponding embodiment of fig. 5, or referred to as steps a08 to a10 of the corresponding embodiment of fig. 6, and step S09.
The above embodiments may refer to the embodiments shown in fig. 5 and 6, and will not be described again
From the timing diagrams of the method for releasing memory shown in fig. 5 and 6 and the flowchart shown in fig. 7, a flowchart of the method for releasing memory shown in fig. 8 can also be obtained, and the method can include the following steps:
s801, when the application is put in the background, determining a process corresponding to the application as a process to be frozen.
In step S801, the electronic device may respond to the background-releasing operation performed by the user, release the application currently running in the foreground to the background, and then find a process corresponding to the application according to the application identifier of the application that is released to the background, so as to determine a process to be frozen.
In some alternative embodiments, the electronic device may first determine, before executing step S801, whether the application placed in the background has a foreground perceivable function, if so, not execute step S801, and end the method, and if not, execute step S801.
The specific procedure of step S801 can be seen from steps S01 to S04 shown in fig. 5.
S802, releasing the memory occupied by the process to be frozen in a forced recycling mode.
In step S802, the electronic device may call a forced release interface of the memory allocator of the process to be frozen, so that the process to be frozen releases the occupied memory in a forced reclamation manner.
The specific procedure of step S802 can be seen from steps S05 to S08 shown in fig. 5.
S803, freezing the process to be frozen.
In step S803, the electronic device may freeze the process to be frozen using the freezer of the kernel layer after the memory is released.
The specific procedure of step S803 can be seen from step S09 shown in fig. 5, and steps a08 to a10 shown in fig. 6.
The above method for releasing the memory may refer to the embodiments shown in fig. 5 and fig. 6, and will not be described again.
An embodiment of the application provides an electronic device including a memory and one or more processors.
The memory is used for storing a computer program.
The one or more processors are configured to execute a computer program, and in particular, to implement a method for freeing memory according to any of the embodiments of the present application.
The embodiment of the application also provides a computer storage medium for storing a computer program, which is specifically used for realizing the method for releasing the memory provided by any embodiment of the application when the computer program is executed.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The plurality of the embodiments of the present application is greater than or equal to two. It should be noted that, in the description of the embodiments of the present application, the terms "first," "second," and the like are used for distinguishing between the descriptions and not necessarily for indicating or implying a relative importance, or alternatively, for indicating or implying a sequential order.

Claims (7)

1. A method for freeing memory, characterized by being applied to an electronic device, an operating system of the electronic device comprising a power saving application, a memory management service and a freezer, the method comprising:
When an application is placed in the background, the power-saving application judges whether the application has a foreground perceptible function according to a foreground perceptible application list, wherein the foreground perceptible application list is used for recording the application with the foreground perceptible function, whether the application has the foreground perceptible function is determined according to the category of the application, and the category of the application is obtained when the application is installed;
if the application has no foreground perceivable function, determining a process corresponding to the application as a process to be frozen; the process to be frozen comprises a function library and a memory allocator;
the power saving application sends a prefreezing notification to the memory management service, wherein the prefreezing notification carries a process identifier of the process to be frozen;
the memory management service sends a memory release signal to a function library of the process to be frozen according to the process identification of the process to be frozen;
the function library responds to the memory release signal and calls a forced release interface of the memory distributor;
the memory allocator releases the memory occupied by the process to be frozen according to a forced recovery mode;
after the power saving application determines that the memory occupied by the process to be frozen is released, a process freezing notification is issued to the freezer, wherein the process freezing notification carries a process identifier of the process to be frozen;
And the freezer freezes the process to be frozen according to the process identification of the process to be frozen.
2. The method of claim 1, wherein before determining the process to which the application corresponds as the process to be frozen, further comprising:
and responding to the user operation, and putting the application currently running in the foreground in the background.
3. The method of claim 1, wherein before determining the process to which the application corresponds as the process to be frozen, further comprising:
and when the electronic equipment is in screen off state, putting the application running in the foreground in the background.
4. The method of claim 1, wherein the power saving application, after determining that the memory occupied by the process to be frozen is released, issues a process freeze notification to the freezer, comprising:
and after the power saving application obtains the notification of the completion of the memory release reported by the memory distributor, issuing a process freezing notification to the freezer.
5. The method of claim 1, wherein the power saving application, after determining that the memory occupied by the process to be frozen is released, issues a process freeze notification to the freezer, comprising:
And the power-saving application transmits a process freezing notification to the freezer after transmitting the prefreezing notification and the preset waiting time.
6. An electronic device comprising a memory and one or more processors;
the memory is used for storing a computer program;
the one or more processors are configured to execute the computer program, in particular to implement the method of freeing memory as claimed in any one of claims 1 to 5.
7. A computer storage medium storing a computer program, which when executed is adapted to carry out the method of freeing memory according to any one of claims 1 to 5.
CN202210161930.XA 2022-02-22 2022-02-22 Method, device and storage medium for releasing memory Active CN115525404B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210161930.XA CN115525404B (en) 2022-02-22 2022-02-22 Method, device and storage medium for releasing memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210161930.XA CN115525404B (en) 2022-02-22 2022-02-22 Method, device and storage medium for releasing memory

Publications (2)

Publication Number Publication Date
CN115525404A CN115525404A (en) 2022-12-27
CN115525404B true CN115525404B (en) 2023-09-19

Family

ID=84693989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210161930.XA Active CN115525404B (en) 2022-02-22 2022-02-22 Method, device and storage medium for releasing memory

Country Status (1)

Country Link
CN (1) CN115525404B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104252389A (en) * 2013-06-27 2014-12-31 腾讯科技(深圳)有限公司 Application operation method, system and application
CN104375828A (en) * 2014-10-27 2015-02-25 小米科技有限责任公司 Method and device for optimizing memory
CN106648865A (en) * 2016-12-15 2017-05-10 北京奇虎科技有限公司 Intelligent terminal, game operating environment optimizing method and system
CN108287760A (en) * 2017-08-08 2018-07-17 珠海市魅族科技有限公司 Terminal equipment control method and device, terminal device and computer readable storage medium
CN110018905A (en) * 2018-01-10 2019-07-16 广东欧珀移动通信有限公司 Information processing method, device, computer equipment and computer readable storage medium
CN112433831A (en) * 2020-11-17 2021-03-02 珠海格力电器股份有限公司 Application freezing method, storage medium and electronic device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104252389A (en) * 2013-06-27 2014-12-31 腾讯科技(深圳)有限公司 Application operation method, system and application
CN104375828A (en) * 2014-10-27 2015-02-25 小米科技有限责任公司 Method and device for optimizing memory
CN106648865A (en) * 2016-12-15 2017-05-10 北京奇虎科技有限公司 Intelligent terminal, game operating environment optimizing method and system
CN108287760A (en) * 2017-08-08 2018-07-17 珠海市魅族科技有限公司 Terminal equipment control method and device, terminal device and computer readable storage medium
CN110018905A (en) * 2018-01-10 2019-07-16 广东欧珀移动通信有限公司 Information processing method, device, computer equipment and computer readable storage medium
CN112433831A (en) * 2020-11-17 2021-03-02 珠海格力电器股份有限公司 Application freezing method, storage medium and electronic device

Also Published As

Publication number Publication date
CN115525404A (en) 2022-12-27

Similar Documents

Publication Publication Date Title
CN111966492B (en) Memory recycling method and device, electronic equipment and computer readable storage medium
CN113722087B (en) Virtual memory management method and electronic equipment
WO2022078105A1 (en) Memory management method, electronic device, and computer-readable storage medium
CN110413383B (en) Event processing method, device, terminal and storage medium
CN112732434A (en) Application management method and device
WO2023202429A1 (en) Garbage recycling method and electronic device
CN116107922A (en) Application management method and electronic device
CN118567736A (en) Method for preloading memory pages, electronic equipment and chip system
WO2024027544A1 (en) Memory management method and electronic device
CN116126744B (en) Memory recycling method and device and terminal equipment
CN115525404B (en) Method, device and storage medium for releasing memory
CN112783418B (en) Method for storing application program data and mobile terminal
CN114253737B (en) Electronic device, memory recovery method thereof and medium
CN113760192B (en) Data reading method, data reading apparatus, storage medium, and program product
CN116933254A (en) Process checking and killing method of application program and electronic equipment
CN117076089B (en) Application management method, terminal device and storage medium
CN116737404B (en) Method and terminal device for application connection
WO2024032430A1 (en) Memory management method and electronic device
WO2024179249A1 (en) Electronic device display method, electronic device, and storage medium
CN117909071B (en) Image display method, electronic device, storage medium, and chip system
WO2023061014A1 (en) Task management method and apparatus
CN115934302A (en) Memory leak processing method and electronic equipment
CN116719752A (en) Memory allocation method, electronic equipment and storage medium
CN118093128A (en) Task execution method, device, equipment, storage medium and product
CN118277120A (en) Method for managing system service and related device

Legal Events

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