CN111124941A - Memory fragment cleaning method, electronic equipment and device with storage function - Google Patents

Memory fragment cleaning method, electronic equipment and device with storage function Download PDF

Info

Publication number
CN111124941A
CN111124941A CN201811297424.3A CN201811297424A CN111124941A CN 111124941 A CN111124941 A CN 111124941A CN 201811297424 A CN201811297424 A CN 201811297424A CN 111124941 A CN111124941 A CN 111124941A
Authority
CN
China
Prior art keywords
memory
preset
data
intelligent terminal
space
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.)
Withdrawn
Application number
CN201811297424.3A
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.)
Qiku Internet Technology Shenzhen Co Ltd
Original Assignee
Qiku Internet Technology Shenzhen 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 Qiku Internet Technology Shenzhen Co Ltd filed Critical Qiku Internet Technology Shenzhen Co Ltd
Priority to CN201811297424.3A priority Critical patent/CN111124941A/en
Publication of CN111124941A publication Critical patent/CN111124941A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a memory fragment cleaning method, electronic equipment and a device with a storage function. The method comprises the following steps: the intelligent terminal judges whether the number of the large blocks of continuous free memories in the system is lower than a preset number or not; if the number of the large blocks of continuous free memories is lower than the preset number, informing a system or an operator to carry out memory fragment processing; the large continuous free memory is a continuously allocatable memory address space with a continuously available memory space larger than a preset memory space. Through the mode, the memory can be cleaned in time, and a large number of memory fragments are avoided.

Description

