CN108304268B - Memory optimization method, mobile terminal and computer readable storage medium - Google Patents
Memory optimization method, mobile terminal and computer readable storage medium Download PDFInfo
- Publication number
- CN108304268B CN108304268B CN201810109794.3A CN201810109794A CN108304268B CN 108304268 B CN108304268 B CN 108304268B CN 201810109794 A CN201810109794 A CN 201810109794A CN 108304268 B CN108304268 B CN 108304268B
- Authority
- CN
- China
- Prior art keywords
- constant region
- data block
- mobile terminal
- application
- sharable data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
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
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The invention discloses a memory optimization method, which comprises the following steps: acquiring a constant region sharable data index table and a sharable data block from a server at regular time; generating a sharing constant area and storing the sharable data block; when a system or an application is started, preferentially inquiring whether a sharable data block is available from the shared constant region; when the shared constant region has available sharable data blocks, the sharable data blocks are directly read from the shared constant region for use in the running process of the system or the application. The embodiment of the invention also discloses a mobile terminal and a computer readable storage medium. Therefore, the recovery and generation frequency of the constant region can be reduced, the occupation of the memory space is reduced, the use fluency of the system and the application is further improved, and the power consumption is reduced.
Description
Technical Field
The present invention relates to the field of memory optimization technologies, and in particular, to a memory optimization method, a mobile terminal, and a computer-readable storage medium.
Background
Applications in an android operating system are all realized by Java, and based on a JVM virtual machine, a memory management mechanism of the android operating system is used for generating corresponding memory areas including stacks, new generations, old generations, constant areas and the like when the system or each application is started. The constant area stores invariant data required in the program running process, such as constants, class names, method names and the like. After the constant region is generated each time, various types of data need to be written according to the operation of the program. And each time the system or application is closed, the virtual machine needs to recycle the data of the constant region. However, as the system or application is started and shut down, the constant region needs to be generated and recovered each time, the response speed is slow, and the system efficiency is low. Moreover, when the recovery and generation actions of the constant region are frequent, the constant region also has certain influence on the power consumption of the system. In addition, when the data of the constant region is large, the use of the memory space is affected.
Disclosure of Invention
The invention mainly aims to provide a memory optimization method, a mobile terminal and a computer readable storage medium, and aims to solve the problem of how to reduce the recovery and generation frequency of a constant region.
In order to achieve the above object, the present invention provides a memory optimization method applied to a mobile terminal, the method comprising:
acquiring a constant region sharable data index table and a sharable data block from a server at regular time;
generating a sharing constant region for storing the sharable data block;
when a system or an application is started, inquiring whether a sharable data block is available from the shared constant region; and
when the sharable data block is available in the shared constant region, the sharable data block is directly read from the shared constant region for use in the running process of the system or the application.
Optionally, the method further includes, before the step of obtaining the constant region sharable data index table and the sharable data block from the server at the timing, the step of:
collecting various constant area data blocks generated when a system or an application is started in the mobile terminal;
and reporting all the collected constant region data blocks to the server for statistics.
Optionally, the mobile terminal reports the constant area data block to the server in a json character string format, where the json character string format includes an application name and the content of the constant area data block.
Optionally, the index table records an application name and a memory location associated with the sharable data block.
Optionally, when the server recovers the memory, the mobile terminal reserves the data in the shared constant region not to be recovered.
Optionally, if the sharable data block is available in the shared constant region, the sharable data block is skipped when the system or the application starts to generate the constant region.
Optionally, the method further comprises the step of:
and when the sharable data block counted in the server changes, receiving a push notification sent by the server, and acquiring the updated index table and the sharable data block from the server again.
Optionally, in the step of querying whether there is an available sharable data block from the shared constant region, the data block included in the shared constant region, and the associated application name and memory location are queried through the index table, so as to determine whether there is the available sharable data block.
In addition, to achieve the above object, the present invention further provides a mobile terminal, including: the memory optimization method includes a memory, a processor and a memory optimization program stored on the memory and capable of running on the processor, wherein the memory optimization program realizes the steps of the memory optimization method when executed by the processor.
Further, to achieve the above object, the present invention also provides a computer readable storage medium, having a memory optimization program stored thereon, where the memory optimization program, when executed by a processor, implements the steps of the memory optimization method as described above.
The memory optimization method, the mobile terminal and the computer readable storage medium provided by the invention can be used for collecting and reporting data blocks in a constant region generated when a system or application is started by the mobile terminal, and the server is used for carrying out statistical analysis on the use conditions of the constant region of the memory of the system and each application according to the report of the mobile terminal, finding out a sharable data block, updating the sharable data block in real time and storing the sharable data block in the constant region of the mobile terminal. When the mobile terminal starts a system or an application, the usable sharable data blocks in the shared constant region are preferably searched to ensure the use of the program in the running process, so that the generation and recovery times of the data blocks in the memory constant region are reduced, the occupation of the memory space is reduced, the use fluency of the system and the application is further improved, and the power consumption of the mobile terminal is reduced.
Drawings
Fig. 1 is a schematic diagram of a hardware structure of a mobile terminal implementing various embodiments of the present invention;
FIG. 2 is a diagram of a wireless communication system for the mobile terminal shown in FIG. 1;
FIG. 3 is a diagram of an application environment architecture in which various embodiments of the present invention may be implemented;
fig. 4 is a flowchart of a memory optimization method according to a first embodiment of the present invention;
fig. 5 is a flowchart of a memory optimization method according to a second embodiment of the present invention;
fig. 6 is a block diagram of a mobile terminal according to a third embodiment of the present invention;
fig. 7 is a block diagram illustrating a memory optimization system according to a fourth embodiment of the present invention;
fig. 8 is a block diagram of a memory optimization system according to a fifth embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for facilitating the explanation of the present invention, and have no specific meaning in itself. Thus, "module", "component" or "unit" may be used mixedly.
The terminal may be implemented in various forms. For example, the terminal described in the present invention may include a mobile terminal such as a mobile phone, a tablet computer, a notebook computer, a palmtop computer, a Personal Digital Assistant (PDA), a Portable Media Player (PMP), a navigation device, a wearable device, a smart band, a pedometer, and the like, and a fixed terminal such as a Digital TV, a desktop computer, and the like.
The following description will be given by way of example of a mobile terminal, and it will be understood by those skilled in the art that the construction according to the embodiment of the present invention can be applied to a fixed type terminal, in addition to elements particularly used for mobile purposes.
Referring to fig. 1, which is a schematic diagram of a hardware structure of a mobile terminal for implementing various embodiments of the present invention, the mobile terminal 100 may include: RF (Radio Frequency) unit 101, wiFi module 102, audio output unit 103, a/V (audio/video) input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, processor 110, and power supply 111. Those skilled in the art will appreciate that the mobile terminal architecture shown in fig. 1 is not intended to be limiting of mobile terminals, and that a mobile terminal may include more or fewer components than shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile terminal in detail with reference to fig. 1:
the radio frequency unit 101 may be configured to receive and transmit signals during information transmission and reception or during a call, and specifically, receive downlink information of a base station and then process the downlink information to the processor 110; in addition, uplink data is transmitted to the base station. Typically, radio frequency unit 101 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. In addition, the radio frequency unit 101 can also communicate with a network and other devices through wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA2000 (Code Division Multiple Access 2000 ), WCDMA (Wideband Code Division Multiple Access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access), FDD-LTE (Frequency Division duplex Long Term Evolution), and TDD-LTE (Time Division duplex Long Term Evolution).
WiFi belongs to short-distance wireless transmission technology, and the mobile terminal can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 102, and provides wireless broadband internet access for the user. Although fig. 1 shows the WiFi module 102, it is understood that it does not belong to the essential constitution of the mobile terminal, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The audio output unit 103 may convert audio data received by the radio frequency unit 101 or the WiFi module 102 or stored in the memory 109 into an audio signal and output as sound when the mobile terminal 100 is in a call signal reception mode, a call mode, a recording mode, a voice recognition mode, a broadcast reception mode, or the like. Also, the audio output unit 103 may also provide audio output related to a specific function performed by the mobile terminal 100 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 103 may include a speaker, a buzzer, and the like.
The a/V input unit 104 is used to receive audio or video signals. The a/V input Unit 104 may include a Graphics Processing Unit (GPU) 1041 and a microphone 1042, and the Graphics processor 1041 processes image data of still pictures or video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display unit 106. The image frames processed by the graphic processor 1041 may be stored in the memory 109 (or other storage medium) or transmitted via the radio frequency unit 101 or the WiFi module 102. The microphone 1042 may receive sounds (audio data) via the microphone 1042 in a phone call mode, a recording mode, a voice recognition mode, or the like, and may be capable of processing such sounds into audio data. The processed audio (voice) data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 101 in case of a phone call mode. The microphone 1042 may implement various types of noise cancellation (or suppression) algorithms to cancel (or suppress) noise or interference generated in the course of receiving and transmitting audio signals.
The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor that can adjust the brightness of the display panel 1061 according to the brightness of ambient light, and a proximity sensor that can turn off the display panel 1061 and/or a backlight when the mobile terminal 100 is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the gesture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
The display unit 106 is used to display information input by a user or information provided to the user. The Display unit 106 may include a Display panel 1061, and the Display panel 1061 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
The user input unit 107 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the mobile terminal. Specifically, the user input unit 107 may include a touch panel 1071 and other input devices 1072. The touch panel 1071, also referred to as a touch screen, may collect a touch operation performed by a user on or near the touch panel 1071 (e.g., an operation performed by the user on or near the touch panel 1071 using a finger, a stylus, or any other suitable object or accessory), and drive a corresponding connection device according to a predetermined program. The touch panel 1071 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 110, and can receive and execute commands sent by the processor 110. In addition, the touch panel 1071 may be implemented in various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch panel 1071, the user input unit 107 may include other input devices 1072. In particular, other input devices 1072 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like, without limitation.
Further, the touch panel 1071 may cover the display panel 1061, and when the touch panel 1071 detects a touch operation on or near the touch panel, the touch panel is transmitted to the processor 110 to determine the type of the touch event, and then the processor 110 provides a corresponding visual output on the display panel 1061 according to the type of the touch event. Although in fig. 1, the touch panel 1071 and the display panel 1061 are two independent components to implement the input and output functions of the mobile terminal, in some embodiments, the touch panel 1071 and the display panel 1061 may be integrated to implement the input and output functions of the mobile terminal, which is not limited herein.
The interface unit 108 serves as an interface through which at least one external device is connected to the mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 108 may be used to receive input (e.g., data information, power, etc.) from external devices and transmit the received input to one or more elements within the mobile terminal 100 or may be used to transmit data between the mobile terminal 100 and external devices.
The memory 109 may be used to store software programs as well as various data. The memory 109 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 required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, memory 109 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.
The processor 110 is a control center of the mobile terminal, connects various parts of the entire mobile terminal using various interfaces and lines, and performs various functions of the mobile terminal and processes data by operating or executing software programs and/or modules stored in the memory 109 and calling data stored in the memory 109, thereby performing overall monitoring of the mobile terminal. Processor 110 may include one or more processing units; preferably, the processor 110 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 110.
The mobile terminal 100 may further include a power supply 111 (e.g., a battery) for supplying power to various components, and preferably, the power supply 111 may be logically connected to the processor 110 via a power management system, so as to manage charging, discharging, and power consumption management functions via the power management system.
Although not shown in fig. 1, the mobile terminal 100 may further include a bluetooth module or the like, which is not described in detail herein.
In order to facilitate understanding of the embodiments of the present invention, a communication network system on which the mobile terminal of the present invention is based is described below.
Referring to fig. 2, fig. 2 is an architecture diagram of a communication Network system according to an embodiment of the present invention, the communication Network system is an LTE system of a universal mobile telecommunications technology, and the LTE system includes a UE (User Equipment) 201, an e-UTRAN (Evolved UMTS Terrestrial Radio Access Network) 202, an epc (Evolved Packet Core) 203, and an IP service 204 of an operator, which are in communication connection in sequence.
Specifically, the UE201 may be the terminal 100 described above, and is not described herein again.
The E-UTRAN202 includes eNodeB2021 and other eNodeBs 2022, among others. The eNodeB2021 may be connected with other eNodeB2022 via backhaul (e.g., X2 interface), the eNodeB2021 is connected to the EPC203, and the eNodeB2021 may provide the UE201 with access to the EPC 203.
The EPC203 may include an MME (Mobility Management Entity) 2031, an hss (Home Subscriber Server) 2032, other MMEs 2033, an SGW (Serving gateway) 2034, a pgw (PDN gateway) 2035, and a PCRF (Policy and Charging Rules Function) 2036, and the like. The MME2031 is a control node that handles signaling between the UE201 and the EPC203, and provides bearer and connection management. HSS2032 is used to provide registers to manage functions such as home location register (not shown) and holds subscriber specific information about service characteristics, data rates, etc. All user data may be sent through SGW2034, PGW2035 may provide IP address assignment for UE201 and other functions, and PCRF2036 is a policy and charging control policy decision point for traffic data flow and IP bearer resources, which selects and provides available policy and charging control decisions for a policy and charging enforcement function (not shown).
Although the LTE system is described as an example, it should be understood by those skilled in the art that the present invention is not limited to the LTE system, but may also be applied to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA, and future new network systems.
Referring to fig. 3, fig. 3 is a diagram illustrating an application environment architecture for implementing various embodiments of the present invention. The present invention is applicable in an application environment including, but not limited to, a server 2, a mobile terminal 4, and a network 6.
In this embodiment, the server 2 is a JVM virtual machine. The mobile terminal 4 may be a mobile device such as a mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a navigation device, a car-mounted device, and the like.
The network 6 may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, bluetooth (Bluetooth), and Wi-Fi. The server 2 is respectively connected with one or more mobile terminals 4 through the network 6 in a communication way so as to carry out data transmission and interaction.
Based on the above mobile terminal hardware structure, communication network system, and application environment architecture, various embodiments of the present invention are proposed.
The memory optimization method provided by the invention is used for generating the shared constant region in the mobile terminal, storing the sharable data block for use after the system or the application is started, reducing the generation and recovery times of the data in the memory constant region, and reducing the occupation of the memory space, thereby improving the use fluency of the system and the application and reducing the power consumption of the mobile terminal.
Example one
As shown in fig. 4, a first embodiment of the present invention provides a memory optimization method, which includes the following steps:
s400, the constant region sharable data index table and the sharable data block are obtained from the server 2 at regular time.
Specifically, the server 2 may collect various constant region data blocks generated by the mobile terminal 4 when the system or the application is started, perform statistical analysis on the collected constant region data blocks, and find the constant region data blocks that can be collected for common use by the system and a plurality of applications, that is, the sharable data blocks. For example, in the constant region data blocks corresponding to the system, the application a, the application B, the application C, and the application D, the content of one data block is 23BC, which is used by the system, the application a, and the application C, and then this data block 23BC can be used as a sharable data block for the system, the application a, and the application C to use together. According to the analyzed sharable data block and the corresponding application (or system) when the sharable data block is collected, a constant area sharable data index table is generated in the server 2 at the same time, and each entry in the index table records the related information of one sharable data block, including the application name and the memory location associated with the sharable data block. When the sharable data block is associated with a system, recording the application name as the system. The mobile terminal 4 calls an interface regularly to obtain the index table and the sharable data block from the server 2 for subsequent use.
As the server 2 collects and statistically analyzes the constant region data blocks of the mobile terminal 4, the sharable data blocks may change, such as increase or decrease. When the sharable data block counted in the server 2 changes, the index table is updated, and the mobile terminal 4 is timely prompted by a push notification mechanism that the index table and the sharable data block are updated. After receiving the push notification sent by the server 2, the mobile terminal 4 may obtain the updated index table and the sharable data block from the server 2 again, so as to ensure that the sharable data block in the mobile terminal 4 is the latest.
S402, generating a sharing constant area and storing the sharable data block.
Specifically, a shared constant region is generated in the system memory of the mobile terminal 4. After the mobile terminal 4 obtains the sharable data block from the server 2, the sharable data block may be stored in the sharing constant region. When the server 2 recovers the memory, the mobile terminal 4 reserves the data of the shared constant region, so that the data is not recovered, thereby ensuring the availability of the shared constant region.
S404, when the system or the application starts, inquiring whether the sharable data block is available from the sharing constant region.
Specifically, when the system or application of the mobile terminal 4 is started and a constant region is generated, it is preferred to perform an inquiry from the shared constant region to determine whether there is an available sharable data block. If an available sharable data block is found, that is, the data block to be generated already exists in the shared constant region, the data block can be skipped when the constant region of the system or the application is generated, so that repeated generation is avoided, and the data block can be directly obtained from the shared constant region when the data block is required to be used subsequently. In this embodiment, the data blocks included in the shared constant region and the associated application names and memory locations may be queried through the index table, so as to quickly determine whether there is an available sharable data block.
S406, when the shared constant region has available sharable data blocks, directly reading the sharable data blocks from the shared constant region for use in the running process of the system or the application.
Specifically, since the sharable data block is skipped when the constant region of the system or application is generated, the sharable data block can be directly read from the shared constant region for use when needed during the running process of the system or application. For example, the sharable data block 23BC does not need to be generated each time the system, the application a or the application C is started, and when the data block needs to be used in the running process of the system, the application a or the application C, the data block in the shared constant region is directly read, so that the generation and recovery times of the data block are greatly reduced.
The memory optimization method provided in this embodiment may perform statistical analysis on the system and the use conditions of the memory constant region of each application by combining the mobile terminal 4 and the server 2, find a sharable data block, perform real-time update, and then store the sharable data block in the shared constant region of the mobile terminal 4. When the mobile terminal 4 starts a system or an application, the available sharable data blocks in the shared constant region are preferentially searched to ensure the use of the program in the running process, so that the generation and recovery times of the data blocks in the memory constant region are reduced, the occupation of the memory space is reduced, the use fluency of the system and the application is further improved, and the power consumption of the mobile terminal 4 is reduced.
Example two
As shown in fig. 5, a second embodiment of the invention provides a memory optimization method. In the second embodiment, steps S504 to S510 of the memory optimization method are similar to steps S400 to S406 of the first embodiment, except that the method further includes steps S500 to S502.
The method comprises the following steps:
s500, collecting various constant region data blocks generated when the system or the application is started in the mobile terminal 4.
Specifically, when the system or each application of the mobile terminal 4 is started, a corresponding constant region needs to be generated in the memory. The mobile terminal 4 may collect data blocks in each constant region, and the corresponding relationship between each constant region and the data block therein and the system or application.
And S502, reporting all the collected constant region data blocks to the server 2 for statistics.
Specifically, after the mobile terminal 4 collects the constant region data blocks generated by the system and each application when starting, all the collected constant region data blocks are reported to the server 2 at regular time. In this embodiment, the reporting format is a json string, which includes an application name and a constant area data block content, for example, { application name: XXX, constant area data block content: XXX }. And if the constant area data block is generated when the system is started, recording the application name as the system.
After receiving the various constant region data blocks reported by the mobile terminal 4, the server 2 performs statistical analysis on the constant region data blocks to find constant region data blocks which can be collected together for common use by a system and a plurality of applications, that is, data blocks can be shared. For example, in the constant region data blocks corresponding to the system, the application a, the application B, the application C, and the application D, the content of one data block is 23BC, which is used by the system, the application a, and the application C, and then this data block 23BC can be used as a sharable data block for the system, the application a, and the application C to use together. And simultaneously generating a constant region sharable data index table in the server 2, and recording the application name and the memory position associated with the counted sharable data block. When the sharable data block is associated with a system, recording the application name as the system.
S504, the constant region sharable data index table and the sharable data block are obtained from the server 2 at regular time.
Specifically, the mobile terminal 4 calls an interface at regular time to obtain the index table and the sharable data block from the server 2 for subsequent use.
With the reporting of the constant region data blocks by the mobile terminal 4 and the statistical analysis of the server 2, the sharable data blocks may change, for example, increase or decrease. When the sharable data blocks counted in the server 2 change, the index table is updated, and the mobile terminal 4 is prompted to update the index table and the sharable data blocks in time through a push notification mechanism. After receiving the push notification sent by the server 2, the mobile terminal 4 may obtain the updated index table and the sharable data block from the server 2 again, so as to ensure that the sharable data block in the mobile terminal 4 is the latest.
And S506, generating a shared constant area and storing the sharable data block.
Specifically, a shared constant region is generated in the system memory of the mobile terminal 4. After the mobile terminal 4 obtains the sharable data block from the server 2, the sharable data block may be stored in the sharing constant region. When the server 2 recovers the memory, the mobile terminal 4 retains the data of the shared constant region, so that the data is not recovered, thereby ensuring the availability of the shared constant region.
S508, when the system or the application starts, whether the sharable data blocks are available is inquired from the sharing constant region.
Specifically, when the system or application of the mobile terminal 4 is started and a constant region is generated, it is preferred to perform an inquiry from the shared constant region to determine whether there is an available sharable data block. If the available sharable data block is found, that is, the data block to be generated already exists in the shared constant region, the data block can be skipped when the constant region of the system or the application is generated, so that repeated generation is avoided, and the data block can be directly obtained from the shared constant region when the data block is required to be used subsequently. In this embodiment, the data blocks included in the shared constant region, the associated application names, and the memory locations may be queried through the index table, so as to quickly determine whether there is an available sharable data block.
And S510, when available sharable data blocks exist in the shared constant region, directly reading the sharable data blocks from the shared constant region for use in the running process of the system or the application.
Specifically, since the sharable data block is skipped when the constant region of the system or application is generated, the sharable data block can be directly read from the shared constant region for use when needed during the running process of the system or application. For example, the sharable data block 23BC does not need to be generated each time the system, the application a or the application C is started, and when the data block needs to be used in the running process of the system, the application a or the application C, the data block in the shared constant region is directly read, so that the generation and recovery times of the data block are greatly reduced.
In the memory optimization method provided in this embodiment, the mobile terminal 4 may collect and report the data blocks in the constant region generated when the system or the application is started, and the server 2 performs statistical analysis on the usage conditions of the constant region of the memory of the system and each application according to the report of the mobile terminal 4 to find the sharable data blocks, updates the sharable data blocks in real time, and then stores the sharable data blocks in the constant region of the mobile terminal 4. When the mobile terminal 4 starts a system or an application, the available sharable data blocks in the shared constant region are preferentially searched to ensure the use of the program in the running process, so that the generation and recovery times of the data blocks in the memory constant region are reduced, the occupation of the memory space is reduced, the use fluency of the system and the application is further improved, and the power consumption of the mobile terminal 4 is reduced.
The invention further provides a mobile terminal comprising a memory, a processor and a memory optimization system. The memory optimization system is used for generating a shared constant region in the mobile terminal and storing the sharable data blocks for use after the system or the application is started, so that the generation and recovery times of data in the memory constant region are reduced, the occupation of memory space is reduced, the use fluency of the system and the application is improved, and the power consumption of the mobile terminal is reduced.
EXAMPLE III
As shown in fig. 6, a third embodiment of the present invention provides a mobile terminal 4. The mobile terminal 4 includes a memory 20, a processor 22, and a memory optimization system 28.
The memory 20 includes at least one type of readable storage medium for storing an operating system and various types of application software installed in the mobile terminal 4, such as program codes of the memory optimization system 28. In addition, the memory 20 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 22 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 22 is typically operative to control overall operation of the mobile terminal 4. In this embodiment, the processor 22 is configured to execute the program codes stored in the storage 20 or process data, for example, execute the memory optimization system 28.
Example four
Referring to fig. 7, a fourth embodiment of the invention provides a memory optimization system 28. In this embodiment, the memory optimization system 28 includes:
an obtaining module 800, configured to obtain the constant region sharable data index table and the sharable data block from the server 2 at regular time.
Specifically, the server 2 may collect various constant region data blocks generated by the mobile terminal 4 when the system or the application is started, perform statistical analysis on the collected constant region data blocks, and find the constant region data blocks that can be collected for common use by the system and a plurality of applications, that is, the sharable data blocks. For example, in the constant region data blocks corresponding to the system, the application a, the application B, the application C, and the application D, the content of one data block is 23BC, which is used by the system, the application a, and the application C, and then this data block 23BC can be used as a sharable data block for the system, the application a, and the application C to use together. And simultaneously generating a constant region sharable data index table in the server 2, and recording the application name and the memory position associated with the counted sharable data block. When the sharable data block is associated with a system, recording the application name as the system. The obtaining module 800 calls an interface periodically to obtain the index table and the sharable data block from the server 2 for subsequent use.
As the server 2 collects and statistically analyzes the constant region data blocks of the mobile terminal 4, the sharable data blocks may change, such as increase or decrease. When the sharable data blocks counted in the server 2 change, the index table is updated, and the mobile terminal 4 is prompted to update the index table and the sharable data blocks in time through a push notification mechanism. After the mobile terminal 4 receives the push notification sent by the server 2, the obtaining module 800 may obtain the updated index table and the sharable data block from the server 2 again, so as to ensure that the sharable data block in the mobile terminal 4 is the latest.
A generating module 802, configured to generate a shared constant region, and store the sharable data block.
Specifically, the generating module 802 generates a shared constant region in the system memory of the mobile terminal 4. After the sharable data block is obtained from the server 2, the sharable data block may be stored in the shared constant region. When the server 2 recovers the memory, the mobile terminal 4 reserves the data of the shared constant region, so that the data is not recovered, thereby ensuring the availability of the shared constant region.
And the query module 804 is used for querying whether the sharable data blocks are available from the shared constant region when the system or the application is started.
Specifically, when the system or the application of the mobile terminal 4 is started and a constant area is generated, the query module 804 preferentially queries from the shared constant area to determine whether there is an available sharable data block. If an available sharable data block is found, that is, the data block to be generated already exists in the shared constant region, the data block can be skipped when the constant region of the system or the application is generated, so that repeated generation is avoided, and the data block can be directly obtained from the shared constant region when the data block is required to be used subsequently. In this embodiment, the query module 804 may query the data blocks included in the shared constant region, the associated application names, and the memory locations through the index table, so as to quickly determine whether there are available sharable data blocks.
A reading module 806, configured to, when there is an available sharable data block in the shared constant region, directly read the sharable data block from the shared constant region for use in a running process of the system or the application.
Specifically, since the sharable data block is skipped when the constant region of the system or application is generated, the reading module 806 can directly read from the shared constant region and use the shared data block when the sharable data block is needed during the running process of the system or application. For example, the sharable data block 23BC does not need to be generated each time the system, the application a or the application C is started, and when the data block needs to be used in the running process of the system, the application a or the application C, the data block in the shared constant region is directly read, so that the generation and recovery times of the data block are greatly reduced.
EXAMPLE five
Referring to fig. 8, a fifth embodiment of the invention provides a memory optimization system 28. In this embodiment, the memory optimization system 28 includes a collection module 808 and a reporting module 810 in addition to the obtaining module 800, the generating module 802, the querying module 804 and the reading module 806 in the fifth embodiment.
The collecting module 808 is configured to collect various constant region data blocks generated when a system or an application is started in the mobile terminal 4.
Specifically, when the system or each application of the mobile terminal 4 is started, a corresponding constant region needs to be generated in the memory. The collection module 808 may collect the data blocks in the constant regions, and the corresponding relationship between each constant region and the data block therein and the system or application.
The reporting module 810 is configured to report all the collected constant region data blocks to the server 2 for statistics.
Specifically, after the collecting module 808 collects the constant region data blocks generated by the system and each application at start, the reporting module 810 reports all the collected constant region data blocks to the server 2 at regular time. In this embodiment, the reporting format is a json string, which includes an application name and a constant area data block content, for example, { application name: XXX, constant area data block content: XXX }. And if the constant area data block is generated when the system is started, recording the application name as the system.
Example six
The present invention also provides another embodiment, which is to provide a computer-readable storage medium storing a memory optimization program, where the memory optimization program is executable by at least one processor to cause the at least one processor to execute the steps of the memory optimization method as described above.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention or portions thereof contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the methods according to the embodiments of the present invention.
While the present invention has been described with reference to the particular illustrative embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, but is intended to cover various modifications, equivalent arrangements, and equivalents thereof, which may be made by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.
Claims (7)
1. A memory optimization method is applied to a mobile terminal, and is characterized by comprising the following steps:
collecting various constant region data blocks generated when a system or application is started in the mobile terminal;
reporting all collected constant region data blocks to a server for statistics so that the server can generate a constant region sharable data index table, wherein each entry in the constant region sharable data index table records an application name and a memory location associated with one sharable data block, and when the sharable data blocks are associated with a system, the application name is recorded as the system;
acquiring a constant region sharable data index table and a sharable data block from a server at regular time;
generating a shared constant area for storing the sharable data block, and when the server recovers the memory, the mobile terminal keeps the data in the shared constant area not to be recovered;
when a system or an application is started, inquiring whether a sharable data block is available from the shared constant region; and
when the sharable data block is available in the shared constant region, the sharable data block is directly read from the shared constant region for use in the running process of the system or the application.
2. The memory optimization method according to claim 1, wherein the mobile terminal reports the constant area data block to the server in a json string format, and the json string includes an application name and the content of the constant area data block.
3. The memory optimization method of claim 1, wherein if the sharable data block is available in the shared constant region, the sharable data block is skipped when the system or application starts generating the constant region.
4. The memory optimization method of claim 1, further comprising:
and when the sharable data block counted in the server changes, receiving a push notification sent by the server, and acquiring the updated index table and the sharable data block from the server again.
5. The method according to claim 1, wherein in the step of querying whether there is an available sharable data block from the shared constant region, the index table is used to query the data block included in the shared constant region and the associated application name and memory location, so as to determine whether there is the available sharable data block.
6. A mobile terminal, characterized in that the mobile terminal comprises: memory, a processor and a memory optimization program stored on the memory and executable on the processor, the memory optimization program when executed by the processor implementing the steps of the memory optimization method according to any one of claims 1 to 5.
7. A computer-readable storage medium, having a memory optimization program stored thereon, which, when executed by a processor, implements the steps of the memory optimization method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810109794.3A CN108304268B (en) | 2018-02-05 | 2018-02-05 | Memory optimization method, mobile terminal and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810109794.3A CN108304268B (en) | 2018-02-05 | 2018-02-05 | Memory optimization method, mobile terminal and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108304268A CN108304268A (en) | 2018-07-20 |
CN108304268B true CN108304268B (en) | 2022-10-04 |
Family
ID=62850957
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810109794.3A Active CN108304268B (en) | 2018-02-05 | 2018-02-05 | Memory optimization method, mobile terminal and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108304268B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117573397B (en) * | 2024-01-15 | 2024-04-19 | 北京趋动智能科技有限公司 | Memory optimization method, system and storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005149164A (en) * | 2003-11-17 | 2005-06-09 | Hitachi Ltd | Method for calling external disclosure function stored in shared library |
CN103166827A (en) * | 2011-12-09 | 2013-06-19 | 北京神州泰岳软件股份有限公司 | Method and system for user behavior data reporting |
CN104808968B (en) * | 2014-01-23 | 2019-04-30 | 腾讯科技(北京)有限公司 | Storage, report method and the device and system of global data |
-
2018
- 2018-02-05 CN CN201810109794.3A patent/CN108304268B/en active Active
Non-Patent Citations (1)
Title |
---|
基于分布式构件服务器性能的内存消耗技术;雷超阳等;《计算机与现代化》;20081215(第12期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN108304268A (en) | 2018-07-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107967322B (en) | File classification display method, mobile terminal and computer readable storage medium | |
CN107038245B (en) | Page switching method, mobile terminal and storage medium | |
CN107562705B (en) | Data export method, server and computer readable storage medium | |
CN108011937B (en) | Message pushing method, server, intelligent terminal and computer readable storage medium | |
CN108282405B (en) | Application program interface cache management method, application server and storage medium | |
CN107317855B (en) | Data caching method, data requesting method and server | |
CN107124466B (en) | Method and device for preventing cache from penetrating and computer readable storage medium | |
CN109151216B (en) | Application starting method, mobile terminal, server and computer readable storage medium | |
CN112597115A (en) | Container mirror image compression method and device, terminal equipment and medium | |
CN107480054B (en) | Call chain data processing method and device and computer readable storage medium | |
CN109445945B (en) | Memory allocation method of application program, mobile terminal, server and storage medium | |
CN108040116B (en) | Message pushing method, router and computer readable storage medium | |
CN107688497B (en) | Memory regulation and control method, equipment and computer readable storage medium | |
CN111970738A (en) | Network switching control method, equipment and computer readable storage medium | |
CN109062688B (en) | Memory allocation method, server and mobile terminal | |
CN107992564B (en) | Login verification processing method, mobile terminal and computer readable storage medium | |
CN108304268B (en) | Memory optimization method, mobile terminal and computer readable storage medium | |
CN107766544B (en) | Information management method, terminal and computer readable storage medium | |
CN108183833B (en) | Response processing method and device and computer readable storage medium | |
CN107404568B (en) | Control switch management method and mobile terminal | |
CN108196938B (en) | Memory calling method, mobile terminal and computer readable storage medium | |
CN109379719B (en) | Application program broadcast processing method and device and computer readable storage medium | |
CN108304302B (en) | Interface merging method, equipment and computer readable storage medium | |
CN108037959B (en) | Intelligent interface merging method, mobile terminal and computer readable storage medium | |
CN113079528A (en) | Network exception handling method and 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 | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20220909 Address after: 201913 room 2866, building 11, Lane 1333, Jiangnan Avenue, Changxing Town, Chongming District, Shanghai (Lingang Changxing science and Technology Park) Applicant after: Bingyun (Shanghai) Intelligent Technology Co.,Ltd. Address before: 518000 6-8 / F, 10-11 / F, 6 / F, 6-10 / F, C zone, Han's innovation building, No. 9018, Beihuan Avenue, high tech Zone, Nanshan District, Shenzhen City, Guangdong Province Applicant before: NUBIA TECHNOLOGY Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |