Memory management method and terminal
By establishing a memory structure table when the process starts and updating it in real time, it solves the time-consuming problem of traditional memory management and achieves efficient memory data analysis and management.
Patent Information
- Application Number
- CN202410776261.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-06-17
AI Technical Summary
Traditional memory management methods require traversing each memory attribute, which is time-consuming and increases system burden. How to improve the efficiency of memory analysis and management is an urgent problem to be solved.
When the process starts, based on the attributes and status of the memory data, an associated memory structure table is established, new data is monitored in real time, and the structure table is updated to optimize memory data management.
By directly calling the memory structure table corresponding to the memory attributes for analysis, it avoids traversing all memory attributes and significantly improves the efficiency of memory analysis and management.
Smart Images

Figure CN118779316A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and in particular to a memory management method and terminal. Background Art
[0002] Memory is an important part of the computer, also known as internal memory and main memory. It is used to temporarily store the calculation data in the CPU and the data exchanged with external memory such as the hard disk. It is a bridge for communication between the external memory and the CPU. All programs in the computer are run in the memory. As long as the computer starts running, the operating system will transfer the data to be calculated from the memory to the CPU for calculation. When the calculation is completed, the CPU will transmit the result.
[0003] When the program is running, the process will generate memory with various memory attributes, including heap memory, stack memory, global variables, etc.
[0004] In traditional memory analysis, each memory attribute needs to be traversed to ensure effective memory management and monitoring. That is, each memory attribute needs to be traversed, which is not only time-consuming but also increases the burden on the system. When new memory is added, corresponding traversal operations are also required to ensure the correct allocation and release of the new memory. Therefore, this scanning behavior is very time-consuming and needs to be scanned in real time to ensure the normal operation of the system memory.
[0005] How to improve the efficiency of memory analysis management is a technical problem that needs to be solved urgently. Summary of the invention
[0006] The technical problem to be solved by the present invention is to provide a memory management method and a terminal to improve the efficiency of memory analysis management.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0008] A memory management method comprises the steps of:
[0009] S1. When the process starts, the existing data in the memory is divided according to the memory attributes of the memory data, attribute identifiers are added, and associated memory structure tables are established for different memory attributes according to the form and state of the memory data;
[0010] S2. Monitor the memory data in real time. When new data is detected, add an attribute identifier to the new data according to the memory attribute of the new data, and update the memory structure table associated with the memory attribute in combination with the form and state of the new data.
[0011] S3. Analyze and manage memory data based on the memory structure table.
[0012] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0013] A memory management terminal comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0014] S1. When the process starts, the existing data in the memory is divided according to the memory attributes of the memory data, attribute identifiers are added, and associated memory structure tables are established for different memory attributes according to the form and state of the memory data;
[0015] S2. Monitor the memory data in real time. When new data is detected, add an attribute identifier to the new data according to the memory attribute of the new data, and update the memory structure table associated with the memory attribute in combination with the form and state of the new data.
[0016] S3. Analyze and manage memory data based on the memory structure table.
[0017] The beneficial effects of the present invention are as follows: a memory management method and terminal of the present invention establish associated memory structure tables for different memory attributes according to the form and state of memory data, so that when memory data analysis is required, it can be performed directly by calling the memory structure table of the corresponding memory attribute, and the data can be further filtered according to the form and state of the memory data without traversing all memory attributes, thereby effectively improving the efficiency of memory analysis and management. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A flowchart of a memory management method according to an embodiment of the present invention;
[0019] Figure 2 A structural diagram of a terminal for memory management according to an embodiment of the present invention;
[0020] Figure 3 An example diagram of a memory structure table structure of a memory management method according to an embodiment of the present invention;
[0021] Figure 4 A schematic diagram of memory attribute division in a memory management method according to an embodiment of the present invention;
[0022] Figure 5 A functional module display diagram of a memory management method according to an embodiment of the present invention;
[0023] Description of labels:
[0024] 1. A memory management terminal; 2. Processor; 3. Memory. DETAILED DESCRIPTION
[0025] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.
[0026] Please refer to Figure 1 , a memory management method, comprising the steps of:
[0027] S1. When the process starts, the existing data in the memory is divided according to the memory attributes of the memory data, attribute identifiers are added, and associated memory structure tables are established for different memory attributes according to the form and state of the memory data;
[0028] S2. Monitor the memory data in real time. When new data is detected, add an attribute identifier to the new data according to the memory attribute of the new data, and update the memory structure table associated with the memory attribute in combination with the form and state of the new data.
[0029] S3. Analyze and manage memory data based on the memory structure table.
[0030] From the above description, it can be seen that the beneficial effects of the present invention are: a memory management method and terminal of the present invention establish associated memory structure tables for different memory attributes according to the form and state of memory data, so that when memory data analysis is needed, it can be performed directly by calling the memory structure table of the corresponding memory attribute, and the data can be further filtered according to the form and state of the memory data, without traversing all memory attributes, effectively improving the efficiency of memory analysis and management.
[0031] Furthermore, the establishment of the memory structure table includes the steps of:
[0032] S11, dividing a temporary storage memory in the memory, and constructing a memory structure table of an associated tree structure for different memory attributes in the temporary storage memory;
[0033] S12, in the memory structure table associated with each memory attribute, dividing the memory data according to the memory form and generating child nodes;
[0034] The memory form includes initial data and dynamic data;
[0035] S13. The existing memory data when the process is started is divided into initial data, and the subsequently added memory data is divided into dynamic data. A memory list is constructed under each child node to record the memory data.
[0036] From the above description, it can be seen that the memory structure table is constructed in a tree structure to achieve the classification of memory data and the recording of data attributes.
[0037] Furthermore, step S2 also includes the steps of:
[0038] When it is monitored that there is a data change in the memory data, the data in the memory structure table is synchronously updated, and the memory data table records the changed memory data under the changed memory data.
[0039] From the above description, it can be seen that the memory structure table records the data changes of the memory data to facilitate analysis.
[0040] Furthermore, the following steps are included between step S2 and step S3:
[0041] The memory structure table receives the information of data change, compares the memory data before and after the change, and obtains the difference data for analyzing the memory data.
[0042] From the above description, it can be seen that extracting difference data for analyzing memory data can improve data analysis efficiency.
[0043] Furthermore, the memory attributes include mapped memory, virtual machine memory and stack memory.
[0044] As can be seen from the above description, the memory attributes include mapped memory, virtual machine memory and stack memory, as a specific embodiment of the present invention.
[0045] Please refer to Figure 2 , a memory management terminal, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0046] S1. When the process starts, the existing data in the memory is divided according to the memory attributes of the memory data, attribute identifiers are added, and associated memory structure tables are established for different memory attributes according to the form and state of the memory data;
[0047] S2. Monitor the memory data in real time. When new data is detected, add an attribute identifier to the new data according to the memory attribute of the new data, and update the memory structure table associated with the memory attribute in combination with the form and state of the new data.
[0048] S3. Analyze and manage memory data based on the memory structure table.
[0049] From the above description, it can be seen that the beneficial effects of the present invention are: a memory management method and terminal of the present invention establish associated memory structure tables for different memory attributes according to the form and state of memory data, so that when memory data analysis is needed, it can be performed directly by calling the memory structure table of the corresponding memory attribute, and the data can be further filtered according to the form and state of the memory data, without traversing all memory attributes, effectively improving the efficiency of memory analysis and management.
[0050] Furthermore, the establishment of the memory structure table includes the steps of:
[0051] S11, dividing a temporary storage memory in the memory, and constructing a memory structure table of an associated tree structure for different memory attributes in the temporary storage memory;
[0052] S12, in the memory structure table associated with each memory attribute, dividing the memory data according to the memory form and generating child nodes;
[0053] The memory form includes initial data and dynamic data;
[0054] S13. The existing memory data when the process is started is divided into initial data, and the subsequently added memory data is divided into dynamic data. A memory list is constructed under each child node to record the memory data.
[0055] From the above description, it can be seen that the memory structure table is constructed in a tree structure to achieve the classification of memory data and the recording of data attributes.
[0056] Furthermore, step S2 also includes the steps of:
[0057] When it is monitored that there is a data change in the memory data, the data in the memory structure table is synchronously updated, and the memory data table records the changed memory data under the changed memory data.
[0058] From the above description, it can be seen that the memory structure table records the data changes of the memory data to facilitate analysis.
[0059] Furthermore, the following steps are included between step S2 and step S3:
[0060] The memory structure table receives the information of data change, compares the memory data before and after the change, and obtains the difference data for analyzing the memory data.
[0061] From the above description, it can be seen that extracting difference data for analyzing memory data can improve data analysis efficiency.
[0062] Furthermore, the memory attributes include mapped memory, virtual machine memory and stack memory.
[0063] As can be seen from the above description, the memory attributes include mapped memory, virtual machine memory and stack memory, as a specific embodiment of the present invention.
[0064] A memory management method and terminal of the present invention are applicable to a scenario where memory data needs to be traversed and analyzed, and manage the memory data to improve the efficiency of memory data analysis.
[0065] Please refer to Figure 1 as well as Figures 3 to 5 , Embodiment 1 of the present invention is:
[0066] A memory management method comprises the steps of:
[0067] S1. When the process starts, the existing data in the memory is divided according to the memory attributes of the memory data, attribute identifiers are added, and associated memory structure tables are established for different memory attributes according to the form and state of the memory data;
[0068] The memory attributes include mapped memory, virtual machine memory and stack memory.
[0069] In this embodiment, reference can be made to Figure 4 and Figure 5 , a functional module translator is designed. When starting, the translator redefines the existing memory data and adds attribute identifiers M, V, and H. M identifies mapped memory, V identifies virtual memory, and H identifies stack memory.
[0070] For example: 0x10000 M: Map type.
[0071] 0x150000V: Virtual type.
[0072] 0x567000H: Heap type.
[0073] The establishment of the memory structure table includes the steps of:
[0074] S11, dividing a temporary storage memory in the memory, and constructing a memory structure table of an associated tree structure for different memory attributes in the temporary storage memory;
[0075] S12, in the memory structure table associated with each memory attribute, dividing the memory data according to the memory form and generating child nodes;
[0076] The memory form includes initial data and dynamic data;
[0077] S13. The existing memory data when the process is started is divided into initial data, and the subsequently added memory data is divided into dynamic data. A memory list is constructed under each child node to record the memory data.
[0078] In this embodiment, the function module synchronizer is started, and the synchronizer creates a synchronized temporary storage area for the process to store the memory structure table. The memory structure table is recorded in a tree structure.
[0079] In this embodiment, the memory data of each memory attribute is divided into memory forms according to whether the memory data already exists when the process is started. The memory data that already exists when the process is started is divided into initial data, and the initial data only needs to pay attention to data changes. The memory data generated by the program during execution is divided into dynamic data, and the memory data including memory protection (readable and writable), memory status (has been released, or exists), and data (data content) are recorded and paid attention to. In this embodiment, it is assumed that the memory data generated by the process startup process belongs to the scope that needs to be protected, that is, the memory address (list) generated at the moment when the program is started.
[0080] When querying data, if the data is deemed illegal or tampered by the server, it can be located through memory protection, memory status, and data. If it is initialized memory, only the initialized data needs to be located, and there is no need to traverse the memory again.
[0081] Please refer to Figure 3 An example of the structure of a memory structure table of a memory attribute is shown.
[0082] S2. Monitor the memory data in real time. When new data is detected, add an attribute identifier to the new data according to the memory attribute of the new data, and update the memory structure table associated with the memory attribute in combination with the form and state of the new data.
[0083] Step S2 also includes the steps of:
[0084] When it is monitored that there is a data change in the memory data, the data in the memory structure table is synchronously updated, and the memory data table records the changed memory data under the changed memory data.
[0085] In this embodiment, Figure 3Take the memory structure table shown as an example. In the memory format, initial data->memory List0xE7000 is the memory address at the initial time. After being parsed and synchronized by the translator, it is converted to 0x110000. The address data is the same. At this time, 0xE7000 is used as the reference of the initial data. 35112755 is the data change that occurred in the system timestamp. Offset means that the position changed at 35112755. 3 10 10 10 means that the position data was first changed to E6 and then to EF. Dynamic data refers to memory data that does not exist when the process starts. These data are dynamically created during the program running and need to be recorded. The reason for having memory protection, memory status, and data attributes is that when looking for data, the memory can be traversed once according to the pre-attributes, and then the data can be found according to the traversed memory for easy search.
[0086] In this embodiment, this process is performed by a functional module synchronizer. At the same time, in this embodiment, a system mapping mechanism is used to synchronize data from the memory to the memory structure table, and there is no need for the program to actively synchronize the memory data content.
[0087] The steps between step S2 and step S3 include:
[0088] The memory structure table receives the information of data change, compares the memory data before and after the change, and obtains the difference data for analyzing the memory data.
[0089] S3. Analyze and manage memory data based on the memory structure table.
[0090] Please refer to Figure 2 , Embodiment 2 of the present invention is:
[0091] A memory management terminal 1 includes a processor 2, a memory 3, and a computer program stored in the memory 3 and executable on the processor 2. When the processor 2 executes the computer program, the steps of a memory management method in the above embodiment 1 are implemented.
[0092] In summary, the present invention provides a memory management method and terminal, which establish associated memory structure tables for different memory attributes according to the form and status of memory data, so that when memory data analysis is needed, it can be performed directly by calling the memory structure table of the corresponding memory attribute, and the data can be further filtered according to the form and status of the memory data without traversing all memory attributes, thereby effectively improving the efficiency of memory analysis and management.
[0093] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A memory management method, characterized in that: Includes steps: S1. When the process starts, the existing data in the memory is divided according to the memory attributes of the memory data, attribute identifiers are added, and associated memory structure tables are established for different memory attributes according to the form and state of the memory data; S2. Monitor the memory data in real time. When new data is detected, add an attribute identifier to the new data according to the memory attribute of the new data, and update the memory structure table associated with the memory attribute in combination with the form and state of the new data. S3. Analyze and manage memory data based on the memory structure table.
2. A memory management method according to claim 1, characterized in that: The establishment of the memory structure table includes the steps of: S11, dividing a temporary storage memory in the memory, and constructing a memory structure table of an associated tree structure for different memory attributes in the temporary storage memory; S12, in the memory structure table associated with each memory attribute, dividing the memory data according to the memory form and generating child nodes; The memory form includes initial data and dynamic data; S13. The existing memory data when the process is started is divided into initial data, and the subsequently added memory data is divided into dynamic data. A memory list is constructed under each child node to record the memory data.
3. A memory management method according to claim 1, characterized in that: Step S2 also includes the steps of: When it is monitored that there is a data change in the memory data, the data in the memory structure table is synchronously updated, and the memory data table records the changed memory data under the changed memory data.
4. A memory management method according to claim 3, characterized in that: The steps between step S2 and step S3 include: The memory structure table receives the information of data change, compares the memory data before and after the change, and obtains the difference data for analyzing the memory data.
5. A memory management method according to claim 1, characterized in that: The memory attributes include mapped memory, virtual machine memory and stack memory.
6. A memory management terminal, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the following steps are implemented: S1. When the process starts, the existing data in the memory is divided according to the memory attributes of the memory data, attribute identifiers are added, and associated memory structure tables are established for different memory attributes according to the form and state of the memory data; S2. Monitor the memory data in real time. When new data is detected, add an attribute identifier to the new data according to the memory attribute of the new data, and update the memory structure table associated with the memory attribute in combination with the form and state of the new data. S3. Analyze and manage memory data based on the memory structure table.
7. A memory management terminal according to claim 5, characterized in that: The establishment of the memory structure table includes the steps of: S11, dividing a temporary storage memory in the memory, and constructing a memory structure table of an associated tree structure for different memory attributes in the temporary storage memory; S12, in the memory structure table associated with each memory attribute, dividing the memory data according to the memory form and generating child nodes; The memory form includes initial data and dynamic data; S13. The existing memory data when the process is started is divided into initial data, and the subsequently added memory data is divided into dynamic data. A memory list is constructed under each child node to record the memory data.
8. A memory management terminal according to claim 5, characterized in that: Step S2 also includes the steps of: When it is monitored that there is a data change in the memory data, the data in the memory structure table is synchronously updated, and the memory data table records the changed memory data under the changed memory data.
9. A memory management terminal according to claim 8, characterized in that: The steps between step S2 and step S3 include: The memory structure table receives the information of data change, compares the memory data before and after the change, and obtains the difference data for analyzing the memory data.
10. A memory management terminal according to claim 5, characterized in that: The memory attributes include mapped memory, virtual machine memory and stack memory.
Citation Information
Patent Citations
Automatic memory evidence analyzing method based on data association
CN104392171A
Memory analysis method, device and system
CN113297057A
Multi-device association method, system and device of smart rail transit system and storage medium
CN117539873A
Blackbox Memory Monitoring with a Calling Context Memory Map and Semantic Extraction
US20140068351A1