Memory fragment cleaning method, electronic equipment and device with storage function
Technical Field
The present disclosure relates to the field of intelligent terminals, and in particular, to a method for clearing memory fragments, an electronic device, and a device with a storage function.
Background
The memory is an important component in a computer system, realizes the storage function of data, and can store original data, intermediate data, operation results and the like. Memory is also a cache unit between the high-speed execution unit and the external low-speed storage unit. After a computer or an intelligent terminal and other intelligent terminals work for a period of time, memory fragments (a plurality of small idle memory blocks) generally occur, and if a large number of memory fragments occur, some software function modules may not run.
Disclosure of Invention
The technical problem mainly solved by the application is to provide a memory fragment cleaning method, an electronic device and a device with a storage function, which can clean a memory in time and avoid a large amount of memory fragments.
In order to solve the technical problem, the application adopts a technical scheme that: a memory fragmentation cleaning method is provided, which comprises the following steps: the intelligent terminal judges whether the number of the large blocks of continuous free memories in the system is lower than a preset number or not; if the number of the large blocks of continuous free memories is lower than the preset number, informing a system or an operator to carry out memory fragment processing; the large continuous free memory is a continuously allocatable memory address space with a continuously available memory space larger than a preset memory space.
In order to solve the above technical problem, another technical solution adopted by the present application is: provided is an electronic device including: a memory circuit and a processor connected to each other; the storage circuit is used for storing data; the processor is used for executing the instructions to realize the memory fragmentation cleaning method.
In order to solve the above technical problem, the present application adopts another technical solution: there is provided an apparatus having a storage function, in which a program is stored, the program being executed to implement the memory fragmentation cleaning method as described above.
The beneficial effect of this application is: different from the prior art, in the embodiment of the application, the intelligent terminal judges whether the number of the large continuous free memories in the system is lower than the preset number, and when the number of the large continuous free memories is lower than the preset number, the intelligent terminal informs the system or the operator to process the memory fragments, so that when the number of the large continuous free memories is less, the memories can be cleaned in time, the memory fragments are reduced, the available memory space is more, and the condition that the software function module cannot run due to insufficient memories is reduced.
Drawings
Fig. 1 is a schematic flowchart of a memory fragmentation cleaning method according to a first embodiment of the present application;
fig. 2 is a schematic flowchart of a memory fragmentation cleaning method according to a second embodiment of the present application;
FIG. 3 is a diagram illustrating the available memory of a Node0 Node in a buddy yinfo file;
fig. 4 is a schematic flowchart of a memory fragmentation cleaning method according to a third embodiment of the present application;
FIG. 5 is a diagram illustrating a scenario in which the system automatically stores memory data into the SD card;
fig. 6 is a schematic flow chart illustrating a memory fragmentation cleaning method according to a fourth embodiment of the present application;
fig. 7 is a schematic view of an interaction scenario between an intelligent terminal a, a service operator B and a cloud C;
fig. 8 is a schematic flowchart of a fifth embodiment of a memory fragmentation cleaning method according to the present application;
fig. 9 is a detailed flowchart of step S14 in fig. 8;
FIG. 10 is a schematic diagram of an interaction scenario between a smart terminal A and a background server D;
fig. 11 is a schematic flowchart of a memory fragmentation cleaning method according to a sixth embodiment of the present application;
fig. 12 is a schematic flowchart of a memory fragmentation cleaning method according to a seventh embodiment of the present application;
FIG. 13 is a schematic structural diagram of an embodiment of an electronic device of the present application;
FIG. 14 is a schematic structural diagram of an embodiment of the apparatus with storage function according to the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a memory fragmentation cleaning method according to a first embodiment of the present application. As shown in fig. 1, the memory fragmentation cleaning method of this embodiment may be applied to terminal devices such as an intelligent terminal and a server, and the memory fragmentation cleaning method includes:
s11: the intelligent terminal judges whether the quantity of the large blocks of continuous free memories in the system is lower than a preset quantity.
The large continuous free memory is a continuously allocatable memory address space with a continuously available memory space larger than a preset memory space. The preset memory space is a preset minimum threshold value of the large memory space, and a specific value of the preset memory space may be set according to a user requirement, for example, set to be 128KB or 512 KB.
The preset number is a preset threshold value used for triggering memory cleaning. The specific value of the preset number may be a numerical value preset by a user, for example, 5, 8, or 10.
Specifically, in an application example, the intelligent terminal may periodically detect a memory allocation condition of the system, analyze the number of available continuous memory blocks in the system from the memory allocation condition, record the number of continuous large-block idle memories that are greater than a preset memory space (e.g., greater than 128KB) in the number of available continuous memory blocks, compare the recorded number (e.g., 4) with a preset number (e.g., 5), and if the recorded number is less than the preset number (e.g., 4<5), determine that the number of large-block continuous idle memories is less than the preset number, execute the following step S12.
S12: and informing a system or an operator to process the memory fragments.
Specifically, when the system detects that the number of the large blocks of continuous free memory is lower than the preset number, that is, the large blocks of continuous free memory are insufficient, the detection module of the system notifies the memory processing module of the system to perform memory fragmentation cleaning. Or, the system may notify an operator (e.g., a service operator), and the operator controls the system of the intelligent terminal to perform the memory fragmentation cleaning.
Alternatively, when the number of the large blocks of continuous free memory is not lower than the preset number, the following step S13 may be performed.
S13: waits for a preset period and then returns to perform step S11.
The preset period is a preset time interval between two adjacent times of judging whether the quantity of the large continuous idle memories is insufficient, and the specific value can be preset by a user or automatically set by a system in a default mode.
Specifically, the intelligent terminal periodically detects the allocation condition of the system memory, after step S11 is executed each time, that is, after it is determined whether the number of the large blocks of continuous free memory in the system is lower than the preset number, the intelligent terminal may perform step S11 at an interval of time (for example, 30 minutes), that is, after waiting for a preset period, and return to the repeated execution step S11, so that when the number of the large blocks of continuous free memory is small, the memory can be cleared in time, memory fragments are reduced, the available memory space is increased, and the situation that the software function module cannot run due to insufficient memory is reduced.
Certainly, in other embodiments, the intelligent terminal may also perform memory allocation condition detection at some preset time points, for example, when some applications are started, or when a large block of continuous idle memory is insufficient after some applications are used for a period of time, the detection is performed, so that memory fragmentation can be timely cleaned.
In some operating systems of intelligent terminals, such as Linux systems, a file for recording the condition of system memory resources exists, and the condition of the current continuous free memory space of the system can be obtained by accessing the file.
Specifically, as shown in fig. 2, the second embodiment of the memory fragmentation cleaning method of the present application is further defined in that, on the basis of the first embodiment of the memory fragmentation cleaning method of the present application, step S11 includes:
s111: and acquiring a memory resource allocation situation file of the system.
The memory resource allocation situation file is a file which is provided by the system and records the memory situation of the system.
Specifically, in an application example, after the intelligent terminal obtains a memory resource allocation status file of the system, for example, a/proc/buddy yin file, the memory resource allocation status of the system may be obtained from the file. The/proc/buddyinfo file is debug information of the linux system for managing the physical memory.
S112: and reading the value of a preset node in the memory resource allocation condition file, wherein the preset node stores the quantity of the continuous large blocks of free memory.
In the above application example, in the Linux system used by the intelligent terminal, the node is generally composed of a group of CPUs and local memories, each node has a corresponding local memory, and the buddy info file records the ID of each node, the memory area, and the free memory condition corresponding to each memory area. The memory device under each node may be divided into a plurality of memory areas (zones).
In the Linux kernel, a buddy algorithm is used to divide all the free memories into 11 block linked lists in a form of power of 2, wherein the 11 block linked lists correspond to 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 and 1024 page blocks respectively. The PAGE block PAGE _ SIZE is the minimum memory unit managed by the buddy algorithm, and is generally 4K in SIZE, and increases once to the nth power of 2.
Specifically, as shown in fig. 3, Node0 in the buddy info file indicates that the Node ID is 0, and as for the memory of Node0, the memory is further divided into three areas, i.e., DMA, Normal, and HighMem, each area occupies one row, each column corresponds to one block chain table, and the number in each row in each column respectively indicates the number of idle page blocks in the block chain table corresponding to the area and corresponding to the power. For example, in FIG. 3, in the Normal zone, numeral 149 in the first column indicates that 149 2^0 PAGE _ SIZE can be allocated.
When the system needs to obtain the number of continuous large blocks of free memory, for example, when obtaining the continuous free memory not less than 128KB, the system can obtain the values of the 6 th column (2^5 × 4KB ═ 128KB) and the following columns (7 th to 11 th columns) of each region in the preset Node (Node 0), and add the values of each region, so as to obtain the number of continuous large blocks of free memory in the system.
S113: and judging whether the value of the preset node is less than the preset number.
The preset number is a preset threshold value and is used for triggering memory cleaning. The specific value of the preset number may be a value preset by a user, for example, 15, 50, or 20.
If the value of the preset node is smaller than the preset number, the following step S114 is performed, otherwise, the step S115 is performed.
S114: and judging that the quantity of the large blocks of continuous free memories in the system is lower than the preset quantity.
S115: and judging that the quantity of the large blocks of continuous free memories in the system is not lower than the preset quantity.
Specifically, in the application example, as shown in fig. 3, the sum of the numerical values of the 6 th to 11 th columns of the three areas of the DMA, the Normal, and the HighMem in the preset Node0 is obtained, so as to obtain the number of the large continuous free memories in the system, and when the number of the large continuous free memories in the system is lower than the preset number (for example, lower than 50), the memory fragmentation cleaning is triggered, otherwise, the memory fragmentation cleaning is not triggered.
When the intelligent terminal cleans the memory fragments, the intelligent terminal can automatically clean the memory fragments.
Specifically, as shown in fig. 4, the third embodiment of the memory fragmentation cleaning method of the present application is based on the first embodiment of the memory fragmentation cleaning method of the present application, and further defines that step S12 includes:
s121: and triggering alarm information.
The alarm information may be generated and sent by a memory detection function module of the system, and the alarm information may be a preset trigger signal, such as a digital pulse signal "10011", for notifying the system of performing memory cleaning.
S122: the system responds to the alarm information, automatically writes at least part of the memory data into the external storage device, and releases the memory space and cache occupied by the memory data.
The external storage device is a storage device different from the system Memory, and may be an SD Card (secure digital Memory Card), or a device such as a magnetic disk or a hard disk.
Specifically, as shown in fig. 5, in an application example, after receiving the alarm information, a memory processing function module of the system starts memory write-back in response to the alarm information, automatically writes all or part of the memory data into an external storage device (such as an SD card in fig. 5), and then releases a memory space and a cache occupied by the written-back memory data, so that the memory space can be temporarily cleared, and memory fragments are reduced, thereby facilitating the operation of subsequent programs or services. The written back memory data may be data occupying a large memory, or data unused for a long time.
When the intelligent terminal cleans the memory fragments, the intelligent terminal can also clean the memory fragments according to the instruction of a service operator.
Specifically, as shown in fig. 6, the fourth embodiment of the memory fragmentation cleaning method of the present application is based on the first embodiment of the memory fragmentation cleaning method of the present application, and further defines that step S12 includes:
s123: triggering alarm information and sending the alarm information to a service operator.
The alarm information is generated by a system of the intelligent terminal, and the alarm information may be a preset trigger signal, such as a digital pulse signal "10011", for notifying a service operator that the intelligent terminal needs to perform memory cleaning.
The service operator is an operator currently providing services for the intelligent terminal, and each intelligent terminal at least has one corresponding service operator. Each service operator may provide services for a plurality of intelligent terminals at the same time, and the alarm information may further include an identification of the intelligent terminal (e.g. an IMEI code of the terminal) in order to distinguish different intelligent terminals.
S124: and judging whether an uploading instruction sent by a service operator is received.
The upload instruction is an instruction for controlling the intelligent terminal to perform memory fragment cleaning, and may include memory data and a cleaning mode, which are required to be cleaned by the intelligent terminal and indicated by a service operator. The memory data needing to be cleaned is at least part of data generated by the service operator for running of the application or thread service provided by the intelligent terminal.
If the upload instruction sent by the service provider is received, the following step S125 is executed.
S125: and writing the memory data indicated in the uploading instruction into an external storage device or uploading the memory data to a cloud end, and releasing the memory space and cache occupied by the memory data.
Specifically, as shown in fig. 7, when the intelligent terminal a detects that a large continuous free memory in the current system is insufficient, the system triggers and generates alarm information, and sends the alarm information to at least one service operator B. After receiving the alarm information, the service operator B analyzes the alarm information, and after knowing that the intelligent terminal A needs to perform memory cleaning, the service operator B feeds back an uploading instruction to the intelligent terminal A so as to inform the intelligent terminal A to clean at least part of memory data. After the intelligent terminal a receives the upload instruction, the upload instruction is analyzed to obtain the memory data to be cleaned, and then the intelligent terminal a can write the part of the memory data to be cleaned into an external storage device (such as an SD card) or upload the part of the memory data to the cloud C as shown in fig. 7 to store the part of the memory data, and simultaneously release the memory space and the cache occupied by the part of the memory data to clean more free memory space, reduce memory fragments, and facilitate the subsequent operation of the software function module. The cloud C may also be a storage server of the service operator B.
Optionally, due to factors such as poor network, the intelligent terminal may lose, delay or generate an error when sending the alarm information to the service operator, so that the service operator cannot correctly receive the alarm information and further cannot return the upload instruction; or, the upload instruction returned by the service operator is lost, delayed or wrong due to a network or the like, so that the intelligent terminal cannot correctly receive the upload instruction, in both cases, the intelligent terminal cannot receive the upload instruction within a preset waiting time (e.g., within 1 minute), and at this time, the intelligent terminal may execute the following step S126. The preset waiting time may be set by a user or may be automatically generated by the system.
S126: and repeatedly sending the alarm information to a service operator, or automatically cleaning the memory by the system.
When the intelligent terminal cannot receive the uploading instruction within a preset waiting time (for example, within 40 seconds), the intelligent terminal may repeatedly send the alarm information to the service operator, so as to wait for the service operator to return the uploading instruction, and then perform memory cleaning according to the uploading instruction. Or, after the intelligent terminal does not receive the upload instruction within a preset waiting time (e.g., within 40 seconds), the intelligent terminal may directly and automatically perform memory cleaning, and the specific cleaning process may refer to the execution process of step S122, which is not repeated here.
When the intelligent terminal finds that the large continuous idle memory of the system is insufficient, the intelligent terminal can also feed back the memory occupation condition to the background server so as to facilitate the background server to analyze whether the memory allocation problem exists.
Specifically, as shown in fig. 8, a fifth embodiment of the memory fragmentation cleaning method of the present application is based on the first embodiment of the memory fragmentation cleaning method of the present application, and further includes, after determining that the number of the large blocks of continuous memory is lower than the preset number in step S11:
s14: and acquiring the occupation condition of the memory in the system, and sending the occupation condition to a background server to analyze the problem.
Specifically, when the intelligent terminal finds that a large block of continuous free memory in the system is insufficient, that is, when more memory fragments exist in the system, there may be a problem in the memory allocation scheme of some application programs currently running or already running by the intelligent terminal, and optimization is required, or there may be a problem in the memory management mechanism of the operating system of the intelligent terminal itself, and optimization is required. At this time, the intelligent terminal may obtain an occupation situation of a memory in the system, and send the occupation situation to a background server, such as a background server of a currently running application program or a background server of the operating system, through a network, so that the background server or a background worker may analyze whether software such as the application program or the operating system has a problem through the memory occupation situation, so as to optimize the software having the problem.
As shown in fig. 8, step S14 may be executed after step S13, and the specific execution process of steps S11 to S13 may refer to the process of the first embodiment of the memory fragmentation cleaning method of the present application, and will not be repeated here. Of course, in other embodiments, the execution of step S14 may be performed before or simultaneously with step S13.
Optionally, as shown in fig. 9, step S14 specifically includes:
s141: and storing the threads occupying the memory space more than the preset space threshold or the proportion of the memory space more than the preset proportion to generate memory feedback information.
The preset space threshold is a preset minimum memory space threshold for defining a thread occupying a larger memory space, and the preset proportion is a preset minimum proportion threshold for defining a thread occupying a larger memory space. The specific values of the preset spatial threshold and the preset ratio can be set by a user or can be automatically generated by a system.
For example, when the intelligent terminal finds that a large block of continuous free memory in the system is insufficient, the intelligent terminal obtains thread storage that occupies more than 50MB of memory space in the system, or obtains thread storage that occupies more than 15% of memory space in the system, and generates memory feedback information (such as a feedback report), where the memory feedback information may include the thread or may include memory data of its execution process.
S142: and sending the memory feedback information to a background server of the application corresponding to the thread so as to analyze and optimize the application corresponding to the thread.
Specifically, each thread is generated by an associated application, and each application corresponds to an associated background server. With reference to fig. 10, after the intelligent terminal a generates the memory feedback information, the intelligent terminal a may send the memory feedback information to the background server D of the application corresponding to the thread stored in the memory feedback information, and the background server D or background personnel (e.g., programmers provided by the application) may analyze the memory allocation problem existing in the thread through the memory feedback information, so as to optimize the application corresponding to the thread. The memory feedback information may include a plurality of threads, the threads may correspond to a plurality of background servers of the application, and at this time, the intelligent terminal may send the memory feedback information to the corresponding background servers through a network.
When a system of an intelligent terminal allocates a memory, a certain segment of memory space may be allocated separately for a certain service, and both a free space exists before and after an address of the memory space, that is, memory allocation is discontinuous, so that the segment of memory space becomes an isolated memory block, and when the isolated memory block is too many, the problem of too many memory fragments is easily caused. Therefore, when the intelligent terminal cleans the memory, the isolated memory block can be moved, so that memory fragments are reduced.
Specifically, as shown in fig. 11, a sixth embodiment of the memory fragmentation cleaning method of the present application is based on the first embodiment of the memory fragmentation cleaning method of the present application, and further defines that step S12 includes:
s127: whether the isolated memory block exists or not, and the memory data with the storage time earlier than a first preset time or the memory data with the reading and writing frequency less than a preset frequency are detected.
The isolated memory block refers to a continuous memory data block in which a free memory space exists before and after an address stored in the memory block.
When the intelligent terminal detects that free memory spaces exist before and after the storage address of a certain segment of memory data, the segment of memory data is considered as an isolated memory block. At this time, the intelligent terminal performs the following step S128.
S128: and after the data stored in the isolated memory block is transferred to the memory space in which the data is stored in the system, deleting the isolated memory block.
Specifically, when an isolated memory block exists, the intelligent terminal can transfer the data stored in the isolated memory block to a memory space in the system where the data has been stored, that is, store the data of the isolated memory block to a continuous memory block, and delete the isolated memory block, so that two memory fragments before and after the isolated memory block can be cleaned to form a whole memory, thereby reducing the memory fragments.
The first preset time is used for defining the memory data which is not cleared for a long time, the preset frequency is used for defining the memory data which is not used for a long time, and the two types of memory data can be cleared preferentially because the memory is not cleared for a long time or the data left by the memory which is not cleared completely can be cleared. The first preset time and the preset frequency may be set by a user or automatically generated by the system.
For example, when the first preset time is set to be two days before the current system time, the intelligent terminal detects whether the storage time of the memory data is two days before the current system time, and if so, the intelligent terminal determines that the memory data earlier than the first preset time exists. At this time, the smart terminal performs the following step S129.
When the preset frequency is set to 3 times, the intelligent terminal detects the read-write frequency of the memory data, and when the read-write frequency of a certain segment of memory data is less than 3 times, the intelligent terminal considers that there is memory data with the read-write frequency less than the preset frequency, and at this time, the intelligent terminal executes the following step S129.
S129: preferentially writing the memory data into the external storage equipment and releasing the memory space occupied by the memory data.
Specifically, when the system detects that there is memory data whose storage time is earlier than the first preset time and/or memory data whose read-write frequency is less than the preset frequency, the system may preferentially write back the part of the memory data, for example, write the part of the memory data into an external storage device (such as an SD card), or upload the part of the memory data to a cloud, and then release a memory space occupied by the memory data, so that more memories can be cleared and memory fragments can be reduced.
If the isolated memory block, the memory data with the storage time earlier than the first preset time and the memory data with the read-write frequency less than the preset frequency do not exist, step S13 may be executed, and after waiting for a period of time (memory detection period), step S11 may be executed to perform memory detection, so as to know the situation that a large block of continuous memory in the system memory is insufficient in time, and then perform memory cleaning in time, thereby avoiding affecting the operation of the subsequent software function module.
In other embodiments, the intelligent terminal may perform the memory detection before the user needs to run the large program according to information such as habits of the user while performing the periodic detection, so as to avoid that the program cannot run due to insufficient memory.
Specifically, as shown in fig. 12, the seventh embodiment of the memory fragment cleaning method according to the present application is based on the first embodiment of the memory fragment cleaning method according to the present application, before further limiting step S11, the method further includes:
s20: and acquiring user setting information or user habit information, wherein the user setting information or the user habit information comprises the predicted time for opening the application by the user.
The user setting information is information set by a user, and the user habit information is information set by the user or automatically generated after the system collects the time of opening the application by the user. The user setting information or the user habit information includes information for predicting when the user opens some applications, for example, information for opening the game application a1 at 17:00 per day by the user.
S21: and predicting the memory space occupied by the application in a second preset time range before the prediction time.
The second predetermined time range may be set to a time period before the predicted time, for example, within 20 to 30 minutes before the predicted time.
Specifically, in an application example, after the intelligent terminal obtains the information that the user starts the game application A1 at 17:00 a day from the user setting information or the habit information, the intelligent terminal can predict the memory space required to be occupied by the application at 16: 30-16: 40 a day. The intelligent terminal can use the average memory occupation condition of the application or the maximum memory occupation condition of the application acquired when the user runs the application every time as the memory space required to be occupied by the application. The situation that the application occupies the memory space can also be stored in the user setting information or the user habit information.
S22: and judging whether the memory space required to be occupied by the predicted application is larger than a preset memory threshold value or not.
The preset memory threshold is a preset minimum memory occupancy threshold used for defining a large application, and a specific value of the preset memory threshold may be set by a user, for example, set to 100 MB.
If the memory space required by the application is predicted to be larger than the preset memory threshold, the following step S23 is executed.
S23: execution continues directly with step S11.
If the memory space required by the application is predicted to be less than or equal to the predetermined memory threshold, the following step S24 may be executed.
S24: the step S11 continues to be periodically executed at a preset cycle.
In the above application example, when the intelligent terminal predicts that the memory space that the game application a1 needs to occupy is greater than 100MB, it is determined that the memory space that the predicted application needs to occupy is greater than the preset memory threshold, the intelligent terminal may execute step S23, that is, continue to execute step S11, and determine whether the number of large blocks of continuous free memory in the system is less than the preset number, so that when the number of large blocks of continuous free memory is less than the preset number, the system or the operator is notified to perform memory fragmentation processing, and thus when the number of large blocks of continuous free memory is less, the memory can be cleaned in time, memory fragmentation is reduced, so that the available memory space is more, and the situation that the game application a1 cannot run due to insufficient memory is reduced. If the memory space required by the application is predicted to be less than or equal to the preset memory threshold, the intelligent terminal executes step S24, continues to execute step S11 periodically with the preset period, and if the current time is not the time of executing S11 periodically, waits for a period of time, and executes step S11 when the time of executing S11 is reached. The specific execution process of step S11 may refer to the execution process of step S11 in the first or second embodiment of the memory fragmentation cleaning method of the present application, and is not repeated here.
As shown in fig. 13, in an embodiment of the electronic device of the present application, an electronic device 100 includes: a processor 110, and a memory circuit 120 coupled to the processor 110.
The electronic device 100 is a device with a storage function, such as a mobile phone, a tablet, a smart watch, and the like. The memory circuit 120 is used for storing data, including programs and data, etc. required for the processor 110 to operate.
The processor 110 controls the operation of the electronic device 100, and the processor 110 may also be referred to as a Central Processing Unit (CPU). The processor 110 may be an integrated circuit chip having signal processing capabilities. The processor 110 may also be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The processor 110 is configured to execute the instructions to implement the method as provided in any one of the first to seventh embodiments of the memory fragmentation cleaning method or non-conflicting combinations thereof.
Optionally, as shown in fig. 13, the electronic device 100 may further include a communication circuit 130 connected to the processor 110, where the communication circuit 130 is configured to communicate with an external device, for example, send alarm information to a service provider, receive an upload instruction sent by the service provider, upload memory data to a cloud, and send a memory status feedback report of the electronic device 100 to a background server.
Of course, in other embodiments, the electronic device 100 may further include other components such as a display (not shown), which are not specifically limited herein.
In this embodiment, the intelligent terminal notifies the system or the operator to perform the memory fragmentation processing by judging whether the number of the large blocks of continuous free memory in the system is less than the preset number or not and when the number of the large blocks of continuous free memory is less than the preset number, so that the memory can be timely cleaned and the memory fragmentation is reduced when the number of the large blocks of continuous free memory is less, the available memory space is more, and the situation that the software function module cannot run due to insufficient memory is reduced.
As shown in fig. 14, in an embodiment of the apparatus with storage function of the present application, a program 210 is stored in an apparatus 200 with storage function, and when the program 210 is executed, the method provided in any one of the first to seventh embodiments of the memory fragmentation cleaning method of the present application or the non-conflicting combination thereof is implemented.
The device 200 with a storage function may be a portable storage medium such as a usb disk and an optical disk, or may be an intelligent terminal, a server, or a separate component which can be integrated in the intelligent terminal, such as a chip.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. A memory fragmentation cleaning method is characterized by comprising the following steps:
the intelligent terminal judges whether the number of the large blocks of continuous free memories in the system is lower than a preset number or not;
if the number of the large blocks of continuous free memories is lower than the preset number, informing a system or an operator to carry out memory fragment processing;
the large continuous free memory is a continuously allocatable memory address space with a continuous available memory space larger than a preset memory space.
2. The method of claim 1, wherein the intelligent terminal determining whether the number of the large blocks of continuous free memory in the system is lower than a preset number comprises:
acquiring a memory resource allocation condition file of a system;
reading the value of a preset node in the memory resource allocation condition file, wherein the preset node stores the quantity of the continuous large blocks of free memory;
judging whether the value of the preset node is smaller than the preset number or not;
and if the value of the preset node is less than the preset number, judging that the number of the large blocks of continuous free memories in the system is less than the preset number.
3. The method of claim 1, wherein notifying the system or the operator of memory fragmentation comprises:
triggering alarm information;
and the system responds to the alarm information, automatically writes at least part of the memory data into external storage equipment, and releases the memory space and cache occupied by the memory data.
4. The method of claim 1, wherein notifying the system or the operator of memory fragmentation comprises:
triggering alarm information and sending the alarm information to a service operator;
judging whether an uploading instruction sent by the service operator is received;
and if the uploading instruction sent by the service operator is received, writing the memory data indicated in the uploading instruction into an external storage device or uploading to the cloud, and releasing the memory space and cache occupied by the memory data.
5. The method of claim 1, wherein after determining whether the number of the large blocks of contiguous free memory in the system is lower than a preset number, the method further comprises:
and if the number of the large continuous memories is lower than the preset number, acquiring the occupation condition of the memories in the system, and sending the occupation condition to a background server to analyze the problems.
6. The method of claim 5, wherein the obtaining the occupancy of the memory in the system and sending the occupancy to a background server to analyze the problem comprises:
storing the threads occupying the memory space more than a preset space threshold or the proportion of the memory space more than a preset proportion to generate memory feedback information;
and sending the memory feedback information to a background server of the application corresponding to the thread so as to analyze and optimize the application corresponding to the thread.
7. The method of claim 1, wherein notifying the system or the operator of memory fragmentation comprises:
detecting whether an isolated memory block exists or not, memory data with the storage time earlier than a first preset time or memory data with the reading and writing frequency less than a preset frequency;
if the isolated memory block exists, transferring the data stored in the isolated memory block to a memory space in which data are stored in a system, and deleting the isolated memory block;
if the memory data with the storage time earlier than the first preset time or the memory data with the read-write frequency less than the preset frequency exist, preferentially writing the memory data into an external storage device, and releasing the memory space occupied by the memory data.
8. The method of claim 1, wherein before determining whether the amount of the large contiguous block of memory in the system is less than a predetermined amount, the method further comprises:
acquiring user setting information or user habit information, wherein the user setting information or the user habit information comprises the predicted time for opening the application by a user;
predicting the memory space occupied by the application in a second preset time range before the prediction time;
judging whether the memory space is larger than a preset memory threshold value or not;
and if the memory space is larger than a preset memory threshold value, continuing to execute the step that the intelligent terminal judges whether the quantity of the large blocks of continuous memories in the system is lower than the preset quantity.
9. An electronic device, comprising: a memory circuit and a processor connected to each other;
the storage circuit is used for storing data;
the processor is configured to execute instructions to implement the memory fragmentation cleaning method according to any of claims 1 to 8.
10. An apparatus having a storage function, in which a program is stored, wherein the program is executed to implement the memory fragmentation cleaning method according to any one of claims 1 to 8.
CN201811297424.3A 2018-11-01 2018-11-01 Memory fragment cleaning method, electronic equipment and device with storage function Withdrawn CN111124941A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811297424.3A CN111124941A (en) 2018-11-01 2018-11-01 Memory fragment cleaning method, electronic equipment and device with storage function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811297424.3A CN111124941A (en) 2018-11-01 2018-11-01 Memory fragment cleaning method, electronic equipment and device with storage function

Publications (1)

Publication Number Publication Date
CN111124941A true CN111124941A (en) 2020-05-08

Family

ID=70494497

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811297424.3A Withdrawn CN111124941A (en) 2018-11-01 2018-11-01 Memory fragment cleaning method, electronic equipment and device with storage function

Country Status (1)

Country Link
CN (1) CN111124941A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102984580A (en) * 2012-11-12 2013-03-20 北京奇虎科技有限公司 Internal storage cleaning method and system
CN106201717A (en) * 2016-07-01 2016-12-07 珠海市魅族科技有限公司 A kind of method managing Installed System Memory and terminal
CN107547267A (en) * 2017-08-10 2018-01-05 上海斐讯数据通信技术有限公司 EMS memory management process and system, the radio reception device of a kind of radio reception device
CN108536609A (en) * 2017-03-02 2018-09-14 迈普通信技术股份有限公司 Memory fragmentation manages system and method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102984580A (en) * 2012-11-12 2013-03-20 北京奇虎科技有限公司 Internal storage cleaning method and system
CN106201717A (en) * 2016-07-01 2016-12-07 珠海市魅族科技有限公司 A kind of method managing Installed System Memory and terminal
CN108536609A (en) * 2017-03-02 2018-09-14 迈普通信技术股份有限公司 Memory fragmentation manages system and method
CN107547267A (en) * 2017-08-10 2018-01-05 上海斐讯数据通信技术有限公司 EMS memory management process and system, the radio reception device of a kind of radio reception device

Similar Documents

Publication Publication Date Title
US11467769B2 (en) Managed fetching and execution of commands from submission queues
US11016956B2 (en) Database management system with database hibernation and bursting
US9852008B2 (en) Computer-readable recording medium storing execution information notification program, information processing apparatus, and information processing system
JP6191691B2 (en) Abnormality detection apparatus, control method, and program
US20100287314A1 (en) Storage device estimating a completion time for a storage operation
JP2013509658A (en) Allocation of storage memory based on future usage estimates
US20140215176A1 (en) Memory allocation control method, recording medium, and information processing device
CN109582215B (en) Hard disk operation command execution method, hard disk and storage medium
CN108984104B (en) Method and apparatus for cache management
CN104978362A (en) Data migration method of distributive file system, data migration device of distributive file system and metadata server
CN101853196A (en) Method and device recording exceptional data
CN108141471B (en) Method, device and equipment for compressing data
US8914582B1 (en) Systems and methods for pinning content in cache
CN109726137B (en) Management method of garbage collection task of solid state disk, controller and solid state disk
US9720600B2 (en) Apparatus and method for transferring data between storages having different access speeds
WO2013160934A1 (en) Storage apparatus, computer system and snapshot creation method
US20180004409A1 (en) Method and apparatus for managing storage device
US11467942B2 (en) Predictive performance indicator for storage devices
CN113835624A (en) Data migration method and device based on heterogeneous memory
US11593262B1 (en) Garbage collection command scheduling
US9652155B2 (en) Computer system, cash data management method, and computer
CN108287761B (en) Memory recovery method and device, terminal equipment and computer readable storage medium
CN111221468B (en) Storage block data deleting method and device, electronic equipment and cloud storage system
CN109426563B (en) Process management method and device
CN111124941A (en) Memory fragment cleaning method, electronic equipment and device with storage function

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
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20200508