CN106326137B - Memory optimization method and device and user equipment - Google Patents
Memory optimization method and device and user equipment Download PDFInfo
- Publication number
- CN106326137B CN106326137B CN201510381862.8A CN201510381862A CN106326137B CN 106326137 B CN106326137 B CN 106326137B CN 201510381862 A CN201510381862 A CN 201510381862A CN 106326137 B CN106326137 B CN 106326137B
- Authority
- CN
- China
- Prior art keywords
- memory
- target application
- level
- occupation
- browser
- 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
Links
Images
Landscapes
- Memory System (AREA)
- Storage Device Security (AREA)
Abstract
The embodiment of the invention provides a memory optimization method, a device and user equipment, wherein the method comprises the following steps: detecting a memory occupation value occupied by a target application, wherein the target application is provided with a plurality of memory occupation objects occupying a memory; determining a memory occupation grade corresponding to the memory occupation value; and releasing the memory occupied object of the target application by the memory release means corresponding to the memory occupied level according to the corresponding relation between the set memory occupied level and the memory release means. The invention can realize the release of the object occupying the memory specifically for the target application, so that the memory occupied by the target application is reduced, and the running stability of the target application is improved.
Description
Technical Field
The invention relates to the technical field of memory optimization, in particular to a memory optimization method, a memory optimization device and user equipment.
Background
The memory is a device for running programs in user equipment (such as a mobile phone, a tablet computer, a notebook computer and the like); when the application loaded by the user equipment runs, certain memory resources are occupied, so that the memory occupied by the application is optimally managed, and the performance of the user equipment is greatly influenced.
At present, the method for optimizing the memory of the application loaded by the user equipment mainly includes the steps of adopting a housekeeper application having a domination authority for each application loaded by the user equipment, monitoring a memory occupation value occupied by each application, and if an application with the memory occupation value larger than a threshold exists, directly killing the application by the housekeeper application, releasing the memory occupied by the application, and realizing the optimized management of the memory.
The inventor of the invention researches and discovers that the existing memory optimization mode mainly aims at the memory optimization of the whole application, is an application which simply kills high-occupied memory and can not carry out specific memory optimization on single application; therefore, it is a problem to be considered by those skilled in the art to provide a memory optimization method to perform specific memory optimization for a single application.
Disclosure of Invention
In view of this, embodiments of the present invention provide a memory optimization method, an apparatus, and user equipment, so as to perform specific memory optimization on a single application.
In order to achieve the above purpose, the embodiments of the present invention provide the following technical solutions:
a memory optimization method includes:
detecting a memory occupation value occupied by a target application, wherein the target application is provided with a plurality of memory occupation objects occupying a memory;
determining a memory occupation grade corresponding to the memory occupation value;
and releasing the memory occupied object of the target application by the memory release means corresponding to the memory occupied level according to the corresponding relation between the set memory occupied level and the memory release means.
An embodiment of the present invention further provides a memory optimization device, including:
the device comprises a detection module, a storage module and a processing module, wherein the detection module is used for detecting a memory occupation value occupied by a target application, and the target application is provided with a plurality of memory occupation objects occupying a memory;
the grade determining module is used for determining the memory occupation grade corresponding to the memory occupation value;
and the releasing module is used for releasing the memory occupied object of the target application by the memory releasing means corresponding to the memory occupied level according to the corresponding relation between the set memory occupied level and the memory releasing means.
The embodiment of the invention also provides user equipment which comprises the memory optimization device.
Based on the above technical solution, the memory optimization method provided in the embodiment of the present invention includes: detecting a memory occupation value occupied by a target application, wherein the target application is provided with a plurality of memory occupation objects occupying a memory; determining a memory occupation grade corresponding to the memory occupation value; and releasing the memory occupied object of the target application by the memory release means corresponding to the memory occupied level according to the corresponding relation between the set memory occupied level and the memory release means. The embodiment of the invention releases the memory occupied object of the target application by determining the memory occupied grade corresponding to the current memory occupied value of the target application and adopting the memory release means corresponding to the determined memory occupied grade instead of directly killing the target application when the memory occupied value of the target application is larger, thereby realizing the release of the specific memory occupied object of the target application, reducing the memory occupied by the target application and improving the running stability of the target application.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a memory optimization method according to an embodiment of the present invention;
fig. 2 is another flowchart of a memory optimization method according to an embodiment of the present invention;
FIG. 3 is a further flowchart of a memory optimization method according to an embodiment of the present invention;
fig. 4 is a flowchart of a memory optimization method according to an embodiment of the present invention;
fig. 5 is yet another flowchart of a memory optimization method according to an embodiment of the present invention;
fig. 6 is a block diagram of a memory optimization apparatus according to an embodiment of the present invention;
fig. 7 is another structural block diagram of the memory optimization device according to the embodiment of the present invention;
FIG. 8 is a block diagram of a trend determination module according to an embodiment of the present invention;
fig. 9 is a block diagram of a release module according to an embodiment of the present invention;
fig. 10 is a further structural block diagram of the memory optimization device according to the embodiment of the present invention;
fig. 11 is a block diagram of a first release unit according to an embodiment of the present invention;
fig. 12 is a block diagram of a hardware structure of a user equipment according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of a memory optimization method according to an embodiment of the present invention, where the memory optimization method is applicable to a user equipment, and is used to perform specific memory optimization on a certain target application loaded by the user equipment; referring to fig. 1, the memory optimization method may include:
step S100, detecting a memory occupation value occupied by a target application, wherein the target application is provided with a plurality of memory occupation objects occupying a memory;
the target application is a certain application loaded by the user equipment, and can be any application needing memory optimization in the user equipment; the embodiment of the invention can detect the memory occupation value occupied by the target application at one time in a fixed time, for example, the memory occupation value occupied by the target application is detected at intervals of 0.5 second, and the specific timing time can be set according to the actual condition;
optionally, the memory occupied object is an object occupying a memory in the target application, and the target application can realize operation and function presentation through the memory occupied objects; taking the target application as a browser as an example, the memory-occupied object may be a browser page opened by the browser, a loaded plug-in, and the like, and taking the target application as an instant messaging application as an example, the memory-occupied object may be a chat window (which may be a video window, a voice window, and the like) opened by the instant messaging application, a loaded plug-in, and the like.
Step S110, determining a memory occupation grade corresponding to the memory occupation value;
optionally, in the embodiment of the present invention, a plurality of memory occupation levels may be set, where one memory occupation level corresponds to one memory occupation value range, and if the current memory occupation value of the target application is in the memory occupation value range corresponding to a certain memory occupation level, the memory occupation level corresponding to the current memory occupation value of the target application may be determined, and corresponds to the memory occupation level corresponding to the memory occupation value range in which the current memory occupation value of the target application is located;
according to the embodiment of the invention, two memory occupation levels can be set, wherein the two memory occupation levels are divided into a first memory occupation level and a second memory occupation level, and the memory occupation degree of the first memory occupation level is higher than that of the second memory occupation level; the memory occupation value range of the second memory occupation level can be from A to B, and the memory occupation value range of the first memory occupation level can be greater than B;
if the current memory occupation value of the target application is in the range of A-B, determining the corresponding memory occupation level as a second memory occupation level; if the current memory occupation value of the target application is greater than B, determining that the corresponding memory occupation level is a first memory occupation level; obviously, in the embodiment of the present invention, more than two memory occupation levels may be set, and in this case, the principle of determining the memory occupation level corresponding to the current memory occupation value of the target application is similar to that described above.
Step S120, according to the corresponding relationship between the set memory usage level and the memory releasing means, releasing the memory usage object of the target application by the memory releasing means corresponding to the memory usage level.
Optionally, the memory release means provided in the embodiment of the present invention does not directly kill the target application, but releases the memory occupied object of the target application on the premise that the target application keeps the running state, so as to release the specific memory occupied object of the target application, reduce the memory occupied by the target application, and improve the running stability of the target application;
optionally, the implementation of the present invention may set a memory release means corresponding to each memory occupation level, so as to release the memory occupation object of the target application by using the corresponding memory release means according to the memory occupation level corresponding to the current memory occupation value of the target application;
optionally, the memory release means corresponding to each memory occupation level may be set by user, the memory release means corresponding to each memory occupation level may be set to be different, and the memory release means corresponding to some memory occupation levels may also be set to be the same.
The memory optimization method provided by the embodiment of the invention comprises the following steps: detecting a memory occupation value occupied by a target application, wherein the target application is provided with a plurality of memory occupation objects occupying a memory; determining a memory occupation grade corresponding to the memory occupation value; and releasing the memory occupied object of the target application by the memory release means corresponding to the memory occupied level according to the corresponding relation between the set memory occupied level and the memory release means. The embodiment of the invention releases the memory occupied object of the target application by determining the memory occupied grade corresponding to the current memory occupied value of the target application and adopting the memory release means corresponding to the determined memory occupied grade instead of directly killing the target application when the memory occupied value of the target application is larger, thereby realizing the release of the specific memory occupied object of the target application, reducing the memory occupied by the target application and improving the running stability of the target application.
Optionally, if the current memory occupation value of the target application is not within the memory occupation value range corresponding to any memory occupation level, it may be determined that the current memory occupation situation of the target application is reduced, and memory optimization may not be needed.
Optionally, when measuring whether to release the memory occupied object of the target application, the embodiment of the present invention may add a consideration factor of the memory occupied trend of the target application; after detecting the memory occupation value occupied by the target application, judging whether the memory occupation trend of the target application is in an ascending trend or not, and when the memory occupation trend of the target application is determined to be in the ascending trend, determining the memory occupation level corresponding to the memory occupation value, and further releasing the memory occupation object of the target application by the memory release means corresponding to the memory occupation level according to the corresponding relationship between the set memory occupation level and the memory release means; if the memory occupation trend of the target application is determined to be in a non-ascending trend after the memory occupation value occupied by the target application is detected, the memory occupied by the target application is continuously reduced, the memory occupation object of the target application can not be released temporarily, and the subsequent processing is not carried out.
Fig. 2 shows another flowchart of a memory optimization method according to an embodiment of the present invention, and referring to fig. 2, the method may include:
step S200, detecting a memory occupation value occupied by a target application, wherein the target application is provided with a plurality of memory occupation objects occupying a memory;
step S210, collecting a memory occupancy value set occupied by the target application in a set time interval, wherein the memory occupancy value set is provided with a plurality of memory occupancy values;
the embodiment of the invention can detect the memory occupation value occupied by the target application at regular time, can realize the detection of the memory occupation value for multiple times after a set time interval to obtain a plurality of memory occupation values, and further form a memory occupation value set by the plurality of memory occupation values;
step S220, judging whether the memory occupation trend is in an ascending trend or not according to the memory occupation value set, if not, executing step S230, and if so, executing step S240;
step S230, determining that the memory occupation trend is in a non-ascending trend, and ending the process;
alternatively, the non-ascending trend may be a descending trend, or a steady trend.
Step 240, determining that the memory occupation trend is in an ascending trend, and determining the memory occupation grade corresponding to the memory occupation value;
step S250, according to the corresponding relationship between the set memory usage level and the memory releasing means, releasing the memory usage object of the target application by the memory releasing means corresponding to the memory usage level.
Optionally, the embodiment of the present invention may determine a wire direction of a memory occupancy trend corresponding to the memory occupancy value set, so as to determine whether the memory occupancy trend is in an ascending trend according to the wire direction, and if the wire direction corresponds to the ascending direction, it may determine that the memory occupancy trend is in the ascending trend, and if the wire direction does not correspond to the ascending direction, it may determine that the memory occupancy trend is in a non-ascending trend; obviously, there are various ways to determine whether the value of a value set is in an ascending trend or a non-ascending trend, and the determination is not limited to the determination by the direction of the wire, and other ways can be used.
Optionally, in order to avoid a process for detecting a memory occupancy value occupied by a target application from being stuck, an embodiment of the present invention may set a memory detection process for detecting a memory occupancy value in a target application, and detect a memory occupancy value occupied by the target application by using the memory detection process in an asynchronous manner; that is, in the embodiment of the present invention, the memory occupied value occupied by the target application may be detected in a timing asynchronous manner by using the memory detection process arranged in the target application.
Optionally, the memory optimization method provided by the embodiment of the invention can be applied to memory optimization of a browser; correspondingly, the target application may be a browser, and the memory occupation object of the target application may be a page of the browser. Fig. 3 is a further flowchart illustrating a memory optimization method according to an embodiment of the present invention, and referring to fig. 3, the method may include:
step S300, detecting the occupied value of the memory occupied by the browser, wherein the browser runs a plurality of browser pages occupying the memory;
step S310, determining a memory occupation grade corresponding to the memory occupation value;
step S320, releasing the page of the browser by the memory release means corresponding to the memory occupation level according to the corresponding relationship between the set memory occupation level and the memory release means.
Optionally, the page for releasing the browser may be a closed page; or releasing the displayed content in the page, such as releasing pictures, videos, texts, etc. in the page.
Optionally, the method shown in fig. 3 may also add a determination factor of the memory usage trend, that is, when the memory usage trend of the browser is in an ascending trend, determining and performing subsequent processing on the memory usage level corresponding to the memory usage value, and when the memory usage trend of the browser is in a non-ascending trend, ending the process, and performing no subsequent processing.
Optionally, in the embodiment of the present invention, a first memory occupation level to an nth memory occupation level may be set, where N is an integer greater than 1, and each memory occupation level corresponds to a memory release means for releasing a browser page; fig. 4 shows a specific form of the memory releasing means corresponding to the memory occupation level, and fig. 4 is only an optional manner, and the embodiment of the present invention can be set by a user as to the memory releasing means corresponding to each memory occupation level.
Fig. 4 is a further flowchart of a memory optimization method according to an embodiment of the present invention, and referring to fig. 4, the method may include:
step S400, detecting the occupied value of the memory occupied by the browser, wherein the browser runs a plurality of browser pages occupying the memory;
step S410, determining a memory occupation level corresponding to the memory occupation value, wherein the memory occupation level of the browser comprises a first memory occupation level to an Nth memory occupation level;
optionally, in the embodiment of the present invention, respective memory occupation value ranges corresponding to the respective memory occupation levels may be set, and by determining the memory occupation value range in which the current memory occupation value of the browser is located, the memory occupation level corresponding to the memory occupation value range in which the current memory occupation value of the browser is located may be determined as the memory occupation level corresponding to the memory occupation value;
step S420, if the memory occupation level is the first memory occupation level, determining a browser page meeting a set release condition, and releasing the browser page meeting the set release condition;
optionally, the memory occupation degree of the first memory occupation level is the highest, the memory release may be performed in a form of a release page (close page), and the selected browser page for performing the release may be a browser page meeting the set release condition; the browser page meeting the set release condition can be set by user;
optionally, the embodiment of the present invention may set a page white list, record, through the page white list, a browser page that does not need to be released, and determine a page that is not in the page white list as a browser page that meets a set release condition; optionally, the pages in the page white list can be set by a user;
optionally, the embodiment of the present invention may also set a page type of the unreleased memory, and a page in a page opened by the browser, which page type does not conform to the page type of the unreleased memory, may be determined as a browser page meeting the set release condition; the page type without releasing the memory can be a song playing page, a game page and the like, and the page type without releasing the memory can be set by self-definition;
optionally, in the embodiment of the present invention, the page with the longest running time may also be determined as the browser page that meets the set release condition.
Step S430, if the memory occupation level is the ith memory occupation level, releasing the content corresponding to the page content type in the browser page according to the page content type of the release memory corresponding to the ith memory occupation level, wherein i is more than 1 and less than or equal to N, and i is an integer.
When the current memory occupation value of the browser corresponds to the ith memory occupation level, the embodiment of the invention can release the content (such as pictures, texts, videos and the like) in the page without releasing the page; specifically, for each non-first memory occupation level, the embodiment of the present invention may set the page content type of the released memory in the browser page, so as to release the content corresponding to the page content type of the released memory in the browser page according to the page content type of the released memory corresponding to the ith memory occupation level.
Optionally, in addition to detecting the memory occupied value of the browser itself, the browser may further receive a memory warning sent by the system, and if the number of times of receiving the memory warning sent by the system is greater than a set number of times (for example, twice and the like, and a specific numerical value may be set according to an actual situation), the browser page meeting the set release condition may be determined according to a processing mechanism of the first memory occupancy level, and the browser page meeting the set release condition is released; obviously, the memory release means with the number of times of the memory warning sent by the system being greater than the set number of times can also be set by self.
Optionally, the user experience is affected due to the fact that the number of pages operated by the browser is too small; therefore, when a memory release mechanism for releasing the browser page is used, the minimum operation limit value of the page number can be added; specifically, when the current memory usage value of the browser corresponds to the first memory usage level (it may also be a non-first memory usage level corresponding to the current memory usage value, and a memory release means for releasing a browser page is correspondingly adopted), it may be determined whether the number of currently running pages of the browser is less than the minimum running limit, only when the number of currently running pages of the browser is not less than the minimum running limit, the browser page meeting the set release condition is released, and when the number of currently running pages of the browser is less than the minimum running limit, the browser page meeting the set release condition is not released.
Fig. 5 shows another flowchart of a memory optimization method according to an embodiment of the present invention, and referring to fig. 5, the method may include:
step S500, detecting the occupied value of the memory occupied by the browser, wherein the browser runs a plurality of pages occupying the memory;
step S510, collecting a memory occupancy value set occupied by the browser in a set time interval, wherein the memory occupancy value set is provided with a plurality of memory occupancy values;
step S520, judging whether the memory occupation trend is in an ascending trend or not according to the memory occupation value set, if not, executing step S530, and if so, executing step S540;
step S530, determining that the memory occupation trend is in a non-ascending trend, and ending the process;
step S540, determining that the memory occupation trend is in an ascending trend, and determining the memory occupation level corresponding to the memory occupation value, wherein the memory occupation level of the browser comprises a first memory occupation level to an Nth memory occupation level;
step S560, determining the browser page meeting the set release condition, and releasing the browser page meeting the set release condition;
step S570, ending the flow;
step S580, if the memory usage level is the ith memory usage level, releasing the content corresponding to the page content type in the browser page according to the page content type of the release memory corresponding to the ith memory usage level, where i is greater than 1 and less than or equal to N, and i is an integer.
Optionally, if the number of times that the browser receives the memory warning sent by the system is greater than the set number of times, the browser page meeting the set release condition may also be determined, and the browser page meeting the set release condition is released.
An application example of memory optimization for a browser according to an embodiment of the present invention is described below:
setting a first-level memory occupation level and a second-level memory occupation level, wherein the memory occupation range of the first-level memory occupation level is more than 30% of the memory occupation ratio, and the memory occupation range of the second-level memory occupation level is 20% -30% of the memory occupation ratio;
asynchronously detecting the memory occupation value of the browser once by using a memory detection process at a fixed time of 0.5 second;
when the memory occupancy value is less than 20 percent (such as 10 percent) of the memory occupancy ratio, the memory optimization is not carried out;
when the memory occupancy value is between 20% and 30% (such as 25%) of the memory occupancy ratio, releasing the picture in the page of the browser, optionally, the release ending condition may be that the memory is reduced to less than 20%, or ending when releasing once, and waiting for the next memory occupancy value detection;
when the memory occupation value is greater than 30% (such as 35%) of the memory occupation ratio, whether the number of the running pages of the browser is smaller than the minimum running limit value or not can be judged, if yes, optimization is not carried out, and if not, the page running for the longest time of the browser can be released.
It should be noted that the memory optimization method provided by the embodiment of the present invention can also be applied to other non-browser scenarios, such as other applications like instant messaging application.
Optionally, the memory optimization method provided in the embodiment of the present invention may be applied to an IOS operating system, and perform memory optimization on a page WebView on an IOS browser; obviously, the memory optimization method provided by the embodiment of the invention can also be applied to other operating systems, such as android, windows, and the like.
According to the memory optimization method provided by the embodiment of the invention, the memory occupation grade corresponding to the current memory occupation value of the target application is determined, the memory release means corresponding to the determined memory occupation grade is adopted to release the memory occupation object of the target application, instead of directly killing the target application when the memory occupation value of the target application is large, the release of the specific memory occupation object of the target application is realized, the memory occupied by the target application is reduced, and the running stability of the target application is improved.
In the following, the memory optimization device provided in the embodiments of the present invention is introduced, and the memory optimization device described below may be referred to the memory optimization method described above correspondingly.
Fig. 6 is a block diagram of a memory optimization apparatus according to an embodiment of the present invention, where the apparatus is applicable to a user equipment, and is configured to perform specific memory optimization on a certain target application loaded by the user equipment; referring to fig. 6, the memory optimization apparatus may include:
a detection module 100, configured to detect a memory usage value occupied by a target application, where the target application has multiple memory usage objects occupying a memory;
a level determining module 200, configured to determine a memory occupation level corresponding to the memory occupation value;
the releasing module 300 is configured to release the memory occupied object of the target application by the memory releasing means corresponding to the memory occupied level according to the corresponding relationship between the set memory occupied level and the memory releasing means.
Optionally, fig. 7 shows another structural block diagram of the memory optimization device according to the embodiment of the present invention, and in combination with fig. 6 and fig. 7, the memory optimization device may further include:
a trend determining module 400, configured to collect a memory occupancy value set occupied by the target application in a set time interval, where the memory occupancy value set has multiple memory occupancy values, and determine whether a memory occupancy trend is in an ascending trend according to the memory occupancy value set, if so, determine that the memory occupancy trend is in the ascending trend, so that the level determining module determines a memory occupancy level corresponding to the memory occupancy value, and if not, determine that the memory occupancy trend is in a non-ascending trend, so that the level determining module cancels the determination of the memory occupancy level corresponding to the memory occupancy value.
Alternatively, fig. 8 shows an alternative structure of the trend determining module 400 provided in the embodiment of the present invention, and referring to fig. 8, the trend determining module 400 may include:
a wire direction determining unit 410, configured to determine a wire direction of a memory occupancy value trend corresponding to the memory occupancy value set;
a trend result determining unit 420, configured to determine that the memory footprint trend is in an increasing trend if the wire direction corresponds to an increasing direction, and determine that the memory footprint trend is in a non-increasing trend if the wire direction does not correspond to the increasing direction.
Optionally, the detection module 100 may detect the memory usage value occupied by the target application in an asynchronous manner, and specifically, the detection module 100 may detect the memory usage value occupied by the target application periodically and asynchronously using a memory detection process set in the target application.
Optionally, the memory optimization device provided in the embodiment of the present invention may be applied to a browser scene, and correspondingly, the target application is a browser, and the memory occupied object is a browser page;
optionally, the memory occupation levels of the target application include a first memory occupation level to an nth memory occupation level, where N is an integer greater than 1;
fig. 9 shows an alternative structure of the releasing module 300 provided by the embodiment of the present invention, and referring to fig. 9, the releasing module 300 may include:
a first releasing unit 310, configured to determine, if the memory occupation level is a first memory occupation level, a browser page meeting a set releasing condition, and release the browser page meeting the set releasing condition;
a second releasing unit 320, configured to release, if the memory occupation level is an ith memory occupation level, content in the browser page corresponding to the page content type of the released memory according to the page content type of the released memory corresponding to the ith memory occupation level, where i is greater than 1 and less than or equal to N, and i is an integer.
Optionally, fig. 10 shows another structural block diagram of the memory optimization device according to the embodiment of the present invention, and in combination with fig. 6, fig. 9, and fig. 10, the memory optimization device may further include:
the system trigger releasing module 500 is configured to determine a browser page meeting a set release condition and release the browser page meeting the set release condition if the number of times of receiving the memory warning sent by the system is greater than a set number of times.
The browser page meeting the set release condition in the embodiment of the invention can be customized, and optionally, when the browser page meeting the set release condition is determined, the embodiment of the invention can determine the page which is not in the page white list as the browser page meeting the set release condition; and/or determining the page with the page type inconsistent with the page type which is set not to release the memory as the browser page which accords with the set release condition; or determining the page with the longest running time as the browser page meeting the set release condition.
Alternatively, fig. 11 shows an alternative structure of the first releasing unit provided in the embodiment of the present invention, and referring to fig. 11, the first releasing unit 310 may include:
a page number judging subunit 3101, configured to judge whether the number of currently operating pages of the browser is less than a minimum operation limit;
a release executing subunit 3102, configured to release the browser page meeting the set release condition if the determination result of the page number determining subunit is negative, and cancel releasing the browser page meeting the set release condition if the determination result of the page number determining subunit is positive.
The embodiment of the present invention further provides a user equipment, which may include the above memory optimization device; the user equipment can be mobile phones, tablet computers, notebook computers and other equipment.
Fig. 12 is a block diagram illustrating a hardware structure of a user equipment according to an embodiment of the present invention, and referring to fig. 12, the user equipment may include: a processor 1, a communication interface 2, a memory 3 and a communication bus 4;
wherein, the processor 1, the communication interface 2 and the memory 3 complete the communication with each other through the communication bus 4;
optionally, the communication interface 2 may be an interface of a communication module, such as an interface of a GSM module;
a processor 1 for executing a program;
a memory 3 for storing a program;
the program may include program code including computer operating instructions.
The processor 1 may be a central processing unit CPU or an application specific Integrated circuit asic or one or more Integrated circuits configured to implement embodiments of the present invention.
The memory 3 may comprise a high-speed RAM memory, and may further comprise a non-volatile memory (non-volatile memory), such as at least one disk memory.
Among them, the procedure can be specifically used for:
detecting a memory occupation value occupied by a target application, wherein the target application is provided with a plurality of memory occupation objects occupying a memory;
determining a memory occupation grade corresponding to the memory occupation value;
and releasing the memory occupied object of the target application by the memory release means corresponding to the memory occupied level according to the corresponding relation between the set memory occupied level and the memory release means.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (13)
1. A method for optimizing a memory, comprising:
detecting a memory occupation value occupied by a target application, wherein the target application is provided with a plurality of memory occupation objects occupying a memory;
when the memory occupation trend of the target application is determined to be in an ascending trend, determining a memory occupation level corresponding to the memory occupation value;
releasing the memory occupied object of the target application by the memory release means corresponding to the memory occupied level according to the corresponding relation between the set memory occupied level and the memory release means; the releasing the memory occupied object of the target application comprises: releasing the content corresponding to the content type in the memory occupied object of the target application according to the content type corresponding to the memory occupied level of the target application;
when the target application is a browser and the memory occupation object is a browser page, if the number of times that the browser receives a memory warning sent by a system is greater than a set number of times, determining the browser page which meets a set release condition according to a processing mechanism of a first memory occupation level;
if the number of the current running pages of the browser is not less than the minimum running limit value, releasing the browser pages meeting the set release conditions;
and if the number of the current running pages of the browser is less than the minimum running limit value, not releasing the browser pages meeting the set release condition.
2. The memory optimization method of claim 1,
the determining that the memory usage trend of the target application is in an ascending trend comprises:
collecting a memory occupancy value set occupied by the target application in a set time interval, wherein the memory occupancy value set is provided with a plurality of memory occupancy values;
judging whether the memory occupation trend is in an ascending trend or not according to the memory occupation value set;
if yes, determining that the memory occupation trend is in an ascending trend, and if not, determining that the memory occupation trend is in a non-ascending trend.
3. The memory optimization method according to claim 2, wherein the determining whether the memory footprint trend is in an ascending trend according to the memory footprint set comprises:
determining a lead direction of a memory occupancy value trend corresponding to the memory occupancy value set;
and if the direction of the lead is not corresponding to the ascending direction, determining that the memory occupation trend is in a non-ascending trend.
4. The memory optimization method according to claim 1, wherein the detecting the memory usage value occupied by the target application comprises:
and using a memory detection process arranged in the target application to detect the memory occupation value occupied by the target application in a timed and asynchronous manner.
5. The memory optimization method according to any one of claims 1 to 4, wherein the memory footprint level of the target application includes a first memory footprint level to an Nth memory footprint level, N being an integer greater than 1.
6. The memory optimization method according to claim 5, wherein the releasing the memory occupied object of the target application by the memory releasing means corresponding to the memory occupation level according to the corresponding relationship between the set memory occupation level and the memory releasing means comprises:
if the memory occupation level is the first memory occupation level, determining a browser page meeting the set release condition, and releasing the browser page meeting the set release condition;
and if the memory occupation level is the ith memory occupation level, releasing the content corresponding to the page content type in the browser page according to the page content type of the released memory corresponding to the ith memory occupation level, wherein i is more than 1 and less than or equal to N, and i is an integer.
7. The memory optimization method according to claim 6, wherein the determining the browser page meeting the set release condition comprises:
determining the page which is not in the page white list as the browser page which accords with the set release condition;
and/or determining the page with the page type not in accordance with the page type of the memory which is not set to be released as the browser page in accordance with the set release condition;
or determining the page with the longest running time as the browser page meeting the set release condition.
8. A memory optimization device, comprising:
the device comprises a detection module, a storage module and a processing module, wherein the detection module is used for detecting a memory occupation value occupied by a target application, and the target application is provided with a plurality of memory occupation objects occupying a memory;
the grade determining module is used for determining the memory occupation grade corresponding to the memory occupation value when the memory occupation trend of the target application is determined to be in an ascending trend;
the release module is used for releasing the memory occupied object of the target application by the memory release means corresponding to the memory occupied level according to the corresponding relation between the set memory occupied level and the memory release means; the releasing the memory occupied object of the target application comprises: releasing the content corresponding to the content type in the memory occupied object of the target application according to the content type corresponding to the memory occupied level of the target application;
the release module is further configured to: when the target application is a browser and the memory occupation object is a browser page, if the number of times that the browser receives a memory warning sent by a system is greater than a set number of times, determining the browser page which meets a set release condition according to a processing mechanism of a first memory occupation level; if the number of the current running pages of the browser is not less than the minimum running limit value, releasing the browser pages meeting the set release conditions; and if the number of the current running pages of the browser is less than the minimum running limit value, not releasing the browser pages meeting the set release condition.
9. The memory optimization device of claim 8, further comprising:
the trend determining module is used for collecting a memory occupancy value set occupied by the target application in a set time interval, wherein the memory occupancy value set has a plurality of memory occupancy values, whether the memory occupancy trend is in an ascending trend is judged according to the memory occupancy value set, if yes, the memory occupancy trend is determined to be in the ascending trend, so that the grade determining module determines the memory occupancy grade corresponding to the memory occupancy value, and if not, the memory occupancy trend is determined to be in a non-ascending trend, so that the grade determining module cancels the determination of the memory occupancy grade corresponding to the memory occupancy value.
10. The memory optimization device according to claim 8, wherein the memory footprint level of the target application includes a first memory footprint level to an nth memory footprint level, N being an integer greater than 1;
the release module includes:
the first release unit is used for determining a browser page meeting set release conditions and releasing the browser page meeting the set release conditions if the memory occupation level is the first memory occupation level;
and the second releasing unit is used for releasing the content corresponding to the page content type in the browser page according to the page content type of the released memory corresponding to the ith memory occupation level if the memory occupation level is the ith memory occupation level, wherein i is more than 1 and less than or equal to N, and i is an integer.
11. A user equipment comprising the memory optimization device of any one of claims 8-10.
12. A user equipment comprising a processor and a memory;
wherein, the memory is used for storing programs;
the processor is configured to execute the program to implement the memory optimization method according to any one of claims 1 to 7.
13. A computer-readable storage medium, in which a software module is stored, which when executed by a processor implements the memory optimization method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510381862.8A CN106326137B (en) | 2015-07-02 | 2015-07-02 | Memory optimization method and device and user equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510381862.8A CN106326137B (en) | 2015-07-02 | 2015-07-02 | Memory optimization method and device and user equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106326137A CN106326137A (en) | 2017-01-11 |
CN106326137B true CN106326137B (en) | 2020-09-22 |
Family
ID=57727008
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510381862.8A Active CN106326137B (en) | 2015-07-02 | 2015-07-02 | Memory optimization method and device and user equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106326137B (en) |
Families Citing this family (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108509350A (en) * | 2017-02-28 | 2018-09-07 | 中兴通讯股份有限公司 | The recovery method and device of memory |
CN107145582B (en) * | 2017-05-09 | 2022-01-04 | 深圳Tcl新技术有限公司 | Control method of database cursor and database system |
CN107766138A (en) * | 2017-10-20 | 2018-03-06 | 北京集奥聚合科技有限公司 | A kind of hadoop Mission Monitors method and system |
CN109710396B (en) | 2017-10-26 | 2023-08-22 | 华为技术有限公司 | Method and device for information acquisition and memory release |
CN109992363B (en) * | 2017-12-29 | 2021-03-26 | Oppo广东移动通信有限公司 | Application program processing method and device, electronic equipment and computer readable storage medium |
CN109992369B (en) * | 2017-12-29 | 2021-06-08 | Oppo广东移动通信有限公司 | Application program processing method and device, electronic equipment and computer readable storage medium |
CN109992368B (en) * | 2017-12-29 | 2023-10-20 | Oppo广东移动通信有限公司 | Application processing method and device, electronic equipment and computer readable storage medium |
CN110321227A (en) * | 2018-03-29 | 2019-10-11 | 腾讯科技(深圳)有限公司 | Page data synchronous method, electronic device and computer readable storage medium |
CN108965471B (en) * | 2018-08-22 | 2021-03-16 | 四川长虹电器股份有限公司 | Method for improving browser memory on smart television |
CN109471719B (en) * | 2018-10-15 | 2021-09-14 | Oppo广东移动通信有限公司 | Storage cleaning method and device, electronic equipment and storage medium |
CN109450724B (en) * | 2018-10-19 | 2022-05-27 | 郑州云海信息技术有限公司 | Test method and related device for NFS memory optimization function |
CN109857556B (en) * | 2019-01-15 | 2021-01-08 | Oppo广东移动通信有限公司 | Memory recovery method and device, storage medium and electronic equipment |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101103335A (en) * | 2005-03-28 | 2008-01-09 | 三菱电机株式会社 | Application management device and storage medium containing its software |
EP2077498A1 (en) * | 2004-02-25 | 2009-07-08 | Research in Motion Limited | Memory management system and method for a mobile device |
CN102170625A (en) * | 2010-02-26 | 2011-08-31 | 中国移动通信集团公司 | Method and device for realizing PCC (Policy and Charging Control) policy |
CN102662850A (en) * | 2012-03-30 | 2012-09-12 | 杭州华三通信技术有限公司 | Memory management method and system |
CN103246568A (en) * | 2013-04-16 | 2013-08-14 | 深圳桑菲消费通信有限公司 | Mobile phone application priority setting method and device |
CN103631661A (en) * | 2013-11-27 | 2014-03-12 | 青岛海信电器股份有限公司 | Internal storage management method and device |
CN103645955A (en) * | 2013-12-16 | 2014-03-19 | 百度在线网络技术(北京)有限公司 | Running management method and device for application program |
CN103761192A (en) * | 2014-01-20 | 2014-04-30 | 华为技术有限公司 | Internal memory distributing method and device |
CN103812911A (en) * | 2012-11-14 | 2014-05-21 | 中兴通讯股份有限公司 | Method and system for controlling and utilizing service resources of PaaS (platform as a service) cloud computing platform |
CN104461742A (en) * | 2014-12-15 | 2015-03-25 | 北京奇虎科技有限公司 | Method and device for optimizing computing equipment |
-
2015
- 2015-07-02 CN CN201510381862.8A patent/CN106326137B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2077498A1 (en) * | 2004-02-25 | 2009-07-08 | Research in Motion Limited | Memory management system and method for a mobile device |
CN101103335A (en) * | 2005-03-28 | 2008-01-09 | 三菱电机株式会社 | Application management device and storage medium containing its software |
CN102170625A (en) * | 2010-02-26 | 2011-08-31 | 中国移动通信集团公司 | Method and device for realizing PCC (Policy and Charging Control) policy |
CN102662850A (en) * | 2012-03-30 | 2012-09-12 | 杭州华三通信技术有限公司 | Memory management method and system |
CN103812911A (en) * | 2012-11-14 | 2014-05-21 | 中兴通讯股份有限公司 | Method and system for controlling and utilizing service resources of PaaS (platform as a service) cloud computing platform |
CN103246568A (en) * | 2013-04-16 | 2013-08-14 | 深圳桑菲消费通信有限公司 | Mobile phone application priority setting method and device |
CN103631661A (en) * | 2013-11-27 | 2014-03-12 | 青岛海信电器股份有限公司 | Internal storage management method and device |
CN103645955A (en) * | 2013-12-16 | 2014-03-19 | 百度在线网络技术(北京)有限公司 | Running management method and device for application program |
CN103761192A (en) * | 2014-01-20 | 2014-04-30 | 华为技术有限公司 | Internal memory distributing method and device |
CN104461742A (en) * | 2014-12-15 | 2015-03-25 | 北京奇虎科技有限公司 | Method and device for optimizing computing equipment |
Also Published As
Publication number | Publication date |
---|---|
CN106326137A (en) | 2017-01-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106326137B (en) | Memory optimization method and device and user equipment | |
CN106648747B (en) | Process preloading processing method and device | |
CN106708607B (en) | Congestion control method and device for message queue | |
CN107643977B (en) | Anti-addiction method and related product | |
CN106911943B (en) | Video display method and device and storage medium | |
EP3751871A1 (en) | Method for a disaster notification service not requiring collecting of location information, and disaster notification server and application system therefor | |
CN104994080B (en) | Information processing method and system and electronic equipment | |
CN109672978B (en) | Wireless hotspot scanning frequency control method and device | |
CN105989122A (en) | Application recommendation method and device | |
CN108390856B (en) | DDoS attack detection method and device and electronic equipment | |
CN108038398B (en) | Two-dimensional code analysis capability test method and device and electronic equipment | |
CN107302493B (en) | Message processing method, message processing device and intelligent terminal | |
CN107426136B (en) | Network attack identification method and device | |
CN108875502B (en) | Face recognition method and device | |
CN106649645B (en) | Playlist processing method and device | |
CN110248211B (en) | Live broadcast room message current limiting method and device, electronic equipment and storage medium | |
CN110928600A (en) | Cleaning method and device for terminal background application, mobile terminal and electronic equipment | |
CN111163152A (en) | Information pushing method and device | |
CN108829397B (en) | System and method for downloading screening rules onto mobile device | |
CN104700830B (en) | A kind of sound end detecting method and device | |
CN106933323B (en) | Method and device for optimizing power consumption of application program and electronic equipment | |
CN106161192A (en) | A kind of method and apparatus of Message Processing | |
CN112596985A (en) | IT asset detection method, device, equipment and medium | |
CN110198476B (en) | Bullet screen behavior abnormity detection method, storage medium, electronic equipment and system | |
CN107360196B (en) | Attack detection method and device and terminal equipment |
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 | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20221205 Address after: 1402, Floor 14, Block A, Haina Baichuan Headquarters Building, No. 6, Baoxing Road, Haibin Community, Xin'an Street, Bao'an District, Shenzhen, Guangdong 518000 Patentee after: Shenzhen Yayue Technology Co.,Ltd. Address before: 2, 518000, East 403 room, SEG science and Technology Park, Zhenxing Road, Shenzhen, Guangdong, Futian District Patentee before: TENCENT TECHNOLOGY (SHENZHEN) Co.,Ltd. |