WO2018059027A1 - 一种内存回收方法及终端 - Google Patents
一种内存回收方法及终端 Download PDFInfo
- Publication number
- WO2018059027A1 WO2018059027A1 PCT/CN2017/090005 CN2017090005W WO2018059027A1 WO 2018059027 A1 WO2018059027 A1 WO 2018059027A1 CN 2017090005 W CN2017090005 W CN 2017090005W WO 2018059027 A1 WO2018059027 A1 WO 2018059027A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- target application
- memory
- data
- terminal
- storage space
- Prior art date
Links
- 230000015654 memory Effects 0.000 title claims abstract description 191
- 238000000034 method Methods 0.000 title claims abstract description 161
- 230000008014 freezing Effects 0.000 claims description 27
- 238000007710 freezing Methods 0.000 claims description 27
- 238000004064 recycling Methods 0.000 claims description 21
- 238000011084 recovery Methods 0.000 claims description 16
- 230000000694 effects Effects 0.000 abstract description 11
- 238000004140 cleaning Methods 0.000 description 12
- 238000004590 computer program Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 6
- 238000001514 detection method Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000003203 everyday effect Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000013144 data compression Methods 0.000 description 2
- 230000006837 decompression Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000005192 partition Methods 0.000 description 2
- 241000699670 Mus sp. Species 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 230000004793 poor memory Effects 0.000 description 1
- 238000010897 surface acoustic wave method Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0646—Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
- G06F3/0647—Migration mechanisms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44594—Unloading
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
- G06F12/0253—Garbage collection, i.e. reclamation of unreferenced memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0608—Saving storage space on storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4418—Suspend and resume; Hibernate and awake
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
Definitions
- the present invention relates to the field of computer technologies, and in particular, to a memory recovery method and a terminal.
- Android is a multi-tasking system that can run multiple applications at the same time. Android often does not close the application when the user finishes using an application, but allows the process that the application has started to continue in the background. Run, the next time the user uses the application, they do not need to restart these processes, reducing the time it takes to restart the application. Each process running in the background will occupy the corresponding memory. The increasing number of processes running in the background will result in insufficient memory and affect the normal operation of Android. The Low Memory Killer (LMK) can recover the memory when the memory is lower than a certain value. The memory used by the process to ensure that Android is running properly.
- LLK Low Memory Killer
- the embodiment of the invention discloses a memory recycling method and a terminal, which can improve the effect of memory recycling.
- an embodiment of the present invention provides a memory recycling method, where the method includes: determining, by a terminal, a target application from each application running in the background according to a preset rule, where the target application is an application that needs to be cleaned; The terminal freezes the target application to make the process of the target application an uninterruptible sleep state, and recovers data generated by the process running of the target application in the memory; the terminal receives the input for the target application When the program triggers the instruction, the freezing of the target application is released to make the process of the target application an interruptible sleep state, and the target application is run after the freezing of the target application is released.
- the terminal freezes the target application when the recovery target application is in progress, so that the terminal releases the freezing of the target application when receiving the trigger instruction input by the user for the target application, thereby avoiding The target application's process starts automatically and takes up memory again, improving the effect of memory reclamation.
- determining, by the terminal, the target application from each application running in the background according to the preset rule includes: determining that a remaining amount of the memory is greater than a preset memory threshold; The target application is determined according to a preset rule.
- the data generated by the process running of the target application in the memory is recovered, including: Migrate data generated by the target application's process runtime from memory to a preset storage space.
- Running the target application after unfreezing the target application includes: loading the generated data from the storage space into the memory to release the target application after releasing the freeze on the target application .
- migrating data generated from the process runtime from memory to storage space not only frees up memory.
- the space also ensures that the data is not lost, that is to say, in this way, not only the smooth recovery of the memory is ensured, but also the next time the user uses the target application, the user can directly enter the user to exit the target.
- the application interface enhances the user experience.
- the method further includes: determining, by the terminal, a remaining amount of the storage space writable data. Migrating data generated by the target application's process runtime from memory to storage space, including: when the data generated by the target application is not greater than the remaining amount of the writable data, the generated data is from the memory Migrate to the default storage space.
- the terminal determines a remaining amount of the storage space writable data, including: acquiring the storage space according to the pre-acquisition The total amount of writable data is calculated as the total amount of data that can be written per day in the storage space; the remaining amount of data that can be written on the storage space is calculated according to the total amount of data that can be written on the day and the total amount of data written on the day. the amount.
- the target application is an application that is started by a cold start startup mode and exceeds a preset time threshold.
- starting a long-running application by cold-starting usually takes up a lot of memory, and selecting such an application to clean up can release more memory; in addition, the process of such an application is generated during runtime.
- the data is migrated to the storage space first, and then migrated back to the memory when the target application is restarted, which can significantly shorten the time to restart the target application.
- the terminal freezes the target application to make the target application process unavailable
- the interrupted sleep state includes: setting a target application's process to a TASK_UNINTERRUPTIABLE state; releasing the freeze of the target application to make the target application's process an interruptible sleep state includes: setting the target application's process state Is the TASK_INTERRUPTIBLE state.
- the embodiment of the present invention provides a terminal, where the terminal includes a determining unit, a recycling unit, and a releasing unit, wherein the determining unit is configured to determine, according to a preset rule, the target application target from each application running in the background according to a preset rule.
- An application is an application that needs to be cleaned;
- a recycling unit is configured to freeze the target application to make the process of the target application an uninterruptible sleep state, and to reclaim data generated by the process running of the target application in the memory;
- And releasing the unit when receiving the input trigger instruction for the target application, releasing the freezing of the target application to make the process of the target application an interruptible sleep state, and releasing the target Run the target application after the application freezes.
- the terminal freezes the target application when the recycling target application is in progress, so that the terminal releases the frozen target application when receiving the trigger instruction input by the user for the target application.
- the process of the target application is automatically started and the memory is occupied again, which improves the effect of memory recycling.
- the determining unit is configured to determine that the remaining amount of the memory is greater than the preset memory threshold, and the target application is determined according to the preset rule.
- the reclaiming unit is specifically configured to use data generated when the target application process is run Migrating from the memory to the preset storage space; the releasing unit running the target application after releasing the freezing of the target application is specifically: after the freezing of the target application is released, the generated data is The storage space is loaded into the memory to launch the target application.
- migrating the data generated by the process from memory to the storage space not only frees up space for the memory, but also ensures that the data is not lost, that is, in this way, not only the memory is guaranteed. Smooth recovery also ensures that the next time the user uses the target application, he can directly enter the interface when the user last exited the target application, which improves the user experience.
- the terminal further includes: a calculating unit, configured to determine a remaining amount of the storage space writable data;
- the recovery unit migrates the data generated by the process running of the target application from the memory to the preset storage space, specifically: when the data generated by the target application is not greater than the remaining amount of the writable data, The resulting data is migrated from memory to storage.
- the calculating unit is specifically configured to calculate the storage according to the total amount of writable data of the storage space acquired in advance The average amount of data that can be written per day on the space; the remaining amount of data that can be written on the same day of the storage space is calculated based on the total amount of data that can be written on the day and the total amount of data that has been written on the day.
- the target application is an application that is started by a cold start startup manner and exceeds a preset time threshold.
- starting a long-running application by cold-starting usually takes up a lot of memory, and selecting such an application to clean up can release more memory; in addition, the process of such an application is generated during runtime.
- the data is migrated to the storage space first, and then migrated back to the memory when the target application is restarted, which can significantly shorten the time to restart the target application.
- the reclaiming unit is specifically configured to set a target application process to a TASK_UNINTERRUPTIABLE state. ;
- the release unit is specifically configured to set the process of the target application to the TASK_INTERRUPTIBLE state.
- an embodiment of the present invention provides a terminal, where the terminal includes a processor, a memory, and a system bus.
- the memory is used to store computer execution instructions, and the processor and the memory are connected to each other through a system bus.
- the processor executes the memory storage computer to execute instructions to enable the computer to perform the first aspect or any optional one thereof as described above.
- an embodiment of the present invention provides a storage medium, where the storage medium is configured to store an instruction, when the instruction is run on a terminal, causing the terminal to perform the method described in the first aspect or any possible implementation manner of the first aspect. .
- the terminal freezes the target application when the recovery target application is performed, so that the terminal releases the freezing of the target application when receiving the trigger instruction input by the user for the target application.
- the process of the target application is automatically started and the memory is occupied again, which improves the effect of memory recycling.
- FIG. 1 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
- FIG. 2 is a schematic flowchart of a memory recycling method according to an embodiment of the present invention.
- FIG. 3 is a schematic structural diagram of still another terminal according to an embodiment of the present invention.
- FIG. 4 is a schematic structural diagram of still another terminal according to an embodiment of the present invention.
- the memory recovery method provided by the embodiment of the present invention is mainly applied to a terminal device, and the terminal may also be a user equipment (English: User Equipment, abbreviated as: UE), a mobile station (English: Mobile Station, abbreviated as: MS), and a mobile terminal (Mobile). Terminal, etc., optionally, the terminal may have the capability of communicating with one or more core networks via a radio access network (English: Radio Access Network, RAN for short), for example, the terminal may be a mobile phone (or For "cellular" phones, or computers with mobile nature, for example, the terminals can also be portable, pocket-sized, handheld, computer-integrated or in-vehicle mobile devices.
- the memory recycling method provided by the embodiment of the present invention can also be applied to other types of computer systems.
- FIG. 1 is a schematic structural diagram of a terminal 100 according to an embodiment of the present invention.
- the terminal 100 includes a memory 180, a processor 150, and a display device 140.
- the memory 180 stores a computer program including an operating system program 182, an application 181, and the like.
- the processor 150 is configured to read a computer program in the memory 180 and then execute a computer program defined method, for example, the processor 150 reads the operating system program 182 to run an operating system on the terminal 100 and implement various functions of the operating system. Or one or more applications 181 are read to run the application on the terminal.
- Processor 150 may include one or more processors.
- processor 150 may include one or more central processors or include a central processing unit and a graphics processor.
- the multiple processors can be integrated on the same chip or they can each be a separate chip.
- a processor may include one or more processing cores. The following embodiments are all described by taking multiple cores as an example. However, the memory recycling method provided by the embodiments of the present invention may also be applied to a single core processor.
- the memory 180 also stores other data 183 in addition to the computer program.
- the other data 183 may include data generated by the operating system 182 or the application 181 after being run, the data including system data (such as operating system configuration parameters) and
- system data such as operating system configuration parameters
- the user data for example, the data generated during the running of the process, and the data generated during the running are also objects that are recovered in the embodiment of the present invention.
- Memory 180 generally includes memory and external memory.
- the memory can be random access memory (RAM), read only memory (ROM), and cache (CACHE).
- RAM random access memory
- ROM read only memory
- CACHE cache
- the preset storage space described in the embodiment of the present invention belongs to the external storage, and the storage space may include a flash memory, a hard disk, an optical disk, a USB disk, a floppy disk, or a tape drive.
- Computer programs are typically stored on external storage, and the processor loads the computer program from external memory into memory before processing.
- the application in the embodiment of the present invention is usually stored on the external storage, and the application needs to be loaded into the memory when the processor runs the application.
- the operating system program 182 includes a computer program that can implement the memory recycling method provided by the embodiment of the present invention, so that after the processor 150 reads the operating system program 182 and runs the operating system, the operating system can be implemented with the present invention.
- the memory recovery feature provided by the example. Further, the operating system can open the calling interface of the memory recycling function to the upper layer application, and after the processor 150 reads the application 181 from the memory 180 and runs the application, the operating system can be called through the calling interface. Memory reclamation feature to achieve memory reclamation.
- the terminal 100 may further include an input device 130 for receiving input digital information, character information or contact touch/contactless gestures, and generating signal inputs related to user settings and function control of the terminal 100, and the like.
- the input device 130 may include a touch panel 131.
- the touch panel 131 also referred to as a touch screen, can collect touch operations on or near the user (such as the user's operation on the touch panel 131 or on the touch panel 131 using any suitable object or accessory such as a finger, a stylus, or the like. ), and drive the corresponding connection device according to a preset program.
- the touch panel 131 may include two parts: a touch detection device and a touch controller.
- the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
- the processor 150 is provided and can receive commands from the processor 150 and execute them. For example, the user clicks an icon of an application on the touch panel 131, and the touch detection device detects the signal brought by the click, and then transmits the signal to the touch controller, and the touch controller will This signal is converted into coordinates and sent to the processor 150.
- the processor 150 performs a related processing operation on the certain application according to the coordinates and the type of the signal (click or double-click), and finally displays the certain one through the display panel 141.
- the interface of the application is provided and can receive commands from the processor 150 and execute them. For example, the user clicks an icon of an application on the touch panel 131, and the touch detection device detects the signal brought by the click, and then transmits the
- the touch panel 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
- the input device 130 may further include other input devices 132.
- the other input devices 132 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like. One or more of them.
- the terminal 100 may further include a display device 140, including a display panel 141, for displaying information input by the user or information provided to the user, and various menu interfaces of the terminal 100, etc., which are mainly used in the embodiment of the present invention.
- the display device 140 can include a display panel 141.
- an LCD Liquid Crystal Display
- OLED Organic Light-Emitting Diode
- the display panel 141 is configured in the form of an organic light emitting diode or the like.
- the touch panel 131 can cover the display panel 141 to form a touch display screen.
- the terminal 100 may further include a power source 190 for supplying power to other modules and a camera 160 for taking a photo or video.
- Terminal 100 may also include one or more sensors 120, such as acceleration sensors, light sensors, and the like.
- the terminal 100 may further include a radio frequency (RF) circuit 110 for performing network communication with the wireless network device, and may further include a WiFi module 170 for performing WiFi communication with other devices.
- RF radio frequency
- the following embodiment will describe the memory recovery method of the embodiment of the present invention by taking the memory occupied by the process running in the background as an example.
- the memory recovery method can be implemented in the operating system program 182 shown in FIG.
- FIG. 2 is a schematic flowchart of a memory recycling method according to an embodiment of the present invention. The method may be implemented based on the foregoing terminal 100, and the method includes but is not limited to the following steps.
- Step S201 The terminal determines the target application from each application running in the background according to a preset rule.
- the target application is an application that needs to be cleaned
- the preset rule may be set according to actual needs.
- the terminal determines, according to a preset rule, that the target application is determined from each application running in the background: the comparison background The amount of memory used by each running application, and then identify the application that occupies the most memory as the application that needs to be cleaned up.
- the determining, by the terminal, the target application from each application running in the background according to the preset rule means: counting the time that the various applications running in the background are not used continuously, and then continuously using the unused time for more than the preset time. An application with a certain time value is identified as an application that needs to be cleaned up.
- the determining, by the terminal, the target application from each application running in the background according to the preset rule means: determining, by the application that is started in the background by the cold start mode, the application time exceeds the preset time threshold.
- the startup mode of the application includes cold boot and hot Start, cold start is: the terminal does not run the relevant process of the application to be started in the background, so when starting the application, first create and initialize the Application class, then create and initialize the MainActivity class (including a series of measurements, layout, drawing, etc. ), and then output the relevant information of the application to the user.
- the hot start is: the terminal runs the related process of the application to be started in the background, so when starting the application, it is not necessary to create and initialize the Application class, but directly create and initialize the MainActivity, and then output the relevant information of the application. user.
- This preset rule There are other possibilities for this preset rule, and the examples are not exemplified here.
- the terminal may further determine that the remaining amount of the memory is greater than the preset memory threshold when entering the preset idle state; and determining the target application according to the preset rule.
- the idle state here refers to a state in which the user does not operate the terminal, and the expression form in which the terminal is not operated includes the display screen of the terminal being turned off, the display screen of the terminal being locked, the terminal entering the standby state, and the like.
- the memory threshold is a preset value used to represent the size of the memory. In addition, it can be determined whether the remaining amount of the memory is less than another threshold. If the threshold is smaller than the other threshold, the memory may not be sufficient later, so the memory is in the memory.
- the application that needs to be cleaned in each application running in the background is determined according to a preset rule, for example, when the terminal is a mobile phone, the memory threshold may be set to 600M, the other threshold is set to 1G, then when the memory of the mobile phone is greater than 600M and less than 1G, the application that needs to be cleaned in each application running in the background may be determined according to a preset rule. It can be understood that the related operation of cleaning the application when the terminal enters the preset idle state does not cause interference to the user; the remaining amount of memory is greater than the memory threshold, and the related operations of the cleaning application can ensure the cleaning process. Smooth.
- Step S202 The terminal freezes the target application to make the process of the target application an uninterruptible sleep state, and recovers data generated by the process running of the target application in the memory.
- the identified application that needs to be cleaned may be referred to as a target application
- the technology used for freezing may be a freezing of tasks in a Linux system, freezing a process to make the process uninterruptible.
- the process of the sleep state may be: 1. setting the TIF_SIGPENDING flag of the process in the kernel; 2. when the process detects the flag bit in the user mode, and the flag bit sets the TIF_SIGPENDING flag, the process is set to the TASK_UNINTERRUPTIABLE state.
- the freeze of the actual process can also be implemented according to the foregoing manner.
- the setting may be uninterruptible due to related changes of the derivative system.
- the name of the flag bit that can be interrupted sleep state may vary, but such name change does not affect the technical essence when implementing the technical solution of the present invention.
- the target application can be frozen by referring to the idea in the linux, so that the process of the target application enters an uninterruptible sleep state.
- the target application's process needs to be started when it is triggered by humans, thus avoiding the process of the application being frequently started automatically and reoccupying the memory after the memory is reclaimed.
- the data generated by the process running of the target application described herein may be specific to data generated by all processes running by the target application, and the user identifier of the target application may be determined in a specific operation ( English: user identifier, abbreviated as: UID), and then determine the process with the same UID contained in the currently running process as the target application's UID as the running process of the target application.
- the data generated by the target application process may include an anonymous memory page and a file memory page generated when the process is running, where the anonymous memory page includes the heap and stack memory occupied by the program of the process. And the memory that does not have a corresponding reserve file in the file system; the file memory page includes the memory occupied by the file in the buffer when the process is run to read and write files.
- the data generated when the process of the target application in the memory is reclaimed may be: migrating data generated by the process running of the target application from the memory to the preset storage space.
- the data generated by the target application's process running may be migrated from the memory to the storage space, which spares space for the memory and ensures that the target application's process runs.
- the data is not lost.
- the storage space here can be a storage medium or a part of a storage medium, for example, a swap partition in ZSwap. Further, the storage space has a corresponding service life. For example, some storage spaces require that the loss within 3 years should not exceed 5%. To control the loss of the storage space, it is necessary to control the total amount of data written in the storage space.
- the embodiment controls the total amount of data written in the storage space in the following manner.
- the terminal calculates the remaining amount of the writable data of the storage space according to the total amount of the writable data of the storage space acquired in advance and the total amount of data that has been written in the storage space.
- the data generated by the running process of the target application in the memory is migrated from the memory to the storage space, and the data generated when the target application is running is not greater than the remaining amount of the writable data.
- the amount of data written to the storage space per day may also be limited, that is, the total amount of data that can be written by the terminal according to the storage space acquired in advance and the total amount of data that has been written in the storage space.
- the terminal After calculating the remaining amount of data that can be written on the day, the terminal first determines whether the data generated when the process of the target application is running is not greater than the remaining amount of data that can be written on the day, and if not greater than the target application The data generated when the process is running is migrated to the storage space. If it is not larger, the data generated by the process running of the target application is not migrated into the storage space, but is generated when the target application is saved. Data is cleared from this memory.
- the file of the storage space can be remounted using the tempfs file system to prevent the file on the storage space from being exposed to the user, and the security of the data stored in the storage space is ensured.
- Step S203 when receiving the input trigger instruction for the target application, the terminal releases the freezing of the target application to make the process of the target application an interruptible sleep state, and cancels the Run the target application after the target application is frozen.
- the user may input a trigger instruction for the target application to the terminal by using a touch virtual button, voice control, gesture control, etc., correspondingly, the terminal receives the trigger instruction, and then the target application is released according to the trigger instruction. Freeze and run the target application. Unfreezing the target application specifically removes the frozen process of the target application, causing the processes to enter an interruptible sleep state.
- the process of unfreezing the process to enter the interruptible sleep state may be: clearing the TIF_SIGPENDING flag of the process of the target application set in the kernel according to the trigger instruction input by the user, and setting the process For the TASK_INTERRUPTIBLE state, the user state process receives the wakeup event sent when it is set to the TASK_INTERRUPTIBLE state, and the target application is awakened, that is, the freezing of the target application is released.
- the target application can be thawed by referring to the idea in the linux, so that the process of the target application enters an interruptible sleep state.
- the target application when the data generated when the process of the target application is run is migrated from the memory to the preset storage space, the target application is run after the freezing of the target application is released.
- the program may be: loading the generated data from the storage space into the memory to start the target application.
- the freezing of the target application when the freezing of the target application is released, the data generated by the running process of the target application is started to be loaded into the memory from the storage space, instead of releasing the freezing of the target application.
- the process that reads the target application from the memory finds that the page generated by the target application's process is loaded from the storage space into the memory.
- the anonymous memory pages generated by each process runtime can be separately compressed in the process unit, and then more The compressed data of the anonymous memory page constitutes a new page, and then the new page is migrated to the storage space, and then the new page can be migrated to the memory when the target application is run again, and The new page is decompressed on the memory to restore the plurality of anonymous memory pages, and then the plurality of anonymous memory pages are read to run the target application.
- an anonymous memory page of a process that is not used for a short period of time can be stored in the buffer, and an anonymous memory page of a process that has not been used for a long time is migrated to the storage space, because the terminal runs the The probability of a process that is not used for a short period of time is large, so doing so can increase the efficiency of the terminal reading an anonymous memory page with a high probability.
- the terminal freezes the target application when the execution of the target application is resumed, so that the terminal releases the target application when receiving the trigger instruction input by the user for the target application. Freeze, avoiding the process of the target application automatically starting and reoccupying memory, improving the effect of memory recycling.
- FIG. 3 is a schematic structural diagram of a terminal 300 according to an embodiment of the present invention.
- the terminal 300 includes an application layer 310 and an operating system layer 350, which may be an Android operating system.
- the operating system layer 350 is further divided into a framework layer 320, a core library layer 330, and a driver layer 340.
- the operating system layer 350 in FIG. 3 can be considered as a specific implementation of the operating system 182 in FIG. 1.
- the application layer 310 in FIG. 3 can be considered as a specific implementation of the application 181 in FIG.
- the drive layer 340 includes a CPU driver 341, a GPU driver 342, a display controller driver 343, and the like.
- the core library layer 330 is a core part of the operating system, and includes an input/output service 331, a core service 332, a data compression service 333, a data decompression service 334, a memory recovery service 335, and the like, wherein the data compression service 333 is used for reclaiming memory.
- the recovered data is compressed, and the data decompression service 334 is used to decompress the data read from the storage space, and then load into the memory, and the memory recycling service 335 is used to recover the data generated by the application during runtime.
- the framework layer 320 may include a decision service 324, a system service 321, a web service 322, and a customer service 323, etc.
- the decision service 324 may include event processing decisions, application decisions, and lifetimes.
- the application layer 310 may include a gallery 311, a media player (Media Player) 312, a browser 313, and the like.
- the terminal 300 also includes a hardware layer 360.
- the hardware layer of the terminal 300 may include a central processing unit (English: Central Processing Unit, CPU: 361) and a graphics processing unit (English: Graphic Processing Unit, GPU for short) 362 (corresponding to the processor 150 in FIG. 1)
- a specific implementation may further include a memory 363 (corresponding to the memory 180 in FIG. 1), including memory and external memory, and may further include an input device 364 (corresponding to the input device 132 in FIG. 1) and a display device 365 ( Corresponding to the display device 140 in FIG. 1 , such as a liquid crystal display (LCD), a holographic image, a projector, etc., may also include one or more sensors 366 (corresponding to FIG. 1 Sensor 120).
- the hardware layer 360 may also include the power source, camera, RF circuit, and WiFi module shown in FIG. 1, and may also include other hardware modules not shown in FIG. 1, such as a memory controller and display control. And so on.
- FIG. 4 is a schematic structural diagram of a terminal 40 according to an embodiment of the present invention.
- the terminal 40 may include a determining unit 401, a reclaiming unit 402, and a releasing unit 403, where the determining unit 401 is configured according to a preset rule.
- the target application is determined from various applications running in the background, and the target application is an application that needs to be cleaned up.
- the reclaiming unit 402 is configured to freeze the target application to make the process of the target application an uninterruptible sleep state, and to recover data generated by the process running of the target application in the memory.
- the releasing unit 403 is configured to: when receiving the input triggering instruction for the target application, release the freezing of the target application to make the process of the target application an interruptible sleep state, and release the Run the target application after the target application is frozen.
- the terminal freezes the target application when the recovery target application is in progress, so that the terminal releases the freezing of the target application when receiving the trigger instruction input by the user for the target application, thereby avoiding The target application's process starts automatically and takes up memory again, improving the effect of memory reclamation.
- the determining unit is specifically configured to determine that the remaining amount of the memory is greater than a preset memory threshold, and determine the target application according to the preset rule.
- the reclaiming unit 402 is specifically configured to migrate data generated when the process of the target application is running from the memory to the preset storage space; the releasing unit 403 is to release the target application.
- the running of the target application after the freezing of the program is specifically: loading the generated data from the storage space into the memory to release the target application after releasing the freezing of the target application.
- migrating the data generated by the process from memory to the storage space not only frees up space for the memory, but also ensures that the data is not lost, that is, in this way, not only the memory is guaranteed. Smooth recovery also ensures that the next time the user uses the target application, he can directly enter the interface when the user last exited the target application, which improves the user experience.
- the storage space includes a swap partition for storing data generated when each process runs
- the terminal 40 further includes a computing unit, the computing unit is configured to determine the storage space writable data.
- the remaining amount; the reclaiming unit migrating data generated by the target application's process from the memory to the preset storage space is specifically: the data generated when the target application is running is not greater than the remaining amount of the writable data The generated data is migrated from memory to the preset storage space.
- the calculating unit is specifically configured to calculate, according to the total amount of writable data of the storage space acquired in advance, the total amount of data that can be written per day of the storage space; The total amount of data written and the total amount of data that has been written on the day is calculated as the remaining amount of data that can be written on the day of the storage space.
- the target application is required to start up by a cold boot startup mode. An application that exceeds a preset time threshold.
- starting a long-running application by cold-starting usually takes up a lot of memory, and selecting such an application to clean up can release more memory; in addition, the process of such an application is generated during runtime.
- the data is migrated to the storage space first, and then migrated back to the memory when the target application is restarted, which can significantly shorten the time to restart the target application.
- the reclaiming unit 402 is specifically configured to set a process of the target application to a TASK_UNINTERRUPTIABLE state; the releasing unit 403 is specifically configured to set the process of the target application to a TASK_INTERRUPTIBLE state.
- each unit in the embodiment of the present invention may also correspond to the corresponding description of the method embodiment shown in FIG. 2 .
- the terminal 40 freezes the target application when the recovery target application is in progress, so that the terminal releases the target application upon receiving a trigger instruction input by the user for the target application.
- the freezing of the program avoids the process of the target application automatically starting and reoccupying the memory, which improves the effect of memory recycling.
- the terminal freezes the target application when the target application is recycled, so that the terminal releases the target when receiving the trigger instruction input by the user for the target application.
- the application freezes, avoiding the process of the target application automatically starting and occupying the memory again, improving the effect of memory recycling.
- the foregoing storage medium includes various media that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Stored Programmes (AREA)
- Telephone Function (AREA)
Abstract
本发明实施例公开了一种内存回收方法及终端,该方法包括:终端根据预设规则从后台运行的各个应用程序中确定目标应用程序,所述目标应用程序是需要被清理的应用程序;该终端冻结该目标应用程序并回收内存中该目标应用程序的进程运行时产生的数据;该终端在接收到输入的针对该目标应用程序的触发指令时,解除对该目标应用程序的冻结并运行该目标应用程序。采用本发明实施例,能够提升内存回收效果。
Description
本发明涉及计算机技术领域,尤其涉及一种内存回收方法及终端。
Android(安卓)是一个可以同时运行多个应用程序的多任务系统,Android在用户使用完某个应用程序时往往不会关闭掉该应用程序,而是让该应用程序已经启动的进程在后台继续运行,用户下次使用该应用程序时就不需要重新启动这些进程,减少了重启该应用程序所花的时间。每个进程在后台运行均会占用相应的内存,后台运行的进程不断增多会导致内存不足从而影响Android正常运行,低内存管理器(Low Memory Killer,LMK)可在内存低于某值时回收部分进程运行时占用的内存,以确保Android正常运行。
然而,部分进程被回收内存后还会自动启动,从而再次占用内存,导致内存回收的效果不好。
发明内容
本发明实施例公开了一种内存回收方法及终端,能够提升内存回收的效果。
第一方面,本发明实施例提供了一种内存回收方法,该方法包括:终端根据预设规则从后台运行的各个应用程序中确定目标应用程序,该目标应用程序是需要被清理的应用程序;该终端冻结该目标应用程序以使所述目标应用程序的进程为不可中断的睡眠状态,并回收内存中该目标应用程序的进程运行时产生的数据;该终端在接收到输入的针对该目标应用程序的触发指令时,解除对该目标应用程序的冻结以使所述目标应用程序的进程为可中断的睡眠状态,并在解除对所述目标应用程序的冻结后运行该目标应用程序。
通过执行上述操作,终端在回收目标应用程序的进行时冻结该目标应用程序,使得该终端在接收到用户输入的针对该目标应用程序的触发指令时才解除对该目标应用程序的冻结,避免了该目标应用程序的进程自动启动而再次占内存,提升了内存回收的效果。
结合第一方面,在第一方面的第一种可能的实现方式中,该终端根据预设规则从后台运行的各个应用程序中确定目标应用程序包括:确定内存的剩余量大于预设内存阈值;根据预设规则确定目标应用程序。
可以理解的是,在终端进入预设的空闲状态时才执行清理应用程序的相关操作不会对用户产生干扰;在内存的剩余量大于该内存阈值执行清理应用程序的相关操作可以保证清理的过程顺畅。
结合第一方面,或者第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,回收内存中所述目标应用程序的进程运行时产生的数据,包括:将该目标应用程序的进程运行时产生的数据从内存迁移到预设的存储空间。在解除对所述目标应用程序的冻结后运行所述目标应用程序,包括:在解除对所述目标应用程序的冻结后将该产生的数据从该存储空间加载到该内存以启动该目标应用程序。
可以理解的是,将进程运行时产生的数据从内存中迁移到存储空间不仅为内存腾出了
空间,还保证了该部分数据不丢失,也即是说,通过这种方式不但保证了内存的顺利回收,还保证了用户下次使用该目标应用程序时可以直接进入到用户上次退出该目标应用时的界面,提升了用户体验。
结合第一方面的第二种可能的实现方式,在第一方面的第三种可能的实现方式中,该方法还包括:该终端确定该存储空间可写入数据的剩余量。将该目标应用程序的进程运行时产生的数据从内存迁移到存储空间,包括:在该目标应用程序运行时产生的数据不大于该可写入数据的剩余量时,将该产生的数据从内存迁移到预设的存储空间。
结合第一方面的第三种可能的实现方式,在第一方面的第四种可能的实现方式中,该终端确定该存储空间可写入数据的剩余量,包括:根据预先获取的该存储空间的可写入数据总量计算该存储空间平均每天可写入数据的总量;根据当天可写入数据的总量和当天已写入数据的总量计算该存储空间当天可写入数据的剩余量。
可以理解的是,控制存储空间每天写入数据的总量可以保证该存储空间在预计的寿命周期内不会因为写入次数较多而坏掉。
结合第一方面,或者第一方面的第一种可能的实现方式,或者第一方面的第二种可能的实现方式,或者第一方面的第三种可能的实现方式,或者第一方面的第四种可能的实现方式,在第一方面的第五种可能的实现方式中,该目标应用程序为通过冷启动的启动方式启动所需要的时间超过预设时间阈值的应用程序。
可以理解的是,通过冷启动的方式启动耗时较长的应用程序通常占用的内存比较大,选择这样的应用程序来清理可以释放较多内存;另外,这样的应用程序的进程运行时产生的数据先迁移到存储空间,后面重启目标应用程序时再迁移回内存,能够很明显的缩短重启该目标应用程序的时间。
结合第一方面,或者第一方面的第一种可能的实现方式,或者第一方面的第二种可能的实现方式,或者第一方面的第三种可能的实现方式,或者第一方面的第四种可能的实现方式,或者第一方面的第五种可能的实现方式,在第一方面的第六种可能的实现方式中,该终端冻结目标应用程序以使该目标应用程序的进程为不可中断的睡眠状态包括:将目标应用程序的进程设置为TASK_UNINTERRUPTIABLE状态;该解除对该目标应用程序的冻结以使该目标应用程序的进程为可中断的睡眠状态包括:将该目标应用程序的进程设置为TASK_INTERRUPTIBLE状态。
第二方面,本发明实施例提供一种终端,该终端包括确定单元、回收单元和解除单元,其中,确定单元用于根据预设规则从后台运行的各个应用程序中确定目标应用程序所述目标应用程序是需要被清理的应用程序;回收单元用于冻结目标应用程序以使所述目标应用程序的进程为不可中断的睡眠状态,并回收内存中该目标应用程序的进程运行时产生的数据;解除单元用于在接收到输入的针对该目标应用程序的触发指令时,解除对该目标应用程序的冻结以使所述目标应用程序的进程为可中断的睡眠状态,并在解除对所述目标应用程序的冻结后运行该目标应用程序。
通过运行上述单元,终端在回收目标应用程序的进行时冻结该目标应用程序,使得该终端在接收到用户输入的针对该目标应用程序的触发指令时才解除对该目标应用程序的冻
结,避免了该目标应用程序的进程自动启动而再次占内存,提升了内存回收的效果。
结合第二方面,在第二方面的第一种可能的实现方式中,该确定单元具体用于确定内存的剩余量大于预设内存阈值根据预设规则确定目标应用程序。
可以理解的是,在终端进入预设的空闲状态时才执行清理应用程序的相关操作不会对用户产生干扰;在内存的剩余量大于该内存阈值执行清理应用程序的相关操作可以保证清理的过程顺畅。
结合第二方面,或者第二方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,该回收单元具体用于将该目标应用程序的进程运行时产生的数据从内存迁移到预设的存储空间;该解除单元在解除对所述目标应用程序的冻结后运行所述目标应用程序具体为:在解除对所述目标应用程序的冻结后将该产生的数据从该存储空间加载到该内存以启动该目标应用程序。
可以理解的是,将进程运行时产生的数据从内存中迁移到存储空间不仅为内存腾出了空间,还保证了该部分数据不丢失,也即是说,通过这种方式不但保证了内存的顺利回收,还保证了用户下次使用该目标应用程序时可以直接进入到用户上次退出该目标应用时的界面,提升了用户体验。
结合第二方面的第二种可能的实现方式,在第二方面的第三种可能的实现方式中,该终端还包括:计算单元,用于确定该存储空间可写入数据的剩余量;该回收单元将该目标应用程序的进程运行时产生的数据从内存迁移到预设的存储空间具体为:在该目标应用程序运行时产生的数据不大于该可写入数据的剩余量时,将该产生的数据从内存迁移到存储空间。
结合第二方面的第三种可能的实现方式,在第二方面的第四种可能的实现方式中,该计算单元具体用于根据预先获取的该存储空间的可写入数据总量计算该存储空间平均每天可写入数据的总量;根据当天可写入数据的总量和当天已写入数据的总量计算该存储空间当天可写入数据的剩余量。
可以理解的是,控制存储空间每天写入数据的总量可以保证该存储空间在预计的寿命周期内不会因为写入次数较多而坏掉。
结合第二方面,或者第二方面的第一种可能的实现方式,或者第二方面的第二种可能的实现方式,或者第二方面的第三种可能的实现方式,或者第二方面的第四种可能的实现方式,在第二方面的第五种可能的实现方式中,该目标应用程序为通过冷启动的启动方式启动所需要的时间超过预设时间阈值的应用程序。
可以理解的是,通过冷启动的方式启动耗时较长的应用程序通常占用的内存比较大,选择这样的应用程序来清理可以释放较多内存;另外,这样的应用程序的进程运行时产生的数据先迁移到存储空间,后面重启目标应用程序时再迁移回内存,能够很明显的缩短重启该目标应用程序的时间。
结合第二方面,或者第二方面的第一种可能的实现方式,或者第二方面的第二种可能的实现方式,或者第二方面的第三种可能的实现方式,或者第二方面的第四种可能的实现方式,或者第二方面的第五种可能的实现方式,在第二方面的第六种可能的实现方式中,该回收单元具体用于将目标应用程序的进程设置为TASK_UNINTERRUPTIABLE状态;该
解除单元具体用于将该目标应用程序的进程设置为TASK_INTERRUPTIBLE状态。
第三方面,本发明实施例提供一种终端,该终端包括处理器、存储器和系统总线。存储器用于存储计算机执行指令,处理器和存储器通过系统总线相互连接,当计算机运行时,处理器执行存储器存储的计算机执行指令,以使计算机执行如上述第一方面或其任意一项可选的实现方式所描述的内存回收方法。
上述第三方面的技术效果的描述具体可参见上述对第一方面或其任意一种可选的实现方式的技术效果的相关描述,此处不再赘述。
第四方面,本发明实施例提供一种存储介质,所述存储介质用于存储指令,该指令在终端上运行时使得该终端执行第一方面或者第一方面的任意可能实现方式所描述的方法。
通过实施本发明实施例,终端在回收目标应用程序的进行时冻结该目标应用程序,使得该终端在接收到用户输入的针对该目标应用程序的触发指令时才解除对该目标应用程序的冻结,避免了该目标应用程序的进程自动启动而再次占内存,提升了内存回收的效果。
下面将对背景技术或者实施例所需要使用的附图作简单地介绍。
图1是本发明实施例提供的一种终端的结构示意图;
图2是本发明实施例提供的一种内存回收方法的流程示意图;
图3是本发明实施例提供的又一种终端的结构示意图;
图4是本发明实施例提供的又一种终端的结构示意图。
下面将结合本发明实施例中的附图对本发明实施例中的技术方案进行描述。
本发明实施例提供的内存回收方法主要应用于终端设备,该终端也可为用户设备(英文:User Equipment,简称:UE)、移动台(英文:Mobile Station,简称:MS)、移动终端(Mobile Terminal)等,可选的,该终端可以具备经无线接入网(英文:Radio Access Network,简称:RAN)与一个或多个核心网进行通信的能力,例如,终端可以是移动电话(或称为“蜂窝”电话)、或具有移动性质的计算机等,例如,终端还可以是便携式、袖珍式、手持式、计算机内置的或者车载的移动装置。除了终端以外,本发明实施例提供的内存回收方法也可以应用于其他类型的计算机系统。
请参见图1,为本发明实施例应用的终端100的结构示意图。如图1所示,终端100包括存储器180、处理器150以及显示设备140。存储器180存储计算机程序,该计算机程序包括操作系统程序182和应用程序181等。处理器150用于读取存储器180中的计算机程序,然后执行计算机程序定义的方法,例如处理器150读取操作系统程序182从而在该终端100上运行操作系统以及实现操作系统的各种功能,或读取一种或多种应用程序181从而在终端上运行应用。
处理器150可以包括一个或多个处理器,例如,处理器150可以包括一个或多个中央处理器,或者包括一个中央处理器和一个图形处理器。当处理器150包括多个处理器时,
这多个处理器可以集成在同一块芯片上,也可以各自为独立的芯片。一个处理器可以包括一个或多个处理核,以下实施例均以多核为例来介绍,但是本发明实施例提供的内存回收方法也可以应用于单核处理器。
另外,存储器180还存储有除计算机程序之外的其他数据183,其他数据183可包括操作系统182或应用程序181被运行后产生的数据,该数据包括系统数据(例如操作系统的配置参数)和用户数据,例如,进程运行时产生的数据,进行运行时产生的数据也是本发明实施例中回收的对象。
存储器180一般包括内存和外存。内存可以为随机存储器(RAM),只读存储器(ROM),以及高速缓存(CACHE)等。本发明实施例所描述的预设的存储空间属于该外存,该存储空间可以包括闪存(flash)、硬盘、光盘、USB盘、软盘或磁带机等。计算机程序通常被存储在外存上,处理器在执行处理前会将计算机程序从外存加载到内存。本发明实施例中的应用程序通常存储在外存上,处理器运行该应用程序时需要将该应用程序加载到该内存上。
操作系统程序182中包含了可实现本发明实施例提供的内存回收方法的计算机程序,从而使得处理器150读取到该操作系统程序182并运行该操作系统后,该操作系统可具备本发明实施例提供的内存回收功能。进一步的,该操作系统可以向上层的应用开放该内存回收功能的调用接口,处理器150从存储器180中读取应用程序181并运行该应用程序后,就可以通过该调用接口调用操作系统中提供的内存回收功能,从而实现内存回收。
终端100还可以包括输入设备130,用于接收输入的数字信息、字符信息或接触式触摸操作/非接触式手势,以及产生与终端100的用户设置以及功能控制有关的信号输入等。具体地,本发明实施例中,该输入设备130可以包括触控面板131。触控面板131,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板131上或在触控面板131的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板131可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给该处理器150,并能接收处理器150发来的命令并加以执行。例如,用户在触控面板131上用手指单击某个应用程序的图标,触摸检测装置检测到此次单击带来的这个信号,然后将该信号传送给触摸控制器,触摸控制器再将这个信号转换成坐标发送给处理器150,处理器150根据该坐标和该信号的类型(单击或双击)执行对该某个应用程序的相关处理操作,最后通过该显示面板141显示该某个应用程序的界面。
触控面板131可以采用电阻式、电容式、红外线以及表面声波等多种类型实现。除了触控面板131,输入设备130还可以包括其他输入设备132,其他输入设备132可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。
终端100还可以包括显示设备140,显示设备140,包括显示面板141,用于显示由用户输入的信息或提供给用户的信息以及终端100的各种菜单界面等,在本发明实施例中主要用于显示各个应用程序的相关界面。该显示设备140可包括显示面板141,可选的,可以采用LCD(Liquid Crystal Display,液晶显示器)或OLED(Organic Light-Emitting Diode,
有机发光二极管)等形式来配置显示面板141。在其他一些实施例中,触控面板131可覆盖显示面板141上,形成触摸显示屏。
除以上之外,终端100还可以包括用于给其他模块供电的电源190以及用于拍摄照片或视频的摄像头160。终端100还可以包括一个或多个传感器120,例如加速度传感器、光传感器等。终端100还可以包括无线射频(Radio Frequency,RF)电路110,用于与无线网络设备进行网络通信,还可以包括WiFi模块170,用于与其他设备进行WiFi通信。
下面的实施例将以回收后台运行的进程占用的内存为例介绍本发明实施例的内存回收方法,该内存回收方法可以实现在图1所示的操作系统程序182中。
请参见图2,图2是本发明实施例提供的一种内存回收方法的流程示意图,该方法可以基于上述终端100来实现,该方法包括但不限于如下步骤。
步骤S201:终端根据预设规则从后台运行的各个应用程序中确定目标应用程序。
具体地,该目标应用程序为需要被清理的应用程序,该预设规则可以根据实际需要来设置,例如,终端根据预设规则从后台运行的各个应用程序中确定目标应用程序是指:对比后台运行的各个应用程序占用的内存大小,然后将占用内存最大的应用程序确定为需要被清理的应用程序。再如,终端根据预设规则从后台运行的各个应用程序中确定目标应用程序是指:统计后台运行的各个应用程序中连续未被使用的时间,然后将连续未被使用的时间超过预设的某个时间值的应用程序确定为需要被清理的应用程序。再如,终端根据预设规则从后台运行的各个应用程序中确定目标应用程序是指:将后台运行的各个应用程序中通过冷启动的方式启动所需要的时间超过预设时间阈值的应用程序确定为需要被清理的应用程序(例如,将通过冷启动的方式启动耗时超过2.5秒的应用程序确定为需要被清理的应用程序),在实际应用中,应用程序的启动方式包括冷启动和热启动,冷启动为:终端在后台未运行待启动的应用程序的相关进程,因此启动该应用程序时首先创建和初始化Application类,再创建和初始化MainActivity类(包括一系列的测量、布局、绘制等),然后将该应用程序的相关信息输出给用户。热启动为:终端在后台运行了待启动的应用程序的相关进程,因此启动该应用程序时不需要创建和初始化Application类,而是直接创建和初始化MainActivity,然后将该应用程序的相关信息输出该用户。该预设规则还存在其他可能性,此处不再一一举例。
进一步地,该终端还可以在进入预设的空闲状态时确定内存的剩余量大于预设内存阈值;再根据预设规则确定目标应用程序。此处的空闲状态是指用户没有操作该终端的状态,没有操作该终端的表现形式包括终端的显示屏熄屏、终端的显示屏锁屏、终端进入待机状态等等。该内存阈值为预先设置的用来表征内存大小的值,另外,还可以判断内存的剩余量是否小于另一阈值,若小于该另一阈值则表明该内存后续可能会不够用,因此在该内存的剩余量大于预设内存阈值且小于该另一阈值时才根据预设规则确定后台运行的各个应用程序中需要被清理的应用程序,例如,当该终端为手机时可以将该内存阈值设置为600M,将该另一阈值设置为1G,那么当该手机的内存大于600M且小于1G时可以根据预设规则确定后台运行的各个应用程序中需要被清理的应用程序。可以理解的是,在终端进入预设的空闲状态时才执行清理应用程序的相关操作不会对用户产生干扰;在内存的剩余量大于该内存阈值执行清理应用程序的相关操作可以保证清理的过程顺畅。
步骤S202:该终端冻结目标应用程序以使所述目标应用程序的进程为不可中断的睡眠状态,并回收内存中该目标应用程序的进程运行时产生的数据。
具体地,确定出的需要清理的应用程序可称之为目标应用程序,冻结所采用的技术可以为linux系统中的进程冻结技术(freezing of tasks),冻结某个进程使该进程进入不可中断的睡眠状态的过程可以为:1、在内核中设置该进程的TIF_SIGPENDING标志;2、该进程在用户态检测标志位,标志位设置了TIF_SIGPENDING标志,则将该进程设置为TASK_UNINTERRUPTIABLE状态。本领域技术人员可以理解的,在基于linux内核的衍生系统,例如安卓系统中,也可以根据前述方式实现实对进程的冻结,在具体的实现中,可能由于衍生系统的相关变化,设置不可中断以及可中断的睡眠状态的标志位名称可能发生变化,但这种名称变化不影响实施本发明技术方案时的技术实质。而在其他系统(如windows系统)中也可以参照该linux中的思想对该目标应用进行冻结,使得该目标应用的进程进入不可中断的睡眠状态。
目标应用程序冻结后该目标应用程序的进程需要在人为触发时才会启动,从而避免了内存回收后该应用程序的进程频繁自动启动而再次占用内存。可选的,此处描述的目标应用程序的进程运行时产生的数据可以具体为该目标应用程序正在运行的所有进程产生的数据,在具体操作中可以先确定该目标应用程序的用户标识符(英文:user identifier,简称:UID),然后将当前正在运行的进程中包含的UID与该目标应用程序的UID相同的进程确定为目标应用程序正在运行的进程。需要说明的是,目标应用程序的进程运行时产生的数据可以包括该进程运行时产生的匿名内存页、文件内存页,其中,该匿名内存页包括该进程的程序占用的堆和栈的内存,以及那些在文件系统里没有相对应的储备文件的内存;该文件内存页包括运行该进程来读写文件时该文件在缓冲区占用的内存。在一种可选的方案中,回收内存中所述目标应用程序的进程运行时产生的数据,可以为:将该目标应用程序的进程运行时产生的数据从内存迁移到预设的存储空间。具体地,冻结目标应用程序后可以将该目标应用程序的进程运行时产生的数据从该内存迁移到该存储空间,既为该内存腾出了空间还保证了该目标应用程序的进程运行时产生的数据不丢失,此处的存储空间可以为一个存储介质,或者一个存储介质中的一部分空间,例如,ZSwap中的交换分区。进一步地,该存储空间存在相应的使用寿命,例如,有些存储空间要求3年以内的损耗不得超过5%,要控制该存储空间的损耗就需要控制该存储空间写入数据的总量,本发明实施例采用如下方式控制存储空间写入数据的总量。
该终端根据预先获取的该存储空间可写入数据的总量以及该存储空间已写入数据的总量计算该存储空间可写入数据的剩余量。这样一来,将内存中该目标应用程序的进程运行时产生的数据从内存迁移到存储空间,可以为:在该目标应用程序运行时产生的数据不大于该可写入数据的剩余量时,将该产生的数据从内存迁移到存储空间。更进一步地,还可以限定每天向该存储空间写入数据的量,也即是说,该终端根据预先获取的该存储空间可写入数据的总量以及该存储空间已写入数据的总量计算该存储空间可写入数据的剩余量,具体为:根据预先获取的该存储空间的可写入数据总量计算该存储空间平均每天可写入数据的总量;根据当天可写入数据的总量和当天已写入数据的总量计算该存储空间当天可写入数据的剩余量。例如,假设要满足该存储空间在3年的损耗不超过5%需要控制器该存储
空间写入数据的总量不超过1095G,如果将该1095分摊到3年中的每1天的话,每天可写入数据的总量为1095÷3÷365=1G。如果该终端当天已写入数据的总量为0.8G,那么当天可写入数据的剩余量为1-0.8=0.2G。
当计算出当天可写入数据的剩余量后,该终端先判断该目标应用程序的进程运行时产生的数据是否不大于当天可写入数据的剩余量,若不大于则将该目标应用程序的进程运行时产生的数据迁移到该存储空间中,若不大于则不将该目标应用程序的进程运行产生的数据迁移到该存储空间中,而是将该目标应用程序的进行运存时产生的数据从该内存中清除。可选的,该存储空间的文件可以使用tempfs文件系统重新挂载,以避免该存储空间上的文件暴露给用户,确保了存储在该存储空间上的数据的安全性。
步骤S203:该终端在接收到输入的针对该目标应用程序的触发指令时,解除对该目标应用程序的冻结以使所述目标应用程序的进程为可中断的睡眠状态,并在解除对所述目标应用程序的冻结后运行该目标应用程序。
具体地,用户可以通过触控虚拟按键、声控、手势控制等方式向该终端输入针对目标应用程序的触发指令,相应地,该终端接收该触发指令,然后根据该触发指令解除对该目标应用程序的冻结并运行该目标应用程序。解除对目标应用程序的冻结具体为解除该目标应用程序的已经冻结的进程,使这些进程进入可中断的睡眠状态。
在linux系统中的,解除冻结的进程使之进入到可中断的睡眠状态的过程可以为:根据用户输入的触发指令清除内核中设置的该目标应用程序的进程的TIF_SIGPENDING标志,并将该进程设置为TASK_INTERRUPTIBLE状态,用户态进程接收被设置为TASK_INTERRUPTIBLE状态时发送的唤醒事件,至此该目标应用程序被唤醒,即解除了对目标应用程序的冻结。在其他系统(如windows系统)中也可以参照该linux中的思想对该目标应用进行解冻,使得该目标应用的进程进入可中断的睡眠状态。
在一种可选的方案中,当将该目标应用程序的进程运行时产生的数据从内存迁移到该预设的存储空间时,在解除对所述目标应用程序的冻结后运行所述目标应用程序,可以为:将该产生的数据从该存储空间加载到该内存以启动该目标应用程序。可选的,可以在解除对目标应用程序的冻结的同时就开始将该目标应用程序的进程运行时产生的数据从该存储空间加载到该内存,而不是解除对该目标应用程序的冻结后,从该内存中读取该目标应用程序的进程发现缺页时才将该目标应用程序的进程运行时产生的数据从该存储空间加载到该内存。可选的,还可以设置进程因缺页产生的读写操作的优先级高于该进程的其他读写操作的优先级,以便同时有多个读写操作需要处理时优先处理因缺页产生的读写操作,这样可以较顺畅地启动该目标应用程序。
需要说明的是,将该目标应用程序的进程运行时产生的数据从内存迁移到磁盘的过程中时,可以以进程为单位对每个进程运行时产生的匿名内存页分别进行压缩,然后将多个匿名内存页压缩后的数据组成新的页,再将该新的页迁移到该存储空间上,后续要再次运行该目标应用程序时可以再将该新的页迁移到该内存上,并在该内存上对该新的页解压以还原出上述多个匿名内存页,然后读取该多个匿名内存页来运行该目标应用程序。举例来说,页的单位通常为4K,如果匿名内存页的压缩率为50%,那么,每个匿名内存页压缩后大小为2K,两个匿名内存页压缩后的大小为2K+2K=4K,因此可以将两个匿名内存页压缩
后的数据组成一个新的页,并对该新的页的结构进行标记以区分该两个匿名内存页各自对应该新的页中的哪部分,后续对该新的页解压时也可以根据标记的信息还原出这两个匿名内存页。可以理解的是,对该匿名内存页压缩后在迁移到该存储空间可以减少该存储空间的读写开销,从而提高该存储空间的使用寿命。
需要说明的是,回收内存时可以将较短时间未使用的进程的匿名内存页存放到缓冲区,将较长时间未使用的进程的匿名内存页迁移到该存储空间上,由于该终端运行该较短时间未使用的进程的概率较大,因此这样做可以很大概率地提高该终端读取匿名内存页的效率。
在图2所描述的方法中,终端在回收目标应用程序的进行时冻结该目标应用程序,使得该终端在接收到用户输入的针对该目标应用程序的触发指令时才解除对该目标应用程序的冻结,避免了该目标应用程序的进程自动启动而再次占内存,提升了内存回收的效果。
以上主要介绍了本发明实施例提供的方法的具体流程,下面结合图3以Android操作系统为例,介绍本发明实施例提供的方法的实现位置和运行时状态,更具体的方法流程可参考前述实施例所述。
请参阅图3,为本发明实施例提供的终端300的结构示意图。该终端300包括应用层310和操作系统层350,该操作系统可以为Android操作系统。操作系统层350又分为框架层320、核心库层330和驱动层340。其中,图3中的操作系统层350可以认为是图1中操作系统182的一种具体实现,图3中的应用层310可以认为是图1中应用程序181的一种具体实现。驱动层340包括CPU驱动341、GPU驱动342以及显示控制器驱动343等。核心库层330是操作系统的核心部分,包括输入/输出服务331、核心服务332、数据压缩服务333、数据解压服务334、内存回收服务335等,其中,数据压缩服务333用于对回收内存时回收的数据进行压缩,数据解压服务334用于对从存储空间读取的数据进行解压,然互加载到内存中运行,内存回收服务335用于回收应用程序的进行运行时产生的数据。框架层320可包括决策服务324、系统服务(System service)321、网页服务(Web Service)322和用户服务(Customer Service)323等;决策服务324中,可包括事件处理决策、应用程序决策、寿命识别决策、内存回收决策等,其中,事件处理决策用于定义各种事件的作用,应用程序决策用于确定需要被清理的应用程序(例如,确定通过冷启动的方式启动耗时超过2.5秒的应用程序为需要被清理的应用程序),寿命识别决策用于获取存储空间的使用寿命,内存回收决策定义了会收内存的方式(例如,以应用程序为单位回收内存)。应用层310可包括图库311、媒体播放器(Media Player)312以及浏览器(Browser)313等。
另外,在驱动层340之下,该终端300还包括硬件层360。该终端300的硬件层可以包括中央处理器(英文:Central Processing Unit,简称:CPU)361和图形处理器(英文:Graphic Processing Unit,简称:GPU)362(相当于图1中的处理器150的一种具体实现),还可以包括存储器363(相当于图1中的存储器180),包括内存和外存,还可以包括输入设备364(相当于图1中的输入设备132)、显示设备365(相当于图1中的显示设备140),例如液晶显示器(Liquid Crystal Display,LCD)、全息成像(Holographic)、投影(Projector)等,还可以包括一个或多个传感器366(相当于图1中的传感器120)。当然除此之外,硬件层360还可以包括图1中示出的电源、摄像头、RF电路和WiFi模块,还可以包括图1中也没有示出的其他硬件模块,例如内存控制器和显示控制器等。
上述详细阐述了本发明实施例的方法,为了便于更好地实施本发明实施例的上述方案,相应地,下面提供了本发明实施例的装置。
请参见图4,图4是本发明实施例提供的一种终端40的结构示意图,该终端40可以包括确定单元401、回收单元402和解除单元403,其中,确定单元401用于根据预设规则从后台运行的各个应用程序中确定目标应用程序,该目标应用程序是需要被清理的应用程序。回收单元402用于冻结目标应用程序以使所述目标应用程序的进程为不可中断的睡眠状态,并回收内存中该目标应用程序的进程运行时产生的数据。解除单元403用于在接收到输入的针对该目标应用程序的触发指令时,解除对该目标应用程序的冻结以使所述目标应用程序的进程为可中断的睡眠状态,并在解除对所述目标应用程序的冻结后运行该目标应用程序。
通过运行上述单元,终端在回收目标应用程序的进行时冻结该目标应用程序,使得该终端在接收到用户输入的针对该目标应用程序的触发指令时才解除对该目标应用程序的冻结,避免了该目标应用程序的进程自动启动而再次占内存,提升了内存回收的效果。
在一种可选的方案中,该确定单元具体用于确定内存的剩余量大于预设内存阈值,根据预设规则确定目标应用程序。
可以理解的是,在终端进入预设的空闲状态时才执行清理应用程序的相关操作不会对用户产生干扰;在内存的剩余量大于该内存阈值执行清理应用程序的相关操作可以保证清理的过程顺畅。
在又一种可选的方案中,该回收单元402具体用于将该目标应用程序的进程运行时产生的数据从内存迁移到预设的存储空间;该解除单元403在解除对所述目标应用程序的冻结后运行所述目标应用程序具体为:在解除对所述目标应用程序的冻结后将该产生的数据从该存储空间加载到该内存以启动该目标应用程序。
可以理解的是,将进程运行时产生的数据从内存中迁移到存储空间不仅为内存腾出了空间,还保证了该部分数据不丢失,也即是说,通过这种方式不但保证了内存的顺利回收,还保证了用户下次使用该目标应用程序时可以直接进入到用户上次退出该目标应用时的界面,提升了用户体验。
在又一种可选的方案中,该存储空间包括用于存储各个进程运行时产生的数据的交换分区,该终端40还包括计算单元,该计算单元用于确定该存储空间可写入数据的剩余量;该回收单元将该目标应用程序的进程运行时产生的数据从内存迁移到预设的存储空间具体为:在该目标应用程序运行时产生的数据不大于该可写入数据的剩余量时,将该产生的数据从内存迁移到预设存储空间。
在又一种可选的方案中,所述计算单元具体用于根据预先获取的所述存储空间的可写入数据总量计算所述存储空间平均每天可写入数据的总量;根据当天可写入数据的总量和当天已写入数据的总量计算所述存储空间当天可写入数据的剩余量。
可以理解的是,控制存储空间每天写入数据的总量可以保证该存储空间在预计的寿命周期内不会因为写入次数较多而坏掉。
在又一种可选的方案中,该目标应用程序为通过冷启动的启动方式启动所需要的时间
超过预设时间阈值的应用程序。
可以理解的是,通过冷启动的方式启动耗时较长的应用程序通常占用的内存比较大,选择这样的应用程序来清理可以释放较多内存;另外,这样的应用程序的进程运行时产生的数据先迁移到存储空间,后面重启目标应用程序时再迁移回内存,能够很明显的缩短重启该目标应用程序的时间。
在又一种可选的方案中,该回收单元402具体用于将目标应用程序的进程设置为TASK_UNINTERRUPTIABLE状态;该解除单元403具体用于将该目标应用程序的进程设置为TASK_INTERRUPTIBLE状态。
在本发明实施例中各个单元的具体实现还可以对应参照图2所示的方法实施例的相应描述。
在图4所描述的终端40中,终端40在回收目标应用程序的进行时冻结该目标应用程序,使得该终端在接收到用户输入的针对该目标应用程序的触发指令时才解除对该目标应用程序的冻结,避免了该目标应用程序的进程自动启动而再次占内存,提升了内存回收的效果。
综上所述,通过实施本发明实施例,终端在回收目标应用程序的进行时冻结该目标应用程序,使得该终端在接收到用户输入的针对该目标应用程序的触发指令时才解除对该目标应用程序的冻结,避免了该目标应用程序的进程自动启动而再次占内存,提升了内存回收的效果。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,可通过计算机程序来指令相关的硬件来完成,该的程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可存储程序代码的介质。
Claims (15)
- 一种内存回收方法,其特征在于,包括:终端根据预设规则从后台运行的各个应用程序中确定目标应用程序;所述目标应用程序是需要被清理的应用程序;所述终端冻结所述目标应用程序以使所述目标应用程序的进程为不可中断的睡眠状态,并回收内存中所述目标应用程序的进程运行时产生的数据;所述终端在接收到输入的针对所述目标应用程序的触发指令时,解除对所述目标应用程序的冻结以使所述目标应用程序的进程为可中断的睡眠状态,并在解除对所述目标应用程序的冻结后运行所述目标应用程序。
- 根据权利要求1所述的方法,其特征在于,所述终端根据预设规则从后台运行的各个应用程序中确定目标应用程序包括:确定内存的剩余量大于预设内存阈值;根据预设规则确定目标应用程序。
- 根据权利要求1或2所述的方法,其特征在于,所述回收内存中所述目标应用程序的进程运行时产生的数据,包括:将所述目标应用程序的进程运行时产生的数据从内存迁移到预设的存储空间;在解除对所述目标应用程序的冻结后运行所述目标应用程序,包括:在解除对所述目标应用程序的冻结后将所述产生的数据从所述存储空间加载到所述内存以启动所述目标应用程序。
- 根据权利要求3所述的方法,其特征在于,所述方法还包括:所述终端确定所述存储空间可写入数据的剩余量;所述将所述目标应用程序的进程运行时产生的数据从内存迁移到预设的存储空间,包括:在所述目标应用程序运行时产生的数据不大于所述可写入数据的剩余量时,将所述产生的数据从内存迁移到预设的存储空间。
- 根据权利要求4所述的方法,其特征在于,所述终端确定所述存储空间可写入数据的剩余量,包括:根据预先获取的所述存储空间的可写入数据总量计算所述存储空间平均每天可写入数据的总量;根据当天可写入数据的总量和当天已写入数据的总量计算所述存储空间当天可写入数据的剩余量。
- 根据权利要求1~5任一项所述的方法,其特征在于,所述目标应用程序为通过冷启动的启动方式启动所需要的时间超过预设时间阈值的应用程序。
- 根据权利要求1~6任一项所述的方法,其特征在于:所述终端冻结目标应用程序以使所述目标应用程序的进程为不可中断的睡眠状态包括:将目标应用程序的进程设置为TASK_UNINTERRUPTIABLE状态;所述解除对所述目标应用程序的冻结以使所述目标应用程序的进程为可中断的睡眠状态包括:将所述目标应用程序的进程设置为TASK_INTERRUPTIBLE状态。
- 一种终端,其特征在于,包括:确定单元,用于根据预设规则从后台运行的各个应用程序中确定目标应用程序,所述目标应用程序是需要被清理的应用程序;回收单元,用于冻结目标应用程序以使所述目标应用程序的进程为不可中断的睡眠状态,并回收内存中所述目标应用程序的进程运行时产生的数据;解除单元,用于在接收到输入的针对所述目标应用程序的触发指令时,解除对所述目标应用程序的冻结以使所述目标应用程序的进程为可中断的睡眠状态,并在解除对所述目标应用程序的冻结后运行所述目标应用程序。
- 根据权利要求8所述的终端,其特征在于,所述确定单元具体用于确定内存的剩余量大于预设内存阈值,根据预设规则确定目标应用程序。
- 根据权利要求8或9所述的终端,其特征在于:所述回收单元具体用于将所述目标应用程序的进程运行时产生的数据从内存迁移到预设的存储空间;所述解除单元在解除对所述目标应用程序的冻结后运行所述目标应用程序具体为:在解除对所述目标应用程序的冻结后将所述产生的数据从所述存储空间加载到所述内存以启动所述目标应用程序。
- 根据权利要求10所述的终端,其特征在于,所述终端还包括:计算单元,用于确定所述存储空间可写入数据的剩余量;所述回收单元将所述目标应用程序的进程运行时产生的数据从内存迁移到预设的存储空间具体为:在所述目标应用程序运行时产生的数据不大于所述可写入数据的剩余量时,将所述产生的数据从内存迁移到预设的存储空间。
- 根据权利要求11所述的终端,其特征在于,所述计算单元具体用于根据预先获取的所述存储空间的可写入数据总量计算所述存储空间平均每天可写入数据的总量;根据当天可写入数据的总量和当天已写入数据的总量计算所述存储空间当天可写入数据的剩余量。
- 根据权利要求8~12任一项所述的终端,其特征在于,所述目标应用程序为通过冷启动的启动方式启动所需要的时间超过预设时间阈值的应用程序。
- 根据权利要求8~13任一项所述的终端,其特征在于,所述回收单元具体用于将目标应用程序的进程设置为TASK_UNINTERRUPTIABLE状态;所述解除单元具体用于将所述目标应用程序的进程设置为TASK_INTERRUPTIBLE状态。
- 一种存储介质,其特征在于,所述存储介质用于存储指令,所述指令在终端上运行时使得所述终端执行权利要求1-7任一项所述的方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
EP17854481.3A EP3514683B1 (en) | 2016-09-29 | 2017-06-26 | Memory collection method and terminal |
US16/367,646 US11822805B2 (en) | 2016-09-29 | 2019-03-28 | Method and terminal for reclaiming memory after freezing program |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610872374.1A CN106484472B (zh) | 2016-09-29 | 2016-09-29 | 一种内存回收方法及终端 |
CN201610872374.1 | 2016-09-29 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US16/367,646 Continuation US11822805B2 (en) | 2016-09-29 | 2019-03-28 | Method and terminal for reclaiming memory after freezing program |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2018059027A1 true WO2018059027A1 (zh) | 2018-04-05 |
Family
ID=58268398
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/090005 WO2018059027A1 (zh) | 2016-09-29 | 2017-06-26 | 一种内存回收方法及终端 |
Country Status (4)
Country | Link |
---|---|
US (1) | US11822805B2 (zh) |
EP (1) | EP3514683B1 (zh) |
CN (1) | CN106484472B (zh) |
WO (1) | WO2018059027A1 (zh) |
Families Citing this family (23)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106484472B (zh) | 2016-09-29 | 2021-06-15 | 华为技术有限公司 | 一种内存回收方法及终端 |
CN106919428A (zh) * | 2017-03-21 | 2017-07-04 | 北京奇虎科技有限公司 | 清理移动终端内存的方法、装置及移动终端 |
CN108287760B (zh) * | 2017-08-08 | 2021-02-19 | 珠海市魅族科技有限公司 | 终端设备控制方法及装置、终端设备及计算机可读存储介质 |
CN108205475A (zh) * | 2017-08-25 | 2018-06-26 | 珠海市魅族科技有限公司 | 内存管理方法、终端设备、计算机装置以及可读存储介质 |
CN107526641A (zh) * | 2017-08-28 | 2017-12-29 | 青岛海信移动通信技术股份有限公司 | 一种回收内存的方法及装置 |
CN107766151A (zh) * | 2017-09-28 | 2018-03-06 | 郑州云海信息技术有限公司 | 一种页面换出方法 |
CN107861812B (zh) * | 2017-10-30 | 2022-01-11 | 北京博瑞彤芸科技股份有限公司 | 一种内存清理方法 |
CN109992522A (zh) * | 2017-12-29 | 2019-07-09 | 广东欧珀移动通信有限公司 | 应用处理方法和装置、电子设备、计算机可读存储介质 |
CN109992393A (zh) | 2017-12-29 | 2019-07-09 | 广东欧珀移动通信有限公司 | 应用处理方法和装置、电子设备、计算机可读存储介质 |
CN109062696A (zh) * | 2018-08-02 | 2018-12-21 | 郑州云海信息技术有限公司 | 一种注销内存地址的方法及装置 |
CN110888684A (zh) * | 2018-08-20 | 2020-03-17 | 中兴通讯股份有限公司 | 一种进程管理方法、终端及计算机可读存储介质 |
CN109731336B (zh) * | 2018-12-27 | 2022-09-09 | 三星电子(中国)研发中心 | 一种游戏应用的控制方法和装置 |
CN109857555B (zh) * | 2019-01-15 | 2023-02-28 | Oppo广东移动通信有限公司 | 内存回收方法及装置、存储介质和电子设备 |
CN110691401B (zh) * | 2019-08-28 | 2021-04-09 | 华为技术有限公司 | 一种系统应用的管理方法及装置 |
CN110737523A (zh) * | 2019-10-18 | 2020-01-31 | 湖南快乐阳光互动娱乐传媒有限公司 | 一种通过内存清理提升应用启动速度的方法及终端 |
CN112925474B (zh) * | 2019-12-06 | 2023-05-23 | 深圳Tcl新技术有限公司 | 一种终端设备的控制方法、存储介质及终端设备 |
CN111258921B (zh) * | 2020-01-14 | 2024-01-26 | Oppo广东移动通信有限公司 | 垃圾内存回收方法及装置、电子设备、存储介质 |
CN111310170A (zh) * | 2020-01-16 | 2020-06-19 | 深信服科技股份有限公司 | 应用程序的防泄密方法、装置及计算机可读存储介质 |
CN111651277B (zh) * | 2020-06-11 | 2024-03-26 | 深圳创维-Rgb电子有限公司 | 一种内存的清理方法、智能终端及可读存储介质 |
CN113886060B (zh) * | 2021-05-28 | 2022-09-23 | 荣耀终端有限公司 | 压缩内存的方法和装置 |
CN113918287A (zh) * | 2021-11-11 | 2022-01-11 | 杭州逗酷软件科技有限公司 | 启动应用程序的方法、装置、终端设备及存储介质 |
CN114518905A (zh) * | 2022-01-21 | 2022-05-20 | 珠海全志科技股份有限公司 | 一种应用冷启动的方法、装置、计算机设备和存储介质 |
CN117785394A (zh) * | 2022-09-28 | 2024-03-29 | 华为终端有限公司 | 应用管理方法、电子设备和可读存储介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104503740A (zh) * | 2014-12-01 | 2015-04-08 | 小米科技有限责任公司 | 内存管理方法和装置 |
US20150347181A1 (en) * | 2014-05-30 | 2015-12-03 | Apple Inc. | Resource management with dynamic resource policies |
CN105701025A (zh) * | 2015-12-31 | 2016-06-22 | 华为技术有限公司 | 一种内存回收方法及装置 |
CN105843367A (zh) * | 2016-03-24 | 2016-08-10 | 维沃移动通信有限公司 | 一种应用程序的处理方法及电子设备 |
CN106484472A (zh) * | 2016-09-29 | 2017-03-08 | 华为技术有限公司 | 一种内存回收方法及终端 |
Family Cites Families (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5717926A (en) * | 1995-02-28 | 1998-02-10 | International Business Machines Corporation | Efficient forking of a process |
US6983301B1 (en) * | 2000-02-02 | 2006-01-03 | Siemens Communications, Inc. | Background processing deferment for computer telephony |
US7503065B1 (en) * | 2002-04-24 | 2009-03-10 | Sprint Spectrum L.P. | Method and system for gateway-based authentication |
JP4476193B2 (ja) * | 2005-07-29 | 2010-06-09 | 株式会社ソニー・コンピュータエンタテインメント | 情報処理方法および情報処理装置 |
US7778959B2 (en) * | 2005-12-09 | 2010-08-17 | Microsoft Corporation | Protecting storages volumes with mock replication |
US20080077590A1 (en) * | 2006-09-22 | 2008-03-27 | Honeywell International Inc. | Efficient journaling and recovery mechanism for embedded flash file systems |
US20080313656A1 (en) * | 2007-06-18 | 2008-12-18 | Microsoft Corporation | User mode stack disassociation |
CN101908022B (zh) | 2010-08-13 | 2012-03-28 | 优视科技有限公司 | 一种用于移动通讯设备终端的内存管理方法及其装置 |
US20120324481A1 (en) * | 2011-06-16 | 2012-12-20 | Samsung Electronics Co. Ltd. | Adaptive termination and pre-launching policy for improving application startup time |
CN102768571A (zh) * | 2012-06-13 | 2012-11-07 | 上海交通大学 | 基于pcm的数据中心的节能方法 |
US9071923B2 (en) * | 2012-12-20 | 2015-06-30 | Cellco Partnership | Automatic archiving of an application on a mobile device |
WO2014132346A1 (ja) * | 2013-02-27 | 2014-09-04 | 株式会社日立製作所 | 半導体ストレージ |
CN104281528B (zh) | 2013-07-09 | 2018-02-16 | 浙江大华技术股份有限公司 | 一种数据存储方法及装置 |
US9495115B2 (en) * | 2014-10-01 | 2016-11-15 | Sap Se | Automatic analysis of issues concerning automatic memory management |
US11132336B2 (en) * | 2015-01-12 | 2021-09-28 | Qumulo, Inc. | Filesystem hierarchical capacity quantity and aggregate metrics |
CN105676993A (zh) * | 2015-12-29 | 2016-06-15 | 北京金山安全软件有限公司 | 一种节省电量的方法、装置及电子设备 |
CN105677386A (zh) * | 2015-12-29 | 2016-06-15 | 北京金山安全软件有限公司 | 一种应用程序的管理方法、装置及电子设备 |
-
2016
- 2016-09-29 CN CN201610872374.1A patent/CN106484472B/zh active Active
-
2017
- 2017-06-26 WO PCT/CN2017/090005 patent/WO2018059027A1/zh unknown
- 2017-06-26 EP EP17854481.3A patent/EP3514683B1/en active Active
-
2019
- 2019-03-28 US US16/367,646 patent/US11822805B2/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150347181A1 (en) * | 2014-05-30 | 2015-12-03 | Apple Inc. | Resource management with dynamic resource policies |
CN104503740A (zh) * | 2014-12-01 | 2015-04-08 | 小米科技有限责任公司 | 内存管理方法和装置 |
CN105701025A (zh) * | 2015-12-31 | 2016-06-22 | 华为技术有限公司 | 一种内存回收方法及装置 |
CN105843367A (zh) * | 2016-03-24 | 2016-08-10 | 维沃移动通信有限公司 | 一种应用程序的处理方法及电子设备 |
CN106484472A (zh) * | 2016-09-29 | 2017-03-08 | 华为技术有限公司 | 一种内存回收方法及终端 |
Non-Patent Citations (1)
Title |
---|
See also references of EP3514683A4 * |
Also Published As
Publication number | Publication date |
---|---|
US11822805B2 (en) | 2023-11-21 |
EP3514683B1 (en) | 2021-08-11 |
US20190220216A1 (en) | 2019-07-18 |
CN106484472B (zh) | 2021-06-15 |
EP3514683A1 (en) | 2019-07-24 |
EP3514683A4 (en) | 2019-10-23 |
CN106484472A (zh) | 2017-03-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2018059027A1 (zh) | 一种内存回收方法及终端 | |
CN111078406B (zh) | 内存管理方法、装置、存储介质及电子设备 | |
EP3506106B1 (en) | Method for processing application, electronic device, and computer-readable storage medium | |
US9600369B2 (en) | Operating system recovery method and apparatus, and terminal device | |
EP3506105B1 (en) | Method and device for processing a memory and storage medium | |
TWI608345B (zh) | Operating system recovery method, device and terminal equipment | |
EP3506114B1 (en) | Memory processing method and device and storage medium | |
CN113703799B (zh) | 计算设备及其bios更新方法和介质 | |
CN112437914A (zh) | 一种系统恢复方法及装置 | |
WO2019128542A1 (zh) | 应用处理方法、电子设备、计算机可读存储介质 | |
CN112231238A (zh) | 使用存储器压缩来减少存储器提交开销 | |
US10908919B2 (en) | Booting and power management by coordinating operations between processors | |
US20240152439A1 (en) | Detection Method and Electronic Device | |
CN110688250B (zh) | 用于分区级恢复的方法、设备和数据处理系统 | |
US11163589B2 (en) | Class unloading method and electronic device | |
CN113434336B (zh) | 开机方法、装置、电子设备及可读存储介质 | |
CN110704237B (zh) | 用于无代理程序的分区备份的方法、设备和数据处理系统 | |
CN112965920A (zh) | 内存管理方法、装置、电子设备以及存储介质 | |
CN118885120A (zh) | 进程处理方法、装置、电子设备及存储介质 | |
JP5862727B2 (ja) | マルチコアプロセッサシステム、マルチコアプロセッサシステムの制御方法、およびマルチコアプロセッサシステムの制御プログラム | |
CN116954924A (zh) | 内存管理方法、装置及电子设备 | |
TW201322129A (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: 17854481 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
ENP | Entry into the national phase |
Ref document number: 2017854481 Country of ref document: EP Effective date: 20190429 |