Memory snapshot file processing method and device, medium, equipment and product
By determining the node collection identification and target index information of the memory snapshot file, unnecessary data is cut, which solves the problem of large space occupancy of memory snapshot files, and improves data security and resource utilization efficiency.
Patent Information
- Application Number
- CN202411824246.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-03-14
AI Technical Summary
Existing memory snapshot files may contain unnecessary data, resulting in large file space occupies, which can easily lead to traffic consumption and excessive server space during transmission.
By reading the initial data of the memory snapshot file, in response to reading the node set identifier, a node set corresponding to the node set identifier is determined, and the target index information is determined based on the target node in the node set, and the target string in the initial data is cropped to obtain the cropped target memory snapshot file.
Effectively crop non-essential data in memory snapshot files, enhance data security, reduce resource usage during file storage and transmission, and avoid unnecessary information leakage.
Smart Images

Figure CN119621247A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, medium, equipment and product for processing a memory snapshot file. Background Art
[0002] Currently, virtual machines are widely used in applications. It is possible to obtain virtual machine memory snapshot files through system interfaces. Memory snapshot files are very important for troubleshooting memory leaks in applications. However, these memory snapshot files may contain unnecessary data. In addition, memory snapshot files usually take up a large amount of space. When they are transmitted to the server, they are prone to excessive traffic consumption and excessive occupation of server space. Summary of the invention
[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] In a first aspect, the present disclosure provides a method for processing a memory snapshot file, the method comprising: Read the initial data of the memory snapshot file; In response to reading the node set identifier, determining a node set corresponding to the node set identifier; Determine target index information according to a target node in the node set, the target node being a node whose data type is a preset type, and the target index information is used to indicate an index position of a target character string to be processed; The target character string in the initial data is trimmed according to the target index information to obtain a trimmed target memory snapshot file.
[0005] In a second aspect, the present disclosure provides a device for processing a memory snapshot file, the device comprising: The reading module is used to read the initial data of the memory snapshot file; A first determining module, configured to determine a node set corresponding to the node set identifier in response to reading the node set identifier; A second determination module is used to determine target index information according to a target node in the node set, wherein the target node is a node whose data type is a preset type, and the target index information is used to indicate an index position of a target string to be processed; The first clipping module is used to clip the target character string in the initial data according to the target index information to obtain a clipped target memory snapshot file.
[0006] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect of the present disclosure.
[0007] In a fourth aspect, the present disclosure provides an electronic device, including: a storage device having a computer program stored thereon; A processing device is used to execute the computer program in the storage device to implement the steps of the method described in the first aspect of the present disclosure.
[0008] In a fifth aspect, the present disclosure provides a computer program product, including a computer program, which implements the steps of the method described in the first aspect of the present disclosure when the computer program is executed by a processor.
[0009] Through the above technical solution, the initial data of the memory snapshot file is read, and in response to the node set identifier being read, the node set corresponding to the node set identifier is determined, and then the target index information is determined based on the target node in the node set. The target node is a node whose data type is a preset type, and the target index information is used to indicate the index position of the target string to be processed. Then, according to the target index information, the target string in the initial data is trimmed to obtain the trimmed target memory snapshot file. In this way, the memory snapshot file can be optimized, unnecessary data therein can be trimmed, the security of user data can be enhanced, and unnecessary information leakage during file upload can be avoided. In addition, by reducing the unnecessary data in the memory snapshot file, the resource usage during file storage and transmission can be effectively reduced.
[0010] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings: Figure 1 is a flowchart of a method for processing a memory snapshot file provided according to an embodiment of the present disclosure; Figure 2 is a block diagram of a memory snapshot file processing device provided according to an embodiment of the present disclosure; Figure 3 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0012] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0013] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0014] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0015] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0016] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0017] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0018] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0019] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0020] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0021] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0022] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0023] Figure 1 FIG. 1 is a flowchart of a method for processing a memory snapshot file provided according to an embodiment of the present disclosure. Figure 1 As shown, the method for processing memory snapshot files provided by the present disclosure may include steps 11 to 14.
[0024] In step 11, the initial data of the memory snapshot file is read.
[0025] Optionally, the memory snapshot file (ie, snapshot file) is a text file. For example, the memory snapshot file may be a text file in a JSON structure.
[0026] In a possible implementation, the memory snapshot file may be divided into a plurality of blocks of a fixed size and then read block by block.
[0027] In another possible implementation, step 11 may include the following steps: The initial data of the memory snapshot file is read in a streaming manner in units of a preset number of characters.
[0028] The preset number may be a positive integer greater than or equal to 1.
[0029] For example, the initial data of the memory snapshot file may be streamed and read character by character in units of single characters.
[0030] Through the above method, efficient processing of memory snapshot files can be achieved, the memory usage during the processing is reduced, and the risk of memory overflow caused by loading the entire file at one time is effectively reduced.
[0031] Optionally, during the process of streaming reading of the initial data of the memory snapshot file, a preliminary lexical analysis of the read content can be performed according to preset rules. The preset rules can be used to indicate the recognition rules of specific characters, such as escape characters, strings, etc. For example, if "\" is recognized, it is determined that an escape character is recognized. For another example, if the start symbol of a string is recognized, the start state of the string is recorded, and characters continue to be read into a buffer. When the end symbol of the string is read, the content that has been read into the buffer is used as the read string. Optionally, the start symbol and the end symbol of the string can both be double quotes ("). Accordingly, when the double quotes are read for the first time, it is determined that the start symbol of the string is read. Thereafter, when the double quotes are read again, it is determined that the end symbol of the string is read.
[0032] After lexical analysis, targeted processing can be performed based on the results of the lexical analysis.
[0033] Optionally, a character following the escape character has no actual meaning, and therefore the escape character and the character following the escape character may be retained in the memory snapshot file as is.
[0034] Based on this, in a possible implementation manner, the method provided by the present disclosure may include the following steps: In response to reading an escape character, writing the escape character and a character read after the escape character into the target memory snapshot file.
[0035] That is, during streaming reading, if an escape character is determined to be read through lexical analysis, the escape character and a character read after the escape character can be directly written to the output stream, that is, retained in the final target memory snapshot file.
[0036] By writing the escape character and its subsequent characters into the target memory snapshot file in the above manner, the correctness and integrity of the file content can be ensured, thereby avoiding data corruption or format errors caused by improper escape character processing, and effectively ensuring the availability of the file.
[0037] Optionally, according to the memory snapshot protocol, the structure of the memory snapshot file includes a node set. The nodes in the node set may be related to character strings involving non-essential data. If such character strings are directly retained in the memory snapshot file, there may be information leakage during the transmission process and there may be security issues. Therefore, such data can be trimmed to enhance data security.
[0038] In step 12, in response to reading the node set identifier, a node set corresponding to the node set identifier is determined.
[0039] As described above, during the reading process, if a string is read, it can be determined whether the string is a node set identifier. If the string is a node set identifier, it can be considered that the node set part in the memory snapshot file has been read. For example, the node set identifier can be nodes.
[0040] Optionally, step 12 may include the following steps: In response to reading the node set identifier, start reading the node corresponding to the node set identifier; In response to reading a node set end identifier, the read nodes are determined as a node set.
[0041] That is, when a node set identifier is read, it can be considered that a node set is about to be read. A node set can be composed of at least one node, wherein each node can be composed of a fixed number of node elements (i.e., an array composed of a fixed number of node elements), wherein the meaning represented by each node element can be specified in the memory snapshot protocol, so that the content represented by each node can be directly determined according to the protocol.
[0042] After reading the node set identifier, start reading the node corresponding to the node set identifier. Among them, the node set corresponds to a node set start identifier and a node set end identifier, and the node also corresponds to a node start identifier and a node end identifier. Therefore, the nodes contained in the node set can be read out in sequence through the above identifiers until the node set end identifier is read, and the reading of the node set is completed. For example, the node set start identifier can be "[", and the node set end identifier can be "]". For another example, the node start identifier can be "[", and the node end identifier can be "]".
[0043] In the above manner, by reading the node set identifier and determining the corresponding node set, the key data area in the memory snapshot can be effectively located, which is conducive to quickly locating the content that needs to be cropped later, while avoiding unnecessary processing of non-concern data.
[0044] In step 13, target index information is determined according to the target node in the node set.
[0045] The target node is a node whose data type is a preset type, and the target index information is used to indicate the index position of the target character string to be processed.
[0046] As mentioned above, in a node set, a node is composed of multiple node elements, and the multiple node elements include a first node element for indicating the data type of the node. Accordingly, the target node can be determined in the following manner: For each node in the node set, determining whether the first node element of the node indicates a string type; A node whose first node element indicates a string type is determined as a target node.
[0047] The first node element can represent the data type of the node, so that it can be directly determined whether the data type of the node is a string type. Furthermore, the target node in the node set can be quickly determined directly according to the data type represented by the first node element.
[0048] In this way, the target node that needs further processing can be quickly located through the first node element, which simplifies the identification process and reduces unnecessary data processing, which is conducive to improving the processing efficiency and accuracy of the memory snapshot file.
[0049] Optionally, the plurality of node elements further include a second node element for indicating an index position of a node. Accordingly, step 13 may include the following steps: The second node element of the target node is determined as the target index information.
[0050] After determining the target node of the string type, for each target node, the second node element of the target node may be added to the target index information.
[0051] Optionally, the target index information may be stored in a bitmap format.
[0052] By storing the target index information in the form of a bitmap in the above manner, efficient management and fast access to the index information can be achieved. The use of bitmaps reduces the storage space occupied and speeds up the retrieval of index information, thereby improving the overall processing efficiency of the memory snapshot file.
[0053] In step 14, the target character string in the initial data is trimmed according to the target index information to obtain a trimmed target memory snapshot file.
[0054] Optionally, step 14 may include the following steps: In response to reading the string set identifier, start reading the string corresponding to the string set identifier, each string corresponding to an index position; If the index position corresponding to the read string exists in the target index information, the read string is determined to be the target string; Trim the target string.
[0055] Optionally, according to the memory snapshot protocol, the structure of the memory snapshot file also includes a string set, the string set includes at least one string, and each string corresponds to an index position. The actual string of the string corresponding to the target node is recorded in the string set, so the actual string can be located in the string set according to the target index information determined in step 13.
[0056] Based on this, if a string set identifier is read, the strings contained in the string set can be read one by one. The rules for reading strings can refer to the rules for reading strings in the previous lexical analysis, that is, the content between the start symbol of the string and the end symbol of the string is used as the string to be read.
[0057] In the process of reading a string, the index position of the read string can be directly obtained. If the index position is recorded in the target index information, it means that the string may be a non-essential and marked string. Therefore, the string can be determined as the target string, and then the target string can be trimmed from the initial data of the target snapshot file. For example, in the process of streaming reading, if the target string is determined, the target string can be skipped, that is, the target string is not written to the character output stream, that is, the target string will not be written to the target memory snapshot file, thereby achieving the trimming of the target string.
[0058] In addition, if the index position corresponding to the read string does not exist in the target index information, the read string is retained. For example, during the streaming reading process, if it is determined that the read string is not the target string to be trimmed, the read string is directly written to the output stream and then written to the target memory snapshot file.
[0059] Through the above method, the target string is conditionally trimmed, which realizes the precise control of sensitive information in the memory snapshot file, and can ensure that only the string that really needs to be trimmed is processed, retaining the integrity of other important data, while reducing the file size.
[0060] Optionally, as mentioned above, a node may be composed of multiple node elements, including a second node element for indicating the index position of the node, and further, the multiple node elements may also include at least one third node element. Based on this, the method adopted by the present disclosure may also include the following steps: For each node in the node set, clip the third node element of the node; For a target node in the node set, the second node element of the target node is modified to zero.
[0061] The third node element usually represents unimportant data in the node, and the third node element can be specified according to actual needs. For example, if a node is composed of 8 node elements, the last 4 node elements can be used as the third node element.
[0062] For each node in the node set, the third node element of the node is pruned, that is, the third node element is not written into the target memory snapshot file. In this way, unimportant data in the node can be pruned.
[0063] For the target node in the node set, since the target index information has been determined, the second node element of the target node can also be modified to zero. In this way, the index information of the target node written to the target memory snapshot file is directly zero, which can reduce the space occupied by the index position of the target node.
[0064] By using the above method, the third node element of the node is trimmed and the second node element of the target node is modified to zero, which can further reduce the file size and ensure the thoroughness of the trimming operation, which is conducive to improving the security of file processing and preventing potential data insecurity issues.
[0065] Alternatively, in Java, you can use BufferedReader to read the input stream, BufferedWriter to write the output stream, and BitSet to implement the bitmap.
[0066] Through the above technical solution, the initial data of the memory snapshot file is read, and in response to the node set identifier being read, the node set corresponding to the node set identifier is determined, and then the target index information is determined according to the target node in the node set, the target node is a node whose data type is a preset type, and the target index information is used to indicate the index position of the target string to be processed, and then the target string in the initial data is trimmed according to the target index information to obtain a trimmed target memory snapshot file. Therefore, by trimming the target string, non-essential data in the memory snapshot file can be trimmed to prevent sensitive data from being leaked during the file upload process. And, by trimming the target string, unnecessary data in the memory snapshot file can be effectively reduced, thereby reducing the size of the target memory snapshot file finally obtained, and effectively reducing the resource consumption of storage and transmission.
[0067] Figure 2 is a block diagram of a memory snapshot file processing device provided according to an embodiment of the present disclosure. Figure 2 As shown, the memory snapshot file processing device 20 provided by the present disclosure includes: The reading module 21 is used to read the initial data of the memory snapshot file; A first determining module 22, configured to determine a node set corresponding to the node set identifier in response to reading the node set identifier; A second determination module 23, configured to determine target index information according to a target node in the node set, wherein the target node is a node whose data type is a preset type, and the target index information is used to indicate an index position of a target string to be processed; The first clipping module 24 is used to clip the target character string in the initial data according to the target index information to obtain a clipped target memory snapshot file.
[0068] Optionally, the reading module 21 is used to: The initial data of the memory snapshot file is stream-read in units of a preset number of characters.
[0069] Optionally, the first determining module 22 includes: A first reading submodule, configured to start reading a node corresponding to the node set identifier in response to reading the node set identifier; The first determining submodule is configured to determine the read nodes as the node set in response to reading a node set end identifier.
[0070] Optionally, a node is composed of multiple node elements, and the multiple node elements include a first node element for indicating a data type of the node; The target node is determined by the following modules: A third determination module is used to determine, for each node in the node set, whether a first node element of the node indicates a string type; The fourth determination module is used to determine the node whose first node element indicates a string type as the target node.
[0071] Optionally, the multiple node elements also include a second node element for indicating an index position of a node; The second determining module 23 is used to: The second node element of the target node is determined as target index information, and the target index information is stored in a bitmap format.
[0072] Optionally, the first cutting module 24 includes: A second reading submodule is used for, in response to reading the string set identifier, starting to read the string corresponding to the string set identifier, each string corresponding to an index position; A second determination submodule, configured to determine that the read character string is a target character string if the index position corresponding to the read character string exists in the target index information; The trimming submodule is used to trim the target character string.
[0073] Optionally, the device 20 further includes: The writing module is used for writing the escape character and a character read after the escape character into the target memory snapshot file in response to reading the escape character.
[0074] Optionally, a node is composed of a plurality of node elements, wherein the plurality of node elements include at least one third node element and a second node element for indicating an index position of the node; The device 20 further comprises: A second clipping module, used for clipping the third node element of each node in the node set; The modification module is used to modify the second node element of the target node in the node set to zero.
[0075] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0076] Based on the same inventive concept, the present disclosure also provides a computer-readable medium on which a computer program is stored. When the computer program is executed by a processing device, the steps of the method for processing a memory snapshot file described in any embodiment of the present disclosure are implemented.
[0077] Based on the same inventive concept, the present disclosure also provides an electronic device, including: a storage device having a computer program stored thereon; A processing device is used to execute the computer program in the storage device to implement the steps of the method for processing a memory snapshot file described in any embodiment of the present disclosure.
[0078] Based on the same inventive concept, the present disclosure also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method for processing a memory snapshot file described in any embodiment of the present disclosure.
[0079] Reference below Figure 3 , which shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 3The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0080] like Figure 3 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0081] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0082] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0083] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0084] In some embodiments, any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol) can be used for communication, and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0085] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0086] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: reads the initial data of the memory snapshot file; in response to reading the node set identifier, determines the node set corresponding to the node set identifier; determines the target index information according to the target node in the node set, the target node is a node with a preset data type, and the target index information is used to indicate the index position of the target string to be processed; according to the target index information, the target string in the initial data is cropped to obtain the cropped target memory snapshot file.
[0087] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0088] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0089] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a module does not limit the module itself in some cases. For example, a reading module may also be described as a "module for reading initial data of a memory snapshot file."
[0090] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that may be used include, without limitation, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0091] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0092] According to one or more embodiments of the present disclosure, a method for processing a memory snapshot file is provided, the method comprising: Read the initial data of the memory snapshot file; In response to reading the node set identifier, determining a node set corresponding to the node set identifier; Determine target index information according to a target node in the node set, the target node being a node whose data type is a preset type, and the target index information is used to indicate an index position of a target character string to be processed; The target character string in the initial data is trimmed according to the target index information to obtain a trimmed target memory snapshot file.
[0093] According to one or more embodiments of the present disclosure, a method for processing a memory snapshot file is provided, wherein the initial data of the memory snapshot file is read, including: The initial data of the memory snapshot file is stream-read in units of a preset number of characters.
[0094] According to one or more embodiments of the present disclosure, a method for processing a memory snapshot file is provided, wherein in response to reading a node set identifier, determining a node set corresponding to the node set identifier includes: In response to reading the node set identifier, starting to read the node corresponding to the node set identifier; In response to reading the node set end identifier, the read nodes are determined as the node set.
[0095] According to one or more embodiments of the present disclosure, a method for processing a memory snapshot file is provided, wherein a node is composed of a plurality of node elements, wherein the plurality of node elements include a first node element for indicating a data type of the node; The target node is determined by: For each node in the node set, determining whether the first node element of the node indicates a string type; A node whose first node element indicates a string type is determined as a target node.
[0096] According to one or more embodiments of the present disclosure, a method for processing a memory snapshot file is provided, wherein the plurality of node elements further includes a second node element for indicating an index position of a node; The determining target index information according to the target node in the node set includes: The second node element of the target node is determined as target index information, and the target index information is stored in a bitmap format.
[0097] According to one or more embodiments of the present disclosure, a method for processing a memory snapshot file is provided, wherein the target character string in the initial data is trimmed according to the target index information to obtain a trimmed target memory snapshot file, comprising: In response to reading the string set identifier, start reading the string corresponding to the string set identifier, each string corresponding to an index position; If the index position corresponding to the read character string exists in the target index information, determining that the read character string is the target character string; Trim the target string.
[0098] According to one or more embodiments of the present disclosure, a method for processing a memory snapshot file is provided, the method further comprising: In response to reading an escape character, the escape character and a character read after the escape character are written into the target memory snapshot file.
[0099] According to one or more embodiments of the present disclosure, a method for processing a memory snapshot file is provided, wherein a node is composed of a plurality of node elements, wherein the plurality of node elements include at least one third node element and a second node element for indicating an index position of the node; The method further comprises: For each node in the node set, clipping the third node element of the node; For a target node in the node set, a second node element of the target node is modified to zero.
[0100] According to one or more embodiments of the present disclosure, a device for processing a memory snapshot file is provided, the device comprising: The reading module is used to read the initial data of the memory snapshot file; A first determining module, configured to determine a node set corresponding to the node set identifier in response to reading the node set identifier; A second determination module is used to determine target index information according to a target node in the node set, wherein the target node is a node whose data type is a preset type, and the target index information is used to indicate an index position of a target string to be processed; The first clipping module is used to clip the target character string in the initial data according to the target index information to obtain a clipped target memory snapshot file.
[0101] According to one or more embodiments of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processing device, the steps of the method for processing a memory snapshot file described in any embodiment of the present disclosure are performed.
[0102] According to one or more embodiments of the present disclosure, there is provided an electronic device, including: a storage device having a computer program stored thereon; A processing device is used to execute the computer program in the storage device to implement the steps of the method for processing a memory snapshot file described in any embodiment of the present disclosure.
[0103] According to one or more embodiments of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps of the method for processing a memory snapshot file described in any embodiment of the present disclosure.
[0104] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0105] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0106] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. A method for processing a memory snapshot file, characterized in that: The method comprises: Read the initial data of the memory snapshot file; In response to reading the node set identifier, determining a node set corresponding to the node set identifier; Determine target index information according to a target node in the node set, the target node being a node whose data type is a preset type, and the target index information is used to indicate an index position of a target character string to be processed; The target character string in the initial data is trimmed according to the target index information to obtain a trimmed target memory snapshot file.
2. The method according to claim 1, characterized in that The reading of the initial data of the memory snapshot file includes: The initial data of the memory snapshot file is stream-read in units of a preset number of characters.
3. The method according to claim 1, characterized in that In response to reading the node set identifier, determining the node set corresponding to the node set identifier includes: In response to reading the node set identifier, starting to read the node corresponding to the node set identifier; In response to reading the node set end identifier, the read nodes are determined as the node set.
4. The method according to claim 1, characterized in that A node is composed of a plurality of node elements, wherein the plurality of node elements includes a first node element for indicating a data type of the node; The target node is determined by: For each node in the node set, determining whether the first node element of the node indicates a string type; A node whose first node element indicates a string type is determined as a target node.
5. The method according to claim 4, characterized in that The multiple node elements also include a second node element for indicating an index position of a node; The determining target index information according to the target node in the node set includes: The second node element of the target node is determined as target index information, and the target index information is stored in a bitmap format.
6. The method according to claim 1, characterized in that The step of trimming the target character string in the initial data according to the target index information to obtain a trimmed target memory snapshot file includes: In response to reading the string set identifier, start reading the string corresponding to the string set identifier, each string corresponding to an index position; If the index position corresponding to the read character string exists in the target index information, determining that the read character string is the target character string; Trim the target string.
7. The method according to claim 1, characterized in that The method further comprises: In response to reading an escape character, the escape character and a character read after the escape character are written into the target memory snapshot file.
8. The method according to claim 1, characterized in that A node is composed of a plurality of node elements, wherein the plurality of node elements include at least one third node element and a second node element for indicating an index position of the node; The method further comprises: For each node in the node set, clipping the third node element of the node; For a target node in the node set, a second node element of the target node is modified to zero.
9. A memory snapshot file processing device, characterized in that: The device comprises: The reading module is used to read the initial data of the memory snapshot file; A first determining module, configured to determine a node set corresponding to the node set identifier in response to reading the node set identifier; A second determination module is used to determine target index information according to a target node in the node set, wherein the target node is a node whose data type is a preset type, and the target index information is used to indicate an index position of a target string to be processed; The first clipping module is used to clip the target character string in the initial data according to the target index information to obtain a clipped target memory snapshot file.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processing device, the steps of the method according to any one of claims 1 to 8 are implemented.
11. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 8.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.