CN117632371A - Memory optimization method, device, equipment and storage medium - Google Patents

Memory optimization method, device, equipment and storage medium Download PDF

Info

Publication number
CN117632371A
CN117632371A CN202311658525.XA CN202311658525A CN117632371A CN 117632371 A CN117632371 A CN 117632371A CN 202311658525 A CN202311658525 A CN 202311658525A CN 117632371 A CN117632371 A CN 117632371A
Authority
CN
China
Prior art keywords
memory
instance
initial
target application
threshold
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.)
Pending
Application number
CN202311658525.XA
Other languages
Chinese (zh)
Inventor
李向煜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen TCL Digital Technology Co Ltd
Original Assignee
Shenzhen TCL Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen TCL Digital Technology Co Ltd filed Critical Shenzhen TCL Digital Technology Co Ltd
Priority to CN202311658525.XA priority Critical patent/CN117632371A/en
Publication of CN117632371A publication Critical patent/CN117632371A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Memory System (AREA)

Abstract

The application provides a memory optimization method, a device, equipment and a storage medium, wherein the method comprises the following steps: responding to a memory adjustment event aiming at a target application, and acquiring a virtual machine running instance of the target application; dynamically addressing based on the running state address of the virtual machine running instance and a preset memory management instance, and positioning a heap memory instance of the target device; acquiring initial memory management parameters of the heap memory instance according to the instance address and the pointer position of the memory management instance; and performing capacity expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain capacity expansion memory management parameters, and performing memory optimization processing on the target application based on the capacity expansion memory management parameters. The resource occupation of the system memory recovery thread is reduced, and the smoothness and stability of the equipment are improved.

Description

Memory optimization method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of memory control technologies, and in particular, to a memory optimization method, apparatus, device, and storage medium.
Background
At present, with the rapid development of intelligent terminals and mobile terminal operating systems, more intelligent terminals are provided with android systems. Android systems are also deeply favored by developers and users due to their high degree of freedom, open source nature and affordability. However, the android system may cause system blocking due to memory during use. That is, as the user frequently operates each function of the application in daily life, the application is in continuous memory application and memory release, and the operating system frequently executes garbage collection operation on the memory, so that the application does not respond. Under the non-response scene of the application, other threads cannot be executed due to the fact that the garbage collection thread occupies the time slice of the intelligent terminal processor, and system blocking is further generated.
Disclosure of Invention
The embodiment of the application provides a memory optimization method, a memory optimization device, memory optimization equipment and a memory medium, and aims to solve the technical problems that in the prior art, an operation system frequently executes garbage collection operation to cause no response of application and system blocking.
In one aspect, an embodiment of the present application provides a memory optimization method, where the memory optimization method includes the following steps:
responding to a memory adjustment event aiming at a target application, and acquiring a virtual machine running instance of the target application; the memory adjustment event is an application adjustment event for requesting to reduce the activity of garbage collection events of the target application;
dynamically addressing based on the running state address of the virtual machine running instance and a preset memory management instance, and positioning a heap memory instance of the target application;
acquiring initial memory management parameters of the heap memory instance according to the instance address and pointer position of the memory management instance in the heap memory instance, wherein the initial memory management parameters comprise an initial minimum memory threshold value and an initial maximum memory threshold value;
and performing capacity expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain capacity expansion memory management parameters, and performing memory optimization processing on the target application based on the capacity expansion memory management parameters.
In one possible implementation manner of the present application, the dynamically addressing to locate the heap memory instance of the target application based on the running state address of the virtual machine running instance and a preset memory management instance includes:
loading a preset addressing method through a target application source code corresponding to the target application to obtain an operation state address of the virtual machine operation instance;
traversing each operation instance in the virtual machine operation instance based on the operation state address and a preset anchor point instance address to obtain a candidate addressing instance;
and carrying out secondary retrieval on the candidate addressing examples based on a preset memory management example, and positioning a heap memory example containing the memory management example.
In one possible implementation manner of the present application, traversing each running instance in the virtual machine running instance based on the running state address and a preset anchor point instance address to obtain a candidate addressing instance includes:
acquiring each running instance and a preset anchor point instance in the virtual machine running instances based on the running state address;
and traversing each operation example according to the preset anchor point example and the preset retrieval range to obtain candidate addressing examples.
In one possible implementation manner of the present application, obtaining an initial memory management parameter of the heap memory instance according to an instance address and a pointer position of a memory management instance in the heap memory instance includes:
acquiring an instance address and a pointer position of a memory management instance in the heap memory instance;
performing a first displacement operation according to the instance address and the pointer position to obtain an initial minimum memory threshold in the heap memory instance;
performing a second displacement operation according to the instance address and the pointer position to obtain an initial maximum memory threshold in the heap memory instance;
and setting the initial minimum memory threshold and the initial maximum memory threshold as initial memory management parameters of the heap memory instance.
In one possible implementation manner of the present application, the performing the capacity expansion processing on the initial memory management parameter according to the device performance parameter to obtain a capacity-expanded memory management parameter includes:
acquiring equipment performance parameters corresponding to a target application, wherein the equipment performance parameters comprise equipment memory capacity and current performance indexes;
expanding the initial minimum memory threshold based on the initial maximum memory threshold and the equipment performance parameter to obtain an expanded minimum memory threshold;
Expanding the initial maximum memory threshold according to the equipment memory capacity and the current performance index to obtain an expanded maximum memory threshold;
and setting the capacity expansion minimum memory threshold and the capacity expansion maximum memory threshold as capacity expansion memory management parameters of the target application.
In one possible implementation manner of the present application, the maximum capacity expansion memory threshold includes any one of a first maximum capacity expansion memory threshold and a second maximum capacity expansion memory threshold;
the expanding the initial maximum memory threshold according to the memory capacity of the device and the current performance index to obtain an expanded maximum memory threshold, including:
calculating a current capacity expansion score of the target application according to the equipment memory capacity and the current performance index;
if the current capacity expansion score is smaller than a preset capacity expansion threshold, expanding the initial maximum memory threshold according to a first capacity expansion multiple to obtain a first capacity expansion maximum memory threshold;
and if the current capacity expansion score is larger than a preset capacity expansion threshold, expanding the initial maximum memory threshold according to a second capacity expansion multiple to obtain a second capacity expansion maximum memory threshold, wherein the first capacity expansion multiple is smaller than the second capacity expansion multiple.
In one possible implementation manner of the present application, the performing, based on the capacity-expansion memory management parameter, memory optimization processing on the target application further includes:
updating the initial memory recovery strategy of the target application according to the memory threshold with the minimum expansion and the memory threshold with the maximum expansion to obtain an updated memory recovery strategy;
and performing memory optimization processing on the target application based on the updated memory recycling strategy and the current application memory of the target application.
In another aspect, the present application provides a memory optimization device, including:
the instance acquisition module is configured to respond to a memory adjustment event aiming at a target application and acquire a virtual machine running instance of the target application; the memory adjustment event is an application adjustment event for requesting to reduce the activity of garbage collection events of the target application;
the heap memory positioning module is configured to dynamically address and position the heap memory instance of the target application based on the running state address of the virtual machine running instance and a preset memory management instance;
the parameter acquisition module is configured to acquire initial memory management parameters of the heap memory instance according to the instance address and the pointer position of the memory management instance in the heap memory instance, wherein the initial memory management parameters comprise an initial minimum memory threshold value and an initial maximum memory threshold value;
And the memory expansion module is configured to perform expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain expansion memory management parameters, and perform memory optimization processing on the target application based on the expansion memory management parameters.
In another aspect, the present application further provides a memory optimization device, where the memory optimization device includes:
one or more processors;
a memory; and
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the steps of the memory optimization method.
In another aspect, the present application also provides a computer readable storage medium having stored thereon a computer program, the computer program being loaded by a processor to perform the steps of the memory optimization method.
In the method, a virtual machine running instance of a target application is obtained by responding to a memory adjustment event aiming at the target application; the memory adjustment event is an application adjustment event for requesting to reduce the activity of garbage collection events of the target application; dynamically addressing based on the running state address of the virtual machine running instance and a preset memory management instance, and positioning a heap memory instance of the target application; acquiring initial memory management parameters of the heap memory instance according to the instance address and pointer position of the memory management instance in the heap memory instance, wherein the initial memory management parameters comprise an initial minimum memory threshold value and an initial maximum memory threshold value; and performing capacity expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain capacity expansion memory management parameters, and performing memory optimization processing on the target application based on the capacity expansion memory management parameters. The method comprises the steps of dynamically addressing the virtual machine corresponding to the application to be subjected to memory optimization to obtain the memory management parameters of the application program, and modifying the memory management parameters, so that the memory recovery times of the system are reduced, the resource occupation of a memory recovery thread of the system is reduced, and the fluency and stability of the equipment are improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic view of a memory optimization method according to an embodiment of the present application;
FIG. 2 is a flow chart of an embodiment of a memory optimization method according to an embodiment of the present application;
FIG. 3 is a flow chart of an embodiment of expanding an initial maximum memory threshold in the memory optimization method provided in the embodiments of the present application;
fig. 4 is a flowchart of an embodiment of performing memory optimization processing on the target application based on the capacity-expansion memory management parameter in the memory optimization method provided in the embodiment of the present application;
FIG. 5 is a schematic structural diagram of an embodiment of a memory optimization device according to the present disclosure;
fig. 6 is a schematic structural diagram of an embodiment of a memory optimization device according to an embodiment of the present application.
Detailed Description
The following description of the technical solutions in the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate orientations or positional relationships based on the drawings are merely for convenience in describing the present invention and simplifying the description, and do not indicate or imply that the apparatus or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more of the described features. In the description of the present invention, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
In this application, the term "exemplary" is used to mean "serving as an example, instance, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. The following description is presented to enable any person skilled in the art to make and use the invention. In the following description, details are set forth for purposes of explanation. It will be apparent to one of ordinary skill in the art that the present invention may be practiced without these specific details. In other instances, well-known structures and processes have not been described in detail so as not to obscure the description of the invention with unnecessary detail. Thus, the present invention is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
At present, with the rapid development of intelligent terminals and mobile terminal operating systems, more intelligent terminals are provided with android systems. Android systems are also deeply favored by developers and users due to their high degree of freedom, open source nature and affordability. However, the android system may cause system blocking due to memory during use. That is, as the user frequently operates each function of the application in daily life, the application is in continuous memory application and memory release, and the operating system frequently executes garbage collection operation on the memory, so that the application does not respond. Under the non-response scene of the application, other threads cannot be executed due to the fact that the garbage collection thread occupies the time slice of the intelligent terminal processor, and system blocking is further generated.
Based on the above, the application provides a memory optimization method, a device, equipment and a computer readable storage medium, so as to solve the technical problems of no response and system blocking caused by frequent execution of garbage collection operation by an operating system in the prior art.
The memory optimization method in the embodiment of the invention is applied to a memory optimization device, the memory optimization device is arranged in a memory optimization device, one or more processors, a memory and one or more application programs are arranged in the memory optimization device, wherein the one or more application programs are stored in the memory and are configured to be executed by the processor to implement the memory optimization method; the memory optimization device may be an intelligent terminal, such as a mobile phone, a tablet computer, a network device, and an intelligent computer.
As shown in fig. 1, fig. 1 is a schematic view of a memory optimization method according to an embodiment of the present application, where a memory optimization scene in the embodiment of the present invention includes a memory optimization device 100 (a memory optimization apparatus is integrated in the memory optimization device 100), and a computer readable storage medium corresponding to the memory optimization method is run in the memory optimization device 100 to execute steps of the memory optimization method.
It may be understood that the memory optimization device in the memory optimization method scenario shown in fig. 1, or the apparatus included in the memory optimization device, is not limited to the embodiment of the present invention, that is, the number of devices and the type of devices of the memory optimization device included in the memory optimization method scenario, or the number of apparatuses and the type of apparatuses included in each device do not affect the overall implementation of the technical solution in the embodiment of the present invention, and may be calculated as equivalent replacement or derivative of the technical solution claimed in the embodiment of the present invention.
The memory optimization device 100 in the embodiment of the present invention is mainly used for: responding to a memory adjustment event aiming at a target application, and acquiring a virtual machine running instance of the target application; the memory adjustment event is an application adjustment event for requesting to reduce the activity of garbage collection events of the target application; dynamically addressing based on the running state address of the virtual machine running instance and a preset memory management instance, and positioning a heap memory instance of the target application; acquiring initial memory management parameters of the heap memory instance according to the instance address and pointer position of the memory management instance in the heap memory instance, wherein the initial memory management parameters comprise an initial minimum memory threshold value and an initial maximum memory threshold value; and performing capacity expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain capacity expansion memory management parameters, and performing memory optimization processing on the target application based on the capacity expansion memory management parameters.
The memory optimization device 100 in the embodiment of the present invention may be an independent memory optimization device, for example, an intelligent terminal such as a mobile phone, a tablet computer, a network device, a server, an intelligent computer, or a memory optimization network or a memory optimization cluster formed by a plurality of memory optimization devices.
The embodiments of the present application provide a memory optimization method, apparatus, device, and computer readable storage medium, which are described in detail below.
It will be understood by those skilled in the art that the application environment shown in fig. 1 is only one application scenario related to the present application scenario, and is not limited to the application scenario of the present application scenario, and other application environments may further include more or fewer memory optimization devices than those shown in fig. 1, or a memory optimization network connection relationship, for example, only one memory optimization device is shown in fig. 1, and it is understood that the scenario of the memory optimization method may further include one or more memory optimization devices, which is not limited herein in particular; memory may also be included in the memory optimization device 100 for storing application data and other data.
It should be noted that, the schematic view of the scenario of the memory optimization method shown in fig. 1 is only an example, and the scenario of the memory optimization method described in the embodiment of the present invention is for more clearly describing the technical solution of the embodiment of the present invention, and does not constitute a limitation on the technical solution provided by the embodiment of the present invention.
Based on the above-mentioned memory optimization method, various embodiments of the memory optimization method disclosed in the present invention are provided.
As shown in fig. 2, fig. 2 is a flow chart of one embodiment of a memory optimization method according to the embodiments of the present application, where the memory optimization method includes the following steps 201 to 204:
201. responding to a memory adjustment event aiming at a target application, and acquiring a virtual machine running instance of the target application;
the memory optimization method in this embodiment is applied to a memory optimization device, and the type and number of the memory optimization device are not particularly limited, that is, the memory optimization device may be one or more intelligent terminals or servers, and in a specific embodiment, the memory optimization device is a smart phone that is equipped with an android system and one or more application programs.
Specifically, in the running process of the memory optimization device, a memory adjustment event aiming at the target application is responded, wherein the memory adjustment event is an operation instruction for driving the memory optimization device to expand the initial memory management parameters of the target application, so that the number of times of triggering the garbage collection event by the target application is reduced. The triggering manner of the memory adjustment event is not specifically limited herein, for example, the triggering manner of the memory adjustment event may be actively triggered by a user, for example, by clicking a memory optimization button in the memory optimization device, to actively trigger the memory adjustment event for one or more target applications. Optionally, the memory adjustment event may be automatically triggered by the memory optimization device, for example, the memory optimization device presets an automatic optimization process, and the memory adjustment event for the target application is automatically triggered by the automatic optimization process. Among these, garbage collection (Garbage Collection, GC) events are operational events that automatically identify and collect objects that are no longer in use, freeing memory space they occupy. Frequent triggering of garbage collection events by the terminal can cause the garbage collection thread to preempt the device processor time slice, resulting in other threads failing to execute, and thus causing program jamming.
Specifically, after receiving the memory adjustment event, the memory optimization device obtains a virtual machine running instance of the java virtual machine corresponding to the target application to be optimized. The target application may be any one or more application programs installed in the terminal. For example, weChat, taobao, beijing east, and red book applications. Alternatively, the target application may also be an end system application or the end system itself. The virtual machine running instance is a run time instance of the java virtual machine corresponding to the target application. That is, the virtual machine running instance is an object in the Java application that is responsible for managing the running state of the JVM. The target application of the terminal can inquire system information, manage memory, execute other processes and the like through the virtual machine running instance, and adjust the memory of the target application program through the virtual machine running instance so as to reduce the activity of the garbage collection process.
202. Dynamically addressing based on the running state address of the virtual machine running instance and a preset memory management instance, and positioning a heap memory instance of the target application;
specifically, after determining the virtual machine running instance of the target application, the memory optimization device further obtains the running state address of the virtual machine running instance, and dynamically addresses through the running state address and a preset memory management instance, so as to search the heap memory instance in the target application.
Specifically, the memory optimization device obtains the target application source code corresponding to the target application, and loads a preset addressing method through the target application source code, so that the running state address of the virtual machine running instance is derived by the target application source code in running. The preset addressing method may be JNI (Java Native Interface) method.
Specifically, the memory optimization device declares the preset addressing method in the target application source code, generates an addressing header file corresponding to the preset addressing method, and generates a corresponding link library based on the addressing header file, so that the preset addressing method is loaded in the target application source code execution process, and the running state address of the virtual machine running instance is obtained.
Specifically, after obtaining the running state address of the virtual machine running instance, the memory optimization device also obtains a preset anchor point instance address in the virtual machine running instance. The preset anchor point instance address is an instance address of a specific java instance object which exists in the virtual machine running instance and is used as a traversing starting point of each running instance in the traversing virtual machine running instance. In a specific embodiment, the preset anchor point instance is a java_vm instance.
Specifically, the memory optimization device traverses each running instance in the virtual machine running instance according to the preset anchor point instance address and the running state address to obtain each candidate addressing instance in the virtual machine running instance. The memory optimizing device searches each operation instance corresponding to the operation state address according to a preset search range corresponding to a preset traversal direction and takes the searched operation instance as a candidate addressing instance. The candidate addressing instance is an operation instance in a preset search range corresponding to a preset traversal direction according to a preset anchor point instance address serving as a starting point in the virtual machine operation instance.
Specifically, the memory optimization device performs secondary search on each candidate addressing instance according to a preset memory management instance, so as to locate the heap memory instance of the target application. Wherein the heap memory instance is an instance object for storing an object instance and an array. The heap memory instance stores initial memory management parameters.
Specifically, the memory optimization device performs secondary search on the pointed candidate addressing examples, judges whether a memory management example exists in each candidate addressing example, if the memory management example exists in the candidate addressing examples, determines that the candidate addressing example containing the memory management example is a heap memory example, locates the heap memory example, and obtains an example address of the heap memory example. The memory management instance is a region_space instance.
203. Acquiring initial memory management parameters of the heap memory instance according to the instance address and pointer position of the memory management instance in the heap memory instance;
specifically, after obtaining the heap memory instance, the memory optimization device further obtains an instance address and a pointer position of a memory management instance in the heap memory instance, and obtains an initial memory management parameter in the heap memory instance according to the instance address and the pointer position.
Specifically, the memory optimization device obtains the pointer position of the memory management instance in the heap memory instance by specifying a name pointer, further obtains the instance address of the memory management instance, and performs displacement operation according to the pointer position and the instance address to obtain the initial memory parameter in the heap memory instance. The initial memory parameter includes an initial minimum memory threshold and an initial maximum memory threshold. The initial minimum memory threshold is the minimum memory threshold that triggers a garbage collection event. The initial maximum memory threshold is the maximum memory threshold that triggers a garbage collection event.
Specifically, the memory optimization device performs a first displacement operation through the instance address and the pointer position, and locates an initial minimum memory threshold in the heap memory instance, and an instance address of the initial minimum memory threshold, where the first displacement operation is a first step of controlling the pointer position to displace, and in one embodiment, the first displacement operation is one-plus-one. That is, the first displacement operation is to control the pointer position to move one instance position below the memory management instance in the heap memory instance. Alternatively, in other embodiments, the first displacement operation may also customize an instance location for movement.
Specifically, the memory optimization device performs a second displacement operation through the instance address and the pointer position, and locates an initial maximum memory threshold value in the heap memory instance and an instance address of the initial maximum memory threshold value. Wherein the second displacement operation is to control the pointer position to be displaced by a second instance number, and in one embodiment, the second displacement operation is to add two. That is, the second displacement operation is to control the pointer position to move down by two instance positions from the memory management instance.
Specifically, the memory optimization device sets the obtained initial minimum memory threshold and initial maximum memory threshold as initial memory management parameters of the heap memory instance.
204. And performing capacity expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain capacity expansion memory management parameters, and performing memory optimization processing on the target application based on the capacity expansion memory management parameters.
Specifically, since the triggering condition of the garbage collection event of each application in the terminal is associated with the initial memory management parameter, after the memory optimization device locates the instance address of the initial memory management parameter, the memory optimization device performs capacity expansion processing on the initial memory management parameter according to the device performance parameter and the instance address of the initial memory management parameter, so as to obtain a capacity expansion memory management parameter, and performs memory optimization processing on the target application through the capacity expansion memory management parameter, thereby reducing the activity of the garbage collection event of the target application, that is, reducing the triggering times of the garbage collection event, so as to improve the running stability and fluency of the terminal.
Specifically, before the memory optimization device expands the initial memory management parameter, the memory optimization device further obtains a device performance parameter of the terminal, where the device performance parameter includes a device memory capacity and a current performance index. The memory capacity of the device is the maximum memory capacity and the current memory capacity of the terminal corresponding to the characterization target application. The current performance index is a parameter index representing the performance of the terminal, such as the current processor utilization rate, the processing speed and the like of the terminal corresponding to the target application.
Specifically, after the memory optimization device obtains the device performance parameter of the terminal, the memory optimization device further expands the initial minimum memory threshold according to the device performance parameter and the initial maximum memory threshold to obtain an expanded minimum memory threshold. The memory optimization device determines the expansion multiple of the initial minimum memory threshold value through the device performance parameter, updates the initial minimum memory threshold value through the initial maximum memory threshold value, sets the initial maximum memory threshold value as the updated initial minimum memory threshold value, and multiplies the expansion multiple by the updated initial minimum memory threshold value to obtain the expansion minimum memory threshold value. Wherein the capacity expansion minimum memory threshold is greater than the initial minimum memory threshold. The expansion multiple of the initial minimum memory threshold is proportional to the device performance parameter.
Specifically, the memory optimization device expands the initial maximum memory threshold according to the memory capacity and the current performance index of the device to obtain the maximum memory threshold, sets the minimum memory threshold and the maximum memory threshold as expansion memory management parameters of the target application, and updates the triggering condition of the garbage collection event of the target application based on the expansion memory management parameters, thereby reducing the triggering times of the garbage collection event.
In this embodiment, the memory optimization device obtains a virtual machine running instance of a target application by responding to a memory adjustment event for the target application; the memory adjustment event is an application adjustment event for requesting to reduce the activity of garbage collection events of the target application; dynamically addressing based on the running state address of the virtual machine running instance and a preset memory management instance, and positioning a heap memory instance of the target application; acquiring initial memory management parameters of the heap memory instance according to the instance address and pointer position of the memory management instance in the heap memory instance, wherein the initial memory management parameters comprise an initial minimum memory threshold value and an initial maximum memory threshold value; and performing capacity expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain capacity expansion memory management parameters, and performing memory optimization processing on the target application based on the capacity expansion memory management parameters. The method comprises the steps of dynamically addressing the virtual machine corresponding to the application to be subjected to memory optimization to obtain the memory management parameters of the application program, and modifying the memory management parameters, so that the memory recovery times of the system are reduced, the resource occupation of a memory recovery thread of the system is reduced, and the fluency and stability of the equipment are improved.
As shown in fig. 3, fig. 3 is a flow chart of an embodiment of expanding an initial maximum memory threshold in the memory optimization method provided in the embodiment of the present application, and specifically, in this embodiment, the memory optimization method includes steps 301 to 303:
301. calculating a current capacity expansion score of the target application according to the equipment memory capacity and the current performance index;
based on the above embodiment, in this embodiment, when the memory optimization device expands the initial minimum memory threshold based on the initial maximum memory threshold and the device performance parameter to obtain the expanded minimum memory threshold, the memory optimization device further expands the initial maximum memory threshold according to the device memory capacity and the current performance index to obtain the expanded maximum memory threshold.
Specifically, the memory optimization device calculates a current capacity expansion score of the target application according to the device memory capacity and the current performance index. Wherein the current dilatation score is a current terminal performance score characterizing the target application association.
Specifically, the memory optimization device presets a first capacity expansion weight corresponding to the memory capacity of the device and a second capacity expansion weight corresponding to the second current performance index.
Optionally, the memory optimization device performs normalized scoring processing on the device memory capacity and the current performance index to obtain a device memory score and a device performance score, and weights the device memory score through a first expansion weight to obtain a weighted device memory score. And weighting the equipment performance score through the second capacity expansion weight to obtain a weighted equipment performance score, and calculating the sum of the weighted equipment memory score and the weighted equipment performance score to obtain the current capacity expansion score.
Optionally, in other embodiments, the memory optimization device further trains the preset model in advance through a preset memory capacity sample and a performance index sample to obtain a capacity expansion scoring model, and inputs the memory capacity and the current performance index of the device into the capacity expansion scoring model to calculate the current capacity expansion score of the target application.
302. If the current capacity expansion score is smaller than a preset capacity expansion threshold, expanding the initial maximum memory threshold according to a first capacity expansion multiple to obtain a first capacity expansion maximum memory threshold;
specifically, the memory optimization device presets a preset capacity expansion threshold for judging the performance level corresponding to the target application, and determines a capacity expansion multiple by comparing the current capacity expansion score with the preset capacity expansion threshold, and expands the initial maximum memory threshold according to the capacity expansion multiple to obtain a first capacity expansion maximum memory threshold so as to avoid the target application occupying the terminal operation and storage due to unlimited increase of garbage collection event conditions. The capacity expansion multiple comprises a first capacity expansion multiple and a second capacity expansion multiple, wherein the first capacity expansion multiple is the capacity expansion multiple for carrying out low-amplitude capacity expansion on the initial maximum memory threshold value when the current performance level of the terminal is weaker. And the second expansion multiple is the expansion multiple of performing high-amplitude expansion on the initial maximum memory threshold value when the current performance level of the terminal is higher. In one embodiment, the first expansion factor is 1.2. The second expansion multiple is 2 times. Optionally, in other embodiments, the first expansion multiple and the second expansion multiple can be set in a self-defined manner according to an actual performance level of the terminal, so that the first expansion multiple is ensured to be smaller than the second expansion multiple.
Optionally, if the current capacity expansion score is smaller than the preset capacity expansion threshold, the memory optimization device determines that the current performance level of the terminal corresponding to the target application is weaker, and the memory optimization device expands the initial maximum memory threshold according to the first capacity expansion multiple, that is, multiplies the first capacity expansion multiple by the initial maximum memory threshold to expand the capacity, so as to obtain the first capacity expansion maximum memory threshold.
303. And if the current capacity expansion score is larger than a preset capacity expansion threshold, expanding the initial maximum memory threshold according to a second capacity expansion multiple to obtain a second capacity expansion maximum memory threshold.
Optionally, if the current capacity expansion score is greater than or equal to the preset capacity expansion threshold, the memory optimization device determines that the current performance level of the terminal corresponding to the target application is stronger, and the memory optimization device expands the initial maximum memory threshold according to the second capacity expansion multiple, that is, multiplies the second capacity expansion multiple by the initial maximum memory threshold to expand the initial maximum memory threshold, so as to obtain the second capacity expansion maximum memory threshold.
Specifically, after acquiring the memory threshold with the minimum expansion and the memory threshold with the maximum expansion or the memory threshold with the maximum second expansion, the terminal updates the trigger condition of the garbage collection event of the target application according to the memory threshold with the minimum expansion and the memory threshold with the maximum first expansion or the memory threshold with the maximum second expansion, thereby reducing the trigger times of the garbage collection event.
In the implementation, the memory optimization device calculates a current capacity expansion score of the target application according to the memory capacity of the device and the current performance index; if the current capacity expansion score is smaller than a preset capacity expansion threshold, expanding the initial maximum memory threshold according to a first capacity expansion multiple to obtain a first capacity expansion maximum memory threshold; and if the current capacity expansion score is larger than a preset capacity expansion threshold, expanding the initial maximum memory threshold according to a second capacity expansion multiple to obtain a second capacity expansion maximum memory threshold, wherein the first capacity expansion multiple is smaller than the second capacity expansion multiple. The method and the device realize the dynamic increase of the initial maximum memory threshold according to the terminal performance index corresponding to the target application, thereby reducing the triggering times of the garbage collection event, avoiding the target application from occupying the terminal operation memory due to unlimited increase of the garbage collection event condition, and improving the application stability.
As shown in fig. 4, fig. 4 is a flow chart of an embodiment of performing memory optimization processing on the target application based on the capacity-expansion memory management parameter in the memory optimization method provided in the embodiment of the present application, and specifically, in this embodiment, the memory optimization method further includes steps 401 to 402:
401. Updating the initial memory recovery strategy of the target application according to the memory threshold with the minimum expansion and the memory threshold with the maximum expansion to obtain an updated memory recovery strategy;
402. and performing memory optimization processing on the target application based on the updated memory recycling strategy and the current application memory of the target application.
Specifically, after the memory optimizing device expands the initial minimum memory threshold and the initial maximum memory threshold of the target application to obtain the expanded minimum memory threshold and the expanded maximum memory threshold, the memory optimizing device updates the initial memory reclamation strategy of the target application according to the expanded minimum memory threshold and the expanded maximum memory threshold to obtain the updated reclamation strategy.
Specifically, the memory optimization device obtains an initial minimum deactivation parameter and an initial maximum deactivation parameter in an initial memory reclamation policy of the target application, updates the initial minimum deactivation parameter according to the capacity-expansion minimum memory threshold, and updates the initial maximum deactivation parameter according to the capacity-expansion maximum memory threshold to obtain an updated reclamation policy. The initial minimum deactivation parameter is a minimum discrimination threshold for determining whether to trigger a garbage collection event. The initial maximum deactivation parameter is a maximum discrimination threshold for determining whether to trigger a garbage collection event. The calculation mode of the initial minimum deactivation parameter is that the product of the preset deactivation coefficient multiplied by the initial minimum memory threshold is set as the initial minimum deactivation parameter. The initial maximum deactivation parameter is set as the product of the preset deactivation coefficient multiplied by the initial maximum memory threshold. Optionally, in a specific embodiment, the preset deactivation factor is 3.
Specifically, the memory optimization device replaces the initial minimum memory threshold value in the initial minimum deactivation parameter with the capacity-expansion minimum memory threshold value, calculates the product of the preset deactivation coefficient and the capacity-expansion minimum memory threshold value, and sets the product of the preset deactivation coefficient and the capacity-expansion minimum memory threshold value as the updated minimum deactivation parameter.
Specifically, the memory optimization device replaces the initial maximum memory threshold in the initial maximum deactivation parameter with the capacity-expansion maximum memory threshold, calculates the product of the preset deactivation coefficient and the capacity-expansion maximum memory threshold, and sets the product of the preset deactivation coefficient and the capacity-expansion maximum memory threshold as the updated maximum deactivation parameter.
Specifically, after acquiring the updated minimum deactivation parameter and the updated maximum deactivation parameter, the memory optimization device configures a garbage collection condition of the target application according to the updated minimum deactivation parameter and the updated maximum deactivation parameter to obtain an updated memory collection strategy.
Specifically, after the memory optimization device acquires the updated memory recycling policy of the target application, the current application memory of the target application is counted, whether the current application memory falls into a garbage recycling condition or not is judged, if not, a garbage recycling event is not triggered, and if so, the garbage recycling event is triggered, so that the triggering times of the garbage recycling event are reduced.
In the implementation, the memory optimization device updates the initial memory reclamation strategy of the target application according to the memory threshold with the minimum capacity expansion and the memory threshold with the maximum capacity expansion to obtain an updated memory reclamation strategy; and performing memory optimization processing on the target application based on the updated memory recycling strategy and the current application memory of the target application. And the memory recovery strategy of the target application is updated, and the triggering times of garbage recovery events are reduced.
In order to better implement the memory optimization method in the embodiment of the present application, based on the memory optimization method, the embodiment of the present application further provides a memory optimization device, as shown in fig. 5, fig. 5 is a schematic structural diagram of the memory optimization device provided in the embodiment of the present application, and specifically, the memory optimization device 500 includes:
an instance acquisition module 501 configured to acquire a virtual machine running instance of a target application in response to a memory adjustment event for the target application; the memory adjustment event is an application adjustment event for requesting to reduce the activity of garbage collection events of the target application;
the heap memory positioning module 502 is configured to dynamically address and position the heap memory instance of the target application based on the running state address of the virtual machine running instance and a preset memory management instance;
A parameter obtaining module 503, configured to obtain an initial memory management parameter of the heap memory instance according to an instance address and a pointer position of a memory management instance in the heap memory instance, where the initial memory management parameter includes an initial minimum memory threshold and an initial maximum memory threshold;
the memory expansion module 504 is configured to perform expansion processing on the initial memory management parameter according to the device performance parameter, obtain an expanded memory management parameter, and perform memory optimization processing on the target application based on the expanded memory management parameter.
In one possible implementation manner of this embodiment, the memory optimization device performs dynamic addressing based on the running state address of the virtual machine running instance and a preset memory management instance, and locates a heap memory instance of the target application, including:
loading a preset addressing method through a target application source code corresponding to the target application to obtain an operation state address of the virtual machine operation instance;
traversing each operation instance in the virtual machine operation instance based on the operation state address and a preset anchor point instance address to obtain a candidate addressing instance;
and carrying out secondary retrieval on the candidate addressing examples based on a preset memory management example, and positioning a heap memory example containing the memory management example.
In one possible implementation manner of this embodiment, the memory optimization device traverses each running instance in the virtual machine running instances based on the running state address and the preset anchor point instance address to obtain a candidate addressing instance, including:
acquiring each running instance and a preset anchor point instance in the virtual machine running instances based on the running state address;
and traversing each operation example according to the preset anchor point example and the preset retrieval range to obtain candidate addressing examples.
In one possible implementation manner of this embodiment, the memory optimization device obtains, according to an instance address and a pointer position of a memory management instance in the heap memory instance, an initial memory management parameter of the heap memory instance, including:
acquiring an instance address and a pointer position of a memory management instance in the heap memory instance;
performing a first displacement operation according to the instance address and the pointer position to obtain an initial minimum memory threshold in the heap memory instance;
performing a second displacement operation according to the instance address and the pointer position to obtain an initial maximum memory threshold in the heap memory instance;
and setting the initial minimum memory threshold and the initial maximum memory threshold as initial memory management parameters of the heap memory instance.
In one possible implementation manner of this embodiment, the memory optimization apparatus performs capacity expansion processing on the initial memory management parameter according to the device performance parameter to obtain a capacity-expanded memory management parameter, including:
acquiring equipment performance parameters corresponding to a target application, wherein the equipment performance parameters comprise equipment memory capacity and current performance indexes;
expanding the initial minimum memory threshold based on the initial maximum memory threshold and the equipment performance parameter to obtain an expanded minimum memory threshold;
expanding the initial maximum memory threshold according to the equipment memory capacity and the current performance index to obtain an expanded maximum memory threshold;
and setting the capacity expansion minimum memory threshold and the capacity expansion maximum memory threshold as capacity expansion memory management parameters of the target application.
In one possible implementation manner of this embodiment, the memory optimization apparatus expands the initial maximum memory threshold according to the device memory capacity and the current performance index to obtain an expanded maximum memory threshold, including:
calculating a current capacity expansion score of the target application according to the equipment memory capacity and the current performance index;
If the current capacity expansion score is smaller than a preset capacity expansion threshold, expanding the initial maximum memory threshold according to a first capacity expansion multiple to obtain a first capacity expansion maximum memory threshold;
and if the current capacity expansion score is larger than a preset capacity expansion threshold, expanding the initial maximum memory threshold according to a second capacity expansion multiple to obtain a second capacity expansion maximum memory threshold, wherein the first capacity expansion multiple is smaller than the second capacity expansion multiple.
In one possible implementation manner of this embodiment, the memory optimization device performs memory optimization processing on the target application based on the capacity-expansion memory management parameter, and further includes:
updating the initial memory recovery strategy of the target application according to the memory threshold with the minimum expansion and the memory threshold with the maximum expansion to obtain an updated memory recovery strategy;
and performing memory optimization processing on the target application based on the updated memory recycling strategy and the current application memory of the target application.
In this embodiment, the memory optimization device obtains a virtual machine running instance of a target application by responding to a memory adjustment event for the target application; the memory adjustment event is an application adjustment event for requesting to reduce the activity of garbage collection events of the target application; dynamically addressing based on the running state address of the virtual machine running instance and a preset memory management instance, and positioning a heap memory instance of the target application; acquiring initial memory management parameters of the heap memory instance according to the instance address and pointer position of the memory management instance in the heap memory instance, wherein the initial memory management parameters comprise an initial minimum memory threshold value and an initial maximum memory threshold value; and performing capacity expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain capacity expansion memory management parameters, and performing memory optimization processing on the target application based on the capacity expansion memory management parameters. The method comprises the steps of dynamically addressing the virtual machine corresponding to the application to be subjected to memory optimization to obtain the memory management parameters of the application program, and modifying the memory management parameters, so that the memory recovery times of the system are reduced, the resource occupation of a memory recovery thread of the system is reduced, and the fluency and stability of the equipment are improved.
The embodiment of the invention also provides a memory optimizing device, as shown in fig. 6, and fig. 6 is a schematic structural diagram of an embodiment of the memory optimizing device provided in the embodiment of the application.
The memory optimization device integrates any one of the memory optimization devices provided by the embodiment of the invention, and the memory optimization device comprises:
one or more processors;
a memory; and
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to perform the steps of the memory optimization method described in any of the memory optimization method embodiments above.
Specifically, the present invention relates to a method for manufacturing a semiconductor device. The memory optimization device can include components such as a processor 601 of one or more processing cores, a memory 602 of one or more computer-readable storage media, a power supply 603, and an input unit 604. It will be appreciated by those skilled in the art that the memory optimization device structure shown in fig. 6 is not limiting of the memory optimization device and may include more or fewer components than shown, or certain components may be combined, or a different arrangement of components. Wherein:
the processor 601 is a control center of the memory optimization device, and uses various interfaces and lines to connect various parts of the entire memory optimization device, and executes various functions of the memory optimization device and processes data by running or executing software programs and/or modules stored in the memory 602, and calling data stored in the memory 602, thereby performing overall monitoring of the memory optimization device. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor primarily handles operating systems, user interfaces, applications, etc., and the modem processor primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 601.
The memory 602 may be used to store software programs and modules, and the processor 601 may execute various functional applications and data processing by executing the software programs and modules stored in the memory 602. The memory 602 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the memory optimization device, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide access to the memory 602 by the processor 601.
The memory optimization device further includes a power supply 603 for supplying power to the various components, and preferably, the power supply 603 may be logically connected to the processor 601 through a power management system, so as to implement functions of managing charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more of any components, such as a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The memory optimization device can also include an input unit 604, which input unit 604 can be used to receive entered numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the memory optimization device may further include a display unit and the like, which are not described herein. In particular, in this embodiment, the processor 601 in the memory optimization device loads executable files corresponding to the processes of one or more application programs into the memory 602 according to the following instructions, and the processor 601 executes the application programs stored in the memory 602, so as to implement various functions as follows:
responding to a memory adjustment event aiming at a target application, and acquiring a virtual machine running instance of the target application; the memory adjustment event is an application adjustment event for requesting to reduce the activity of garbage collection events of the target application;
dynamically addressing based on the running state address of the virtual machine running instance and a preset memory management instance, and positioning a heap memory instance of the target application;
acquiring initial memory management parameters of the heap memory instance according to the instance address and pointer position of the memory management instance in the heap memory instance, wherein the initial memory management parameters comprise an initial minimum memory threshold value and an initial maximum memory threshold value;
And performing capacity expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain capacity expansion memory management parameters, and performing memory optimization processing on the target application based on the capacity expansion memory management parameters.
To this end, embodiments of the present invention provide a computer-readable storage medium, which may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like. The computer program is stored on the computer program, and the computer program is loaded by a processor to execute the steps in any memory optimization method provided by the embodiment of the invention. For example, the loading of the computer program by the processor may perform the steps of:
responding to a memory adjustment event aiming at a target application, and acquiring a virtual machine running instance of the target application; the memory adjustment event is an application adjustment event for requesting to reduce the activity of garbage collection events of the target application;
dynamically addressing based on the running state address of the virtual machine running instance and a preset memory management instance, and positioning a heap memory instance of the target application;
Acquiring initial memory management parameters of the heap memory instance according to the instance address and pointer position of the memory management instance in the heap memory instance, wherein the initial memory management parameters comprise an initial minimum memory threshold value and an initial maximum memory threshold value;
and performing capacity expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain capacity expansion memory management parameters, and performing memory optimization processing on the target application based on the capacity expansion memory management parameters.
In the foregoing embodiments, the descriptions of the embodiments are focused on, and the portions of one embodiment that are not described in detail in the foregoing embodiments may be referred to in the foregoing detailed description of other embodiments, which are not described herein again.
In the implementation, each unit or structure may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit or structure may be referred to the foregoing method embodiments and will not be repeated herein.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
The foregoing describes in detail a memory optimization method provided by the embodiments of the present application, and specific embodiments are applied to illustrate the principles and embodiments of the present invention, where the foregoing embodiments are only used to help understand the method and core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present invention, the present description should not be construed as limiting the present invention.

Claims (10)

1. The memory optimization method is characterized by comprising the following steps:
responding to a memory adjustment event aiming at a target application, and acquiring a virtual machine running instance of the target application; the memory adjustment event is an application adjustment event for requesting to reduce the activity of garbage collection events of the target application;
dynamically addressing based on the running state address of the virtual machine running instance and a preset memory management instance, and positioning a heap memory instance of the target application;
acquiring initial memory management parameters of the heap memory instance according to the instance address and pointer position of the memory management instance in the heap memory instance, wherein the initial memory management parameters comprise an initial minimum memory threshold value and an initial maximum memory threshold value;
and performing capacity expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain capacity expansion memory management parameters, and performing memory optimization processing on the target application based on the capacity expansion memory management parameters.
2. The memory optimization method according to claim 1, wherein the dynamically addressing, based on the running state address of the virtual machine running instance and a preset memory management instance, locates a heap memory instance of the target application, includes:
Loading a preset addressing method through a target application source code corresponding to the target application to obtain an operation state address of the virtual machine operation instance;
traversing each operation instance in the virtual machine operation instance based on the operation state address and a preset anchor point instance address to obtain a candidate addressing instance;
and carrying out secondary retrieval on the candidate addressing examples based on a preset memory management example, and positioning a heap memory example containing the memory management example.
3. The memory optimization method of claim 2, wherein traversing each of the virtual machine operating instances based on the operating state address and a preset anchor point instance address to obtain a candidate addressing instance comprises:
acquiring each running instance and a preset anchor point instance in the virtual machine running instances based on the running state address;
and traversing each operation example according to the preset anchor point example and the preset retrieval range to obtain candidate addressing examples.
4. The memory optimization method of claim 1, wherein the obtaining the initial memory management parameters of the heap memory instance based on the instance address and pointer location of the memory management instance in the heap memory instance comprises:
Acquiring an instance address and a pointer position of a memory management instance in the heap memory instance;
performing a first displacement operation according to the instance address and the pointer position to obtain an initial minimum memory threshold in the heap memory instance;
performing a second displacement operation according to the instance address and the pointer position to obtain an initial maximum memory threshold in the heap memory instance;
and setting the initial minimum memory threshold and the initial maximum memory threshold as initial memory management parameters of the heap memory instance.
5. The memory optimization method as set forth in claim 1, wherein said performing capacity expansion processing on said initial memory management parameter according to the device performance parameter to obtain a capacity-expanded memory management parameter includes:
acquiring equipment performance parameters corresponding to a target application, wherein the equipment performance parameters comprise equipment memory capacity and current performance indexes;
expanding the initial minimum memory threshold based on the initial maximum memory threshold and the equipment performance parameter to obtain an expanded minimum memory threshold;
expanding the initial maximum memory threshold according to the equipment memory capacity and the current performance index to obtain an expanded maximum memory threshold;
And setting the capacity expansion minimum memory threshold and the capacity expansion maximum memory threshold as capacity expansion memory management parameters of the target application.
6. The memory optimization method of claim 5, wherein the maximum expansion memory threshold comprises any one of a first maximum expansion memory threshold and a second maximum expansion memory threshold;
the expanding the initial maximum memory threshold according to the memory capacity of the device and the current performance index to obtain an expanded maximum memory threshold, including:
calculating a current capacity expansion score of the target application according to the equipment memory capacity and the current performance index;
if the current capacity expansion score is smaller than a preset capacity expansion threshold, expanding the initial maximum memory threshold according to a first capacity expansion multiple to obtain a first capacity expansion maximum memory threshold;
and if the current capacity expansion score is larger than a preset capacity expansion threshold, expanding the initial maximum memory threshold according to a second capacity expansion multiple to obtain a second capacity expansion maximum memory threshold, wherein the first capacity expansion multiple is smaller than the second capacity expansion multiple.
7. The memory optimization method according to claim 5 or 6, wherein the performing memory optimization processing on the target application based on the capacity-expansion memory management parameter further comprises:
Updating the initial memory recovery strategy of the target application according to the memory threshold with the minimum expansion and the memory threshold with the maximum expansion to obtain an updated memory recovery strategy;
and performing memory optimization processing on the target application based on the updated memory recycling strategy and the current application memory of the target application.
8. A memory optimization device, characterized in that the memory optimization device comprises:
the instance acquisition module is configured to respond to a memory adjustment event aiming at a target application and acquire a virtual machine running instance of the target application; the memory adjustment event is an application adjustment event for requesting to reduce the activity of garbage collection events of the target application;
the heap memory positioning module is configured to dynamically address and position the heap memory instance of the target application based on the running state address of the virtual machine running instance and a preset memory management instance;
the parameter acquisition module is configured to acquire initial memory management parameters of the heap memory instance according to the instance address and the pointer position of the memory management instance in the heap memory instance, wherein the initial memory management parameters comprise an initial minimum memory threshold value and an initial maximum memory threshold value;
And the memory expansion module is configured to perform expansion processing on the initial memory management parameters according to the equipment performance parameters to obtain expansion memory management parameters, and perform memory optimization processing on the target application based on the expansion memory management parameters.
9. A memory optimization device, the memory optimization device comprising:
one or more processors;
a memory; and
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the steps of the memory optimization method of any one of claims 1 to 7.
10. A computer readable storage medium, having stored thereon a computer program, the computer program being loaded by a processor to perform the steps of the memory optimization method of any one of claims 1 to 7.
CN202311658525.XA 2023-12-05 2023-12-05 Memory optimization method, device, equipment and storage medium Pending CN117632371A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311658525.XA CN117632371A (en) 2023-12-05 2023-12-05 Memory optimization method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311658525.XA CN117632371A (en) 2023-12-05 2023-12-05 Memory optimization method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117632371A true CN117632371A (en) 2024-03-01

Family

ID=90017973

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311658525.XA Pending CN117632371A (en) 2023-12-05 2023-12-05 Memory optimization method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117632371A (en)

Similar Documents

Publication Publication Date Title
JP3810738B2 (en) Adaptive pre-fetching of data on disk
CN107479951B (en) Process control method and device, storage medium and electronic equipment
US20120324481A1 (en) Adaptive termination and pre-launching policy for improving application startup time
EP1659496A1 (en) Garbage collection system
US8966212B2 (en) Memory management method, computer system and computer readable medium
CN117130768A (en) Frequency modulation relation table generation method and electronic equipment
CN117632371A (en) Memory optimization method, device, equipment and storage medium
CN116107731A (en) Distributed cluster load control method and device
CN110134454B (en) Method and device for starting application program
CN116700903A (en) Memory adjusting method, system, equipment and medium of cloud computing-oriented virtual machine
CN117130770A (en) Frequency modulation method and electronic equipment
CN113568746B (en) Load balancing method and device, electronic equipment and storage medium
CN112463626B (en) Memory leakage positioning method and device, computer equipment and storage medium
CN112732198B (en) File management method, device, equipment and storage medium
CN116467344A (en) Data processing method, apparatus, device, storage medium and computer program product
CN116244341A (en) Data caching method, device, equipment and storage medium
CN116594739B (en) Control method of virtual machine, computer equipment and storage medium
CN117119058B (en) Storage node optimization method in Ceph distributed storage cluster and related equipment
CN117806778B (en) Resource management method, system, equipment and medium
CN107562891A (en) Database operation method and device
CN114615716B (en) Call control method and device, storage medium and electronic equipment
CN118260149A (en) Disk abnormality risk early warning method and device and related equipment
CN117149613A (en) Use case grouping method, device, computer equipment and storage medium
CN115202707A (en) Business rule updating method, device, equipment and storage medium
CN113342618A (en) Distributed monitoring cluster management method, device and computer 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