CN109426565B - Memory allocation method, device and terminal - Google Patents
Memory allocation method, device and terminal Download PDFInfo
- Publication number
- CN109426565B CN109426565B CN201710791005.4A CN201710791005A CN109426565B CN 109426565 B CN109426565 B CN 109426565B CN 201710791005 A CN201710791005 A CN 201710791005A CN 109426565 B CN109426565 B CN 109426565B
- Authority
- CN
- China
- Prior art keywords
- memory value
- value
- target memory
- application
- allocated
- 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
- 238000000034 method Methods 0.000 title claims abstract description 36
- 238000001514 detection method Methods 0.000 claims description 38
- 238000004590 computer program Methods 0.000 claims description 3
- 239000002699 waste material Substances 0.000 abstract description 3
- 230000000694 effects Effects 0.000 abstract description 2
- 230000008569 process Effects 0.000 description 7
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000006978 adaptation Effects 0.000 description 2
- 230000006399 behavior Effects 0.000 description 2
- 230000000903 blocking effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Classifications
-
- 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/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Power Sources (AREA)
- Memory System (AREA)
Abstract
The invention provides a memory allocation method, a device and a terminal, which relate to the field of memory allocation and are used for solving the problem that the memory cannot be dynamically allocated according to the actual use condition of an application in the prior art, and the memory allocation method in the embodiment of the invention comprises the following steps: acquiring a target memory value allocated to the application when running at the next time and a maximum memory value actually required to be occupied; and determining the target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next, the maximum memory value actually required to be occupied and the first preset value. According to the scheme, the dynamic memory allocation method and the dynamic memory allocation device achieve the effects of dynamically allocating the memory according to the actual use condition of the application, improving the user test and avoiding the memory waste.
Description
Technical Field
The invention relates to the field of memory allocation, in particular to a memory allocation method, a memory allocation device and a memory allocation terminal.
Background
The current personalized recommendation algorithm is widely applied to the fields of electronic commerce and the like, and the application is mature, for example, when a user purchases or browses a certain commodity, the system predicts according to the behavior of the user, recommends a certain commodity or recommends some similar shops for the user, and more choices are provided for the user, so that the user has better experience.
The existing memory allocation is to give an initial value to an application, wherein the memory value allocated to the application is the initial value when the application runs each time, and when the allocated memory is insufficient to meet the application requirement in the application running process, the application is allocated until the requirement of the application is met, and if the memory exceeds the specified maximum value, the memory overflows. The problem with this approach is that after an initial value is allocated to an application, if the required memory of the application in the actual use process is far lower than the initial value, at this time, the memory allocated to the application is still the initial value, so that memory waste occurs, and when a plurality of applications are opened simultaneously, a situation that part of the applications have no available memory occurs. In addition, in the running process of the application, if the allocated initial memory cannot meet the requirement of the application, the mode of reallocating the memory to the application can cause the situation of blocking in the running process of the application, so that the user experience is poor.
That is, the memory allocation method in the prior art cannot achieve dynamic allocation of the memory according to the actual use condition of the application, and the user experience is poor.
Disclosure of Invention
The embodiment of the invention aims to solve the technical problem of providing a memory allocation method, a memory allocation device and a terminal, which are used for realizing dynamic memory allocation according to the actual use condition of an application and improving user tests.
In order to solve the above technical problems, the memory allocation method provided by the embodiment of the present invention includes:
acquiring a target memory value allocated to the application when running at the next time and a maximum memory value actually required to be occupied;
and determining the target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next, the maximum memory value actually required to be occupied and the first preset value.
Preferably, the step of obtaining the target memory value to which the application is allocated at the time of the next run comprises:
and acquiring a target memory value of which the value allocated when the application runs for the first time is a second preset value, wherein the second preset value is smaller than the first preset value.
Preferably, the step of obtaining the target memory value to which the application is allocated at the time of the next run further comprises:
when the application runs again, judging whether the application is unloaded before the current running;
and if the application is unloaded, acquiring the target memory value allocated when the application runs at the time according to a first preset mode.
Preferably, the step of obtaining the target memory value allocated when the application runs in the next time according to the first preset mode includes:
acquiring a first target memory value determined according to a target memory value allocated during the last running before the application is unloaded, a maximum memory value actually required to be occupied and a first preset value, and detecting the total number of periods between the time when the application is unloaded and the time when the application is reinstalled, wherein the total number of detecting periods is the total number of times of periodically detecting whether the application is reinstalled;
and obtaining the target memory value allocated when the application runs at the time according to the first target memory value and the total number of detection periods.
Preferably, the step of obtaining the target memory value allocated by the application at the time of running according to the first target memory value and the total number of detection periods includes:
obtaining a second target memory value according to the first target memory value and the total number of detection periods;
if the second target memory value is greater than or equal to the second preset value, determining the second target memory value as the target memory value allocated when the application runs at the next time;
and if the second target memory value is smaller than the second preset value, determining the second preset value as the target memory value allocated when the application runs at the next time.
Preferably, the step of obtaining a second target memory value according to the first target memory value and the total number of detection cycles includes:
by the formula:
obtaining a second target memory value A n Wherein A 'is' n And for the first target memory value, m is the total number of detection periods, and n is the current ordinal number.
Preferably, the step of determining the target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next, the maximum memory value actually required to be occupied and the first preset value includes:
if the maximum memory value is smaller than or equal to the first preset value, determining a target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next time and the maximum memory value;
and if the maximum memory value is larger than the first preset value, determining the first preset value as a target memory value which needs to be allocated when the application runs next time.
Preferably, the step of determining the target memory value to be allocated when the application runs next according to the target memory value to be allocated when the application runs next and the maximum memory value includes:
if the target memory value allocated to the target application in the next operation is greater than or equal to the maximum memory value, determining the target memory value allocated to the application in the next operation as the target memory value required to be allocated to the application in the next operation;
and if the target memory value allocated to the application in the next running is smaller than the maximum memory value, determining the maximum memory value as the target memory value to be allocated to the application in the next running.
According to another aspect of the present invention, an embodiment of the present invention further provides a memory allocation device, including:
the acquisition module is used for acquiring a target memory value allocated to the application when the application runs at the time and a maximum memory value actually required to be occupied by the application when the application runs at the time;
and the determining module is used for determining the target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next time, the maximum memory value actually required to be occupied and the first preset value.
Preferably, the acquisition module includes:
the first obtaining unit is used for obtaining a target memory value with a value which is assigned when the application runs for the first time as a second preset value, and the second preset value is smaller than the first preset value.
Preferably, the acquisition module further comprises:
the judging unit is used for judging whether the application is unloaded before the current running when the application runs again;
and the second acquisition unit is used for acquiring the target memory value allocated when the application runs at the time according to the first preset mode if the application is unloaded.
Preferably, the second acquisition unit includes:
the first acquisition subunit is used for acquiring a first target memory value determined according to a target memory value allocated during the last running before the application is unloaded, a maximum memory value actually required to be occupied and a first preset value, and the total number of detection cycles between the moment when the application is unloaded and the moment when the application is reinstalled, wherein the total number of detection cycles is the total number of times of periodically detecting whether the application is reinstalled;
and the second acquisition subunit is used for acquiring the target memory value allocated when the application runs at the time according to the first target memory value and the total detection period.
Preferably, the second acquisition subunit comprises:
the first acquisition stage subunit is configured to obtain a second target memory value according to the first target memory value and the total number of detection periods;
a first determining primary subunit, configured to determine the second target memory value as a target memory value allocated when the application runs at the present time if the second target memory value is greater than or equal to the second preset value;
and the second determining primary subunit is configured to determine the second preset value as a target memory value allocated when the application runs at the time if the second target memory value is smaller than the second preset value.
Preferably, the first acquisition primary subunit comprises:
by the formula:
obtaining a second target memory value A n Wherein A 'is' n And for the first target memory value, m is the total number of detection periods, and n is the current ordinal number.
Preferably, the determining module includes:
a first determining unit, configured to determine, if the maximum memory value is less than or equal to a first preset value, a target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next time and the maximum memory value;
and the second determining unit is used for determining the first preset value as a target memory value which needs to be allocated when the application runs next time if the maximum memory value is larger than the first preset value.
Preferably, the first determination unit includes:
a first determining subunit, configured to determine, if the target memory value allocated by the application when running is greater than or equal to the maximum memory value, the target memory value allocated by the application when running is the target memory value to be allocated by the application when running next time;
and the second determining subunit is used for determining the maximum memory value as the target memory value which needs to be allocated when the application runs next time if the target memory value allocated when the application runs next time is smaller than the maximum memory value.
According to another aspect of the present invention, there is also provided a terminal, including a memory, a processor, and a computer program stored on the memory and executable on the processor; and the processor realizes the memory allocation method when executing the program.
Compared with the prior art, the memory allocation method, the memory allocation device and the terminal provided by the embodiment of the invention have at least the following beneficial effects:
and determining the target memory value to be allocated in the next running process by applying the target memory value allocated in the next running process, the maximum memory value actually required to be occupied and the first preset value. According to the method and the device, the memory required by the application is dynamically and reasonably allocated according to the actual use condition of the application, so that a user can feel fast application response speed when opening the application, the terminal is smooth to use, and the user experience is improved.
Drawings
Fig. 1 is a flow chart of a memory allocation method according to an embodiment of the invention;
FIG. 2 is a schematic flow chart of step 1 in the embodiment of the invention;
FIG. 3 is a flow chart of step 14 in an embodiment of the invention;
FIG. 4 is a flowchart of step 142 according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart of step 2 in the embodiment of the invention;
FIG. 6 is a flow chart of step 22 in an embodiment of the invention;
fig. 7 is a schematic structural diagram of a memory allocation device according to an embodiment of the invention.
Detailed Description
In order to make the technical problems, technical solutions and advantages to be solved more apparent, the following detailed description will be given with reference to the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided merely to facilitate a thorough understanding of embodiments of the invention. It will therefore be apparent to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. In addition, descriptions of well-known functions and constructions are omitted for clarity and conciseness.
Referring to fig. 1, an embodiment of the present invention provides a memory allocation method, including:
and step 1, acquiring a target memory value allocated when the application runs at the time and a maximum memory value actually required to be occupied.
And 2, determining the target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next time, the maximum memory value actually required to be occupied and the first preset value.
The maximum memory value occupied by the application in the current actual need is the required memory generated based on the use behavior of the user in the application use process according to the user. According to the difference of the user operation on the application, the maximum memory value actually occupied by the application in the next running is also different. The first preset value is a maximum memory limit value which can be allocated for the application of the system limit, and for a plurality of applications, the values of the first preset value are the same.
Specifically, the target memory values allocated by the application at the time of the first run and the non-first run are different, and the non-first run includes two cases of the non-first run in which the application is not offloaded and the non-first run in which the application is offloaded. Referring to fig. 2, the determination of the target memory value allocated at the time of the next run specifically includes:
and step 11, judging whether the application is operated for the first time.
And step 12, if so, acquiring a target memory value of which the value allocated during the first running is a second preset value, wherein the second preset value is smaller than the first preset value.
And step 13, if not, judging whether the application is unloaded before the current operation when the application is operated again.
And step 14, if the application is unloaded, acquiring the target memory value allocated when the application runs at the time according to a first preset mode.
In the embodiment of the invention, the initial values allocated to the plurality of applications in the first running are all the second preset values. If the application is not uninstalled, the determination of the target memory value of the application at the time of the current run is obtained by the method described in step 2.
Specifically, referring to fig. 3, step 14 includes:
step 141, obtaining a first target memory value determined according to a target memory value allocated during the last running before the application is uninstalled, a maximum memory value actually required to be occupied and a first preset value, and a total number of detection periods between the moment when the application is uninstalled and the moment when the application is reinstalled, wherein the total number of detection periods is the total number of times of periodically detecting whether the application is reinstalled;
and step 142, obtaining the target memory value allocated when the application runs at the time according to the first target memory value and the total number of detection periods.
After the application is uninstalled, it is periodically checked at preset time intervals (e.g., 3 days) whether the application is reinstalled, and the total number of detection times is accumulated once every time the application is detected once and the application is detected not to be reinstalled. The first target memory value is obtained by the method described in step 2. Preferably, referring to fig. 4, step 142 includes:
step 1421, obtaining a second target memory value according to the first target memory value and the total number of detection periods;
step 1422, determining whether the second target value is greater than or equal to the second preset value;
step 1423, if the second target memory value is greater than or equal to the second preset value, determining the second target memory value as the target memory value allocated when the application runs at the present time;
in step 1424, if the second target memory value is smaller than the second preset value, the second preset value is determined as the target memory value allocated when the application is running at the present time.
Preferably, step 1421 includes:
by the formula:
obtaining a second target memory value A n Wherein A 'is' n And for the first target memory value, m is the total number of detection periods, and n is the current ordinal number.
Preferably, referring to fig. 5, step 2 includes:
step 21, judging whether the maximum memory value is smaller than or equal to the first preset value;
step 22, if the maximum memory value is less than or equal to the first preset value, determining a target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next time and the maximum memory value;
step 23, if the maximum memory value is greater than the first preset value, determining the first preset value as a target memory value to be allocated when the application runs next time.
The purpose of comparing the maximum memory value actually occupied by the application when running at the time with the first preset value is to prevent the memory allocated to the application from overflowing.
In step 22, the method further implicitly includes that the target memory value allocated when the application runs is smaller than or equal to the first preset value, and when the number of times is the first time, the target memory value allocated when the application runs is a second preset value, and in the previous step, it has been determined that the second preset value is smaller than the first preset value; and after the number of times of the current time is the number of times (for example, the second time), the target memory value allocated when the application is operated at the current time determined according to the previous step is always smaller than or equal to the first preset value.
Preferably, referring to fig. 6, step 22 includes:
step 221, judging whether the target memory value allocated by the application in the current running is greater than or equal to the target memory value;
step 222, if the target memory value allocated to the application in the next run is greater than or equal to the maximum memory value, determining the target memory value allocated to the application in the next run as the target memory value required to be allocated to the application in the next run;
and step 223, if the target memory value allocated to the application in the next running is smaller than the maximum memory value, determining the maximum memory value as the target memory value to be allocated to the application in the next running.
The above method of the present invention will be described in three examples.
Assuming that the initial memory value (second preset value) allocated to the application when running for the first time is 16M, the maximum memory value actually required to be occupied is 34M, and the first preset value is 100M. Assuming that the application is not uninstalled at the second run, at this point 24M is determined to be the target memory value for the application at the second run. If the application is uninstalled in the second running, detecting whether the application is reinstalled or not at the moment of uninstalling the application by taking 3 days as a preset time interval, if the application is reinstalled in the first detection, determining that the target memory value of the application in the first running (total number of times is the second time) after reinstalling is 24M according to the target memory value (16M) allocated in the first running and the maximum memory value (24M) actually required to be occupied by the application, and further obtaining a second target memory value of 12M, wherein the target memory value in the first running after reinstalling is the second preset value (16M) because the second target memory value (12M) is smaller than the second preset value (16M). In this case, the target memory value at the first run after the reinstallation is 16M, regardless of the number of times the application was reinstalled at the time of detection.
Assuming that the initial memory value (first preset value) allocated to the application in the first running is 16M, the maximum memory value actually required to be occupied is 12M, and the second preset value is 100M. Assuming that the application is not uninstalled at the second run, then 16M is determined as the target run value for the application at the second run; if the application is unloaded in the second running, detecting whether the application is reinstalled or not at the moment of unloading the application by taking 3 days as a preset time interval, if the application is reinstalled in the first detection, determining that the target memory value of the application in the first running (total times are the second) after reinstallation is 24M according to the target memory value (16M) allocated in the first running and the maximum memory value (24M) actually required to be occupied by the application, and further obtaining a second target memory value of 12M, wherein the target memory value in the first running after reinstallation is the second preset value (16M) because the second target memory value (12M) is smaller than the second preset value (16M); in this case, the target memory value at the first run after the reinstallation is 16M, regardless of the number of times the application was reinstalled at the time of detection.
Assuming that the initial memory value (first preset value) allocated to the application in the first running is 16M, the maximum memory value actually required to be occupied is 48M, and the second preset value is 100M. Assuming that the application is not uninstalled at the second run, 48M is determined as the target run value for the application at the second run; if the application is uninstalled in the second running, detecting whether the application is reinstalled or not at the moment of uninstalling the application by taking 3 days as a preset time interval, if the application is reinstalled in the first detection, determining that the target memory value of the application in the first running (total number of times is the second time) after reinstalling is 48M according to the target memory value (48M) allocated in the first running and the maximum memory value (48M) actually required to be occupied by the application, and further obtaining a second target memory value of 24M, wherein the target memory value in the first running after reinstalling is the second target memory value (24M) because the second target memory value (24M) is larger than the second preset value (16M). If it is determined that the application is reinstalled at the time of the second detection, it is affirmative that the above-described step can determine that the target memory value at the time of the first run after the application is reinstalled in this state is 16M, and in this case, the target memory value at the time of the first run after the application is reinstalled is 16M regardless of whether the application is determined to be reinstalled at any one time after the second detection.
According to the memory allocation method provided by the embodiment of the invention, the target memory value which is required to be allocated when the application runs next time is determined in advance according to the target memory value which is allocated when the application runs next time, the maximum memory value which is actually required to be occupied and the first preset value, so that the application can run smoothly when running each time, the user experience is improved, meanwhile, the memory is reasonably allocated according to the application needs, the allocated memory is prevented from being wasted, the allocated memory of other applications is less, and the situation of blocking occurs.
Referring to fig. 7, according to another aspect of the present invention, an embodiment of the present invention further provides a memory allocation apparatus, including:
the acquisition module 1 is used for acquiring a target memory value allocated to the application when running at the time and a maximum memory value actually required to be occupied by the application when running at the time;
and the determining module 2 is used for determining the target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next time, the maximum memory value actually required to be occupied and the first preset value.
Preferably, the acquisition module includes:
the first obtaining unit is used for obtaining a target memory value with a value which is assigned when the application runs for the first time as a second preset value, and the second preset value is smaller than the first preset value.
Preferably, the acquisition module further comprises:
the judging unit is used for judging whether the application is unloaded before the current running when the application runs again;
and the second acquisition unit is used for acquiring the target memory value allocated when the application runs at the time according to the first preset mode if the application is unloaded.
Preferably, the second acquisition unit includes:
the first acquisition subunit is used for acquiring a first target memory value determined according to a target memory value allocated during the last running before the application is unloaded, a maximum memory value actually required to be occupied and a first preset value, and the total number of detection cycles between the moment when the application is unloaded and the moment when the application is reinstalled, wherein the total number of detection cycles is the total number of times of periodically detecting whether the application is reinstalled;
and the second acquisition subunit is used for acquiring the target memory value allocated when the application runs at the time according to the first target memory value and the total detection period.
Preferably, the second acquisition subunit comprises:
the first acquisition stage subunit is configured to obtain a second target memory value according to the first target memory value and the total number of detection periods;
a first determining primary subunit, configured to determine the second target memory value as a target memory value allocated when the application runs at the present time if the second target memory value is greater than or equal to the second preset value;
and the second determining primary subunit is configured to determine the second preset value as a target memory value allocated when the application runs at the time if the second target memory value is smaller than the second preset value.
Preferably, the first acquisition primary subunit comprises:
by the formula:
obtaining a second target memory value A n Wherein A 'is' n And for the first target memory value, m is the total number of detection periods, and n is the current ordinal number.
Preferably, the determining module includes:
the first determining unit is configured to determine, if the maximum memory value is less than or equal to a second preset value, a target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next time and the maximum memory value;
and the second determining unit is used for determining the second preset value as a target memory value which needs to be allocated when the application runs next time if the maximum memory value is larger than the first preset value.
Preferably, the first determination unit includes:
a first obtaining subunit, configured to determine the target memory value as a target memory value that needs to be allocated when the application runs next time if the target memory value is greater than or equal to the maximum memory value;
and the second determining subunit is used for determining the maximum memory value as a target memory value which needs to be allocated when the application runs next time if the target value is smaller than the maximum memory value.
The memory allocation device provided by the embodiment of the invention is a device corresponding to the method, and all implementation modes in the method are applicable to the embodiment of the device, so that the same technical effect can be achieved. According to the method and the device, the target memory value allocated when the application runs next time, the maximum memory value occupied by the actual need and the first preset value are used, the target memory value allocated when the application runs next time is dynamically predicted, reasonable allocation of the memory is achieved, user experience is improved, and memory waste is avoided.
According to another aspect of the present invention, there is also provided a terminal, including a memory, a processor, and a computer program stored on the memory and executable on the processor; and the processor realizes the memory allocation method when executing the program.
While the foregoing is directed to the preferred embodiments of the present invention, it will be appreciated by those skilled in the art that various modifications and adaptations can be made without departing from the principles of the present invention, and such modifications and adaptations are intended to be comprehended within the scope of the present invention.
Claims (11)
1. A memory allocation method, comprising:
acquiring a target memory value allocated to the application when running at the next time and a maximum memory value actually required to be occupied;
determining a target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next, the maximum memory value actually required to be occupied and a first preset value;
wherein the step of obtaining the target memory value allocated by the application when running at the time comprises the following steps:
acquiring a target memory value of which the value allocated when the application runs for the first time is a second preset value, wherein the second preset value is smaller than the first preset value;
when the application runs again, judging whether the application is unloaded before the current running;
if the application is unloaded, acquiring a target memory value allocated when the application runs at the present time according to a first preset mode;
the determining, according to the target memory value allocated when the application runs next time, the maximum memory value actually required to be occupied and the first preset value, the target memory value required to be allocated when the application runs next time includes: judging whether the maximum memory value is smaller than or equal to the first preset value;
the step of obtaining the target memory value allocated when the application runs in the next time according to a first preset mode comprises the following steps:
acquiring a first target memory value determined according to a target memory value allocated during the last running before the application is unloaded, a maximum memory value actually required to be occupied and a first preset value, and detecting the total number of periods between the time when the application is unloaded and the time when the application is reinstalled, wherein the total number of detecting periods is the total number of times of periodically detecting whether the application is reinstalled;
and obtaining the target memory value allocated when the application runs at the time according to the size relation between the target memory value determined by the first target memory value and the total number of detection periods and the second preset value.
2. The memory allocation method according to claim 1, wherein the step of obtaining the target memory value allocated when the application is running at the time according to the magnitude relation between the target memory value determined by the first target memory value and the total number of detection periods and a second preset value comprises:
obtaining a second target memory value according to the first target memory value and the total number of detection periods;
if the second target memory value is greater than or equal to the second preset value, determining the second target memory value as the target memory value allocated when the application runs at the next time;
and if the second target memory value is smaller than the second preset value, determining the second preset value as the target memory value allocated when the application runs at the next time.
3. The memory allocation method according to claim 2, wherein the step of obtaining a second target memory value according to the first target memory value and the total number of detection cycles comprises:
by the formula:
obtaining a second target memory value A n Wherein A is ′ n And for the first target memory value, m is the total number of detection periods, and n is the current ordinal number.
4. The memory allocation method according to claim 1, wherein the step of determining the target memory value to be allocated when the application runs next according to the target memory value to be allocated when the application runs next, the maximum memory value to be actually occupied, and the first preset value includes:
if the maximum memory value is smaller than or equal to the first preset value, determining a target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next time and the maximum memory value;
and if the maximum memory value is larger than the first preset value, determining the first preset value as a target memory value which needs to be allocated when the application runs next time.
5. The memory allocation method according to claim 4, wherein the step of determining the target memory value to be allocated for the application at the next run according to the target memory value to be allocated for the application at the next run and the maximum memory value comprises:
if the target memory value allocated to the application in the next operation is greater than or equal to the maximum memory value, determining the target memory value as the target memory value to be allocated to the application in the next operation;
and if the target memory value allocated to the application in the next running is smaller than the maximum memory value, determining the maximum memory value as the target memory value to be allocated to the application in the next running.
6. A memory allocation apparatus, comprising:
the acquisition module is used for acquiring a target memory value allocated to the application when the application runs at the time and a maximum memory value actually required to be occupied by the application when the application runs at the time;
a determining module, configured to determine a target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next, the maximum memory value actually required to be occupied, and the first preset value,
wherein, the acquisition module further includes:
the first acquisition unit is used for acquiring a target memory value with a value which is allocated at the first running time and is a second preset value, wherein the second preset value is smaller than the first preset value;
the judging unit is used for judging whether the application is unloaded before the current running when the application runs again;
the second acquisition unit is used for acquiring the target memory value allocated when the application runs at the present time according to a first preset mode if the application is unloaded;
the determining, according to the target memory value allocated when the application runs next time, the maximum memory value actually required to be occupied and the first preset value, the target memory value required to be allocated when the application runs next time includes: judging whether the maximum memory value is smaller than or equal to the first preset value;
wherein the second acquisition unit includes:
the first acquisition subunit is used for acquiring a first target memory value determined according to a target memory value allocated during the last running before the application is unloaded, a maximum memory value actually required to be occupied and a first preset value, and the total number of detection cycles between the moment when the application is unloaded and the moment when the application is reinstalled, wherein the total number of detection cycles is the total number of times of periodically detecting whether the application is reinstalled;
and the second acquisition subunit is used for acquiring the target memory value allocated when the application runs at the time according to the first target memory value and the total detection period.
7. The memory allocation device of claim 6, wherein the second fetch subunit comprises:
the first acquisition stage subunit is configured to obtain a second target memory value according to the first target memory value and the total number of detection periods;
a first determining primary subunit, configured to determine the second target memory value as a target memory value allocated when the application runs at the present time if the second target memory value is greater than or equal to the second preset value;
and the second determining primary subunit is configured to determine the second preset value as a target memory value allocated when the application runs at the time if the second target memory value is smaller than the second preset value.
8. The memory allocation device of claim 7, wherein the first fetch primary subunit comprises:
by the formula:
obtaining a second target memory value A n Wherein A is ′ n And for the first target memory value, m is the total number of detection periods, and n is the current ordinal number.
9. The memory allocation device of claim 6, wherein the determining module comprises:
a first determining unit, configured to determine, if the maximum memory value is less than or equal to a first preset value, a target memory value to be allocated when the application runs next according to the target memory value allocated when the application runs next time and the maximum memory value;
and the second determining unit is used for determining the first preset value as a target memory value which needs to be allocated when the application runs next time if the maximum memory value is larger than the first preset value.
10. The memory allocation device according to claim 9, wherein the first determining unit includes:
a first determining subunit, configured to determine, if the target memory value allocated when the application is running at the next time is greater than or equal to the maximum memory value, the target memory value as a target memory value to be allocated when the application is running at the next time;
and the second determining subunit is used for determining the maximum memory value as the target memory value which needs to be allocated when the application runs next time if the target memory value allocated when the application runs next time is smaller than the maximum memory value.
11. A terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor; the memory allocation method according to any one of claims 1 to 5, wherein the processor executes the program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710791005.4A CN109426565B (en) | 2017-09-05 | 2017-09-05 | Memory allocation method, device and terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710791005.4A CN109426565B (en) | 2017-09-05 | 2017-09-05 | Memory allocation method, device and terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109426565A CN109426565A (en) | 2019-03-05 |
CN109426565B true CN109426565B (en) | 2024-01-02 |
Family
ID=65514110
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710791005.4A Active CN109426565B (en) | 2017-09-05 | 2017-09-05 | Memory allocation method, device and terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109426565B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112685371A (en) * | 2020-12-30 | 2021-04-20 | 江苏达科信息科技有限公司 | File storage space distribution method and device based on big data and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102420903A (en) * | 2011-11-28 | 2012-04-18 | 惠州Tcl移动通信有限公司 | Mobile phone-based software processing method and mobile phone |
CN104077266A (en) * | 2013-03-27 | 2014-10-01 | 华为技术有限公司 | Multi-core operating system realization method, realization device and realization system |
CN105302738A (en) * | 2015-12-09 | 2016-02-03 | 北京东土科技股份有限公司 | Method and device for distributing memory |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110153978A1 (en) * | 2009-12-21 | 2011-06-23 | International Business Machines Corporation | Predictive Page Allocation for Virtual Memory System |
-
2017
- 2017-09-05 CN CN201710791005.4A patent/CN109426565B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102420903A (en) * | 2011-11-28 | 2012-04-18 | 惠州Tcl移动通信有限公司 | Mobile phone-based software processing method and mobile phone |
CN104077266A (en) * | 2013-03-27 | 2014-10-01 | 华为技术有限公司 | Multi-core operating system realization method, realization device and realization system |
CN105302738A (en) * | 2015-12-09 | 2016-02-03 | 北京东土科技股份有限公司 | Method and device for distributing memory |
Also Published As
Publication number | Publication date |
---|---|
CN109426565A (en) | 2019-03-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108462760B (en) | Electronic device, automatic cluster access domain name generation method and storage medium | |
CN107483351B (en) | Current limiting method and device | |
CN110888746B (en) | Memory management method and device, storage medium and electronic equipment | |
EP3117316A1 (en) | Dynamic resource management for multi-process applications | |
US10552320B2 (en) | Using a projected out of memory score to selectively terminate a process without transitioning to a background mode | |
CN108205469B (en) | MapReduce-based resource allocation method and server | |
CN107247665B (en) | Method and system for testing C interface function | |
CN106020984B (en) | Method and device for creating process in electronic equipment | |
US10698620B2 (en) | Dynamic cache allocation | |
CN110321179B (en) | Application program starting method, system, device and computer storage medium | |
CN109426565B (en) | Memory allocation method, device and terminal | |
CN113741991B (en) | Method and device for improving SSD service quality, computer equipment and storage medium | |
CN110569114B (en) | Service processing method, device, equipment and storage medium | |
US20150339145A1 (en) | Virtual machine service system and virtual machine service providing method thereof | |
EP3188026B1 (en) | Memory resource management method and apparatus | |
CN108733478B (en) | Three-dimensional image processing method and device | |
CN111211915B (en) | Method for adjusting network bandwidth of container, computer device and readable storage medium | |
US9348667B2 (en) | Apparatus for managing application program and method therefor | |
CN111352710A (en) | Process management method and device, computing equipment and storage medium | |
CN111859252B (en) | Method, device, equipment and storage medium for determining loading and unloading duration | |
CN115080657B (en) | Operation token distribution method, system and equipment applied to distributed storage | |
CN111290850B (en) | Data storage method, device and equipment | |
CN110324411B (en) | Service distribution method and device | |
CN113220429A (en) | Method, device, equipment and medium for processing tasks of Java thread pool | |
CN108255417B (en) | Data access method, electronic device and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |