CN112631821A - Memory fault detection positioning method and device, computer equipment and storage medium - Google Patents

Memory fault detection positioning method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112631821A
CN112631821A CN202110114980.8A CN202110114980A CN112631821A CN 112631821 A CN112631821 A CN 112631821A CN 202110114980 A CN202110114980 A CN 202110114980A CN 112631821 A CN112631821 A CN 112631821A
Authority
CN
China
Prior art keywords
memory
fault
management structure
fault detection
memory management
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110114980.8A
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.)
Changsha Jingjia Microelectronics Co ltd
Original Assignee
Changsha Jingjia Microelectronics 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 Changsha Jingjia Microelectronics Co ltd filed Critical Changsha Jingjia Microelectronics Co ltd
Priority to CN202110114980.8A priority Critical patent/CN112631821A/en
Publication of CN112631821A publication Critical patent/CN112631821A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/073Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a memory management context, e.g. virtual memory or cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Debugging And Monitoring (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention is suitable for the technical field of computers, and provides a memory fault detection and positioning method, a device, computer equipment and a storage medium, wherein the method comprises the following steps: fault detection is carried out on the memory management structure positioned at the front end and/or the rear end of the used memory according to the memory fault detection rule, whether the system has memory faults or not is determined, and when the system is determined to have the memory faults, the used memory with the faults is determined according to the memory fault positioning rule, wherein the memory management structure is synchronously applied with the used memory in the process that a program applies the used memory to the system; the memory management structure at least comprises one or more of a characteristic identifier of the used memory, a content check code of the used memory and size information of the used memory. According to the memory fault detection and positioning method provided by the invention, the memory management structure is synchronously applied in the process of applying the program to the system for using the memory, and fault detection can be conveniently carried out on the memory management structure subsequently, so that the memory fault is determined.

Description

Memory fault detection positioning method and device, computer equipment and storage medium
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a memory fault detection and positioning method and device, computer equipment and a storage medium.
Background
Most programs in the embedded system relate to memory application, use and release. In the process, the memory use problems such as memory leakage, memory boundary crossing and the like easily occur. These problems may cause the whole system to malfunction, even the system is restarted, and the normal operation of the system is seriously affected. When the memory problem occurs, the phenomenon is often uncertain, and the occurrence condition and time are uncertain, so that the memory problem is difficult to locate. The traditional code detection tool can detect obvious memory leakage and memory boundary crossing problems, but for complex function codes, the traditional code detection tool cannot effectively detect under the condition of nesting of multi-level memory pointers.
Therefore, the method for detecting and positioning the memory fault in the embedded system in the prior art also has the technical problem of poor detection effect on the fault of the complex function code.
Disclosure of Invention
The embodiment of the invention aims to provide a memory fault detection and positioning method, and aims to solve the technical problem that the memory fault detection and positioning method in the embedded system in the prior art has poor detection effect on complex function code faults.
The embodiment of the invention is realized in such a way that a memory fault detection and positioning method is applied to an embedded system, and the memory fault positioning method comprises the following steps:
fault detection is carried out on the memory management structure at the front end and/or the rear end of the used memory according to a preset memory fault detection rule, and whether a system has a memory fault is determined; the memory management structure is synchronously applied with the memory in the process of applying the memory to the system by the program; the memory management structure at least comprises one or more of a characteristic identifier of the used memory, a content check code of the used memory and size information of the used memory;
and when the memory fault exists in the system, determining the used memory with the fault according to a preset memory fault positioning rule.
Another objective of an embodiment of the present invention is to provide a memory fault detection and location device, which is disposed in an embedded system, and the memory fault location device includes:
the memory fault detection unit is used for carrying out fault detection on the memory management structure at the front end and/or the rear end of the used memory according to a preset memory fault detection rule to determine whether a system has a memory fault; the memory management structure is synchronously applied with the memory in the process of applying the memory to the system by the program; the memory management structure at least comprises one or more of a characteristic identifier of the used memory, a content check code of the used memory and size information of the used memory;
and the memory fault positioning unit is used for determining the used memory with the fault according to a preset memory fault positioning rule when the memory fault exists in the system.
It is another object of the embodiments of the present invention to provide a computer device, which includes a storage and a processor, where the storage stores a computer program, and the computer program, when executed by the processor, causes the processor to execute the steps of the memory failure detection and location method.
It is another object of the embodiments of the present invention to provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the processor is enabled to execute the steps of the memory failure detection and location method.
The memory fault detection and positioning method provided by the embodiment of the invention is applied to an embedded system, and is characterized in that a memory management process is established, fault detection is carried out on a memory management structure positioned at the front end and/or the rear end of a used memory according to a preset period and a preset memory fault detection rule in the process, whether the memory fault exists in the system is determined, wherein the memory management structure is synchronously applied with the used memory in the process of applying the used memory to the system by a program and at least comprises one or more of a characteristic identifier of the used memory, a content check code of the used memory and size information of the used memory, and when the memory fault exists in the system, the used memory with the fault is determined according to the preset memory fault positioning rule. The memory fault detection positioning method provided by the invention synchronously applies for the memory management structure in the process of applying for using the memory from a program to a system, and writes one or more of the characteristic identifier of the used memory, the content check code of the used memory and the size information of the used memory into the memory management structure, so that the memory management structure at the front end and/or the rear end of the used memory can be subsequently and conveniently subjected to fault detection according to the preset memory fault detection rule, thereby determining the memory fault corresponding to the information written into the memory management structure.
Drawings
Fig. 1 is a flowchart illustrating steps of a memory fault detection and location method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating steps of a method for detecting and positioning a memory out-of-range fault according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating steps of another method for detecting and locating a memory out-of-range fault according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating steps of a method for detecting unexpected memory modification faults according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating steps of another method for detecting unexpected memory modification faults according to an embodiment of the present invention;
fig. 6 is a flowchart illustrating steps of a method for detecting a memory leak fault according to an embodiment of the present invention;
fig. 7 is a flowchart illustrating steps of a method for applying for a memory management structure according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a memory fault detection and location apparatus according to an embodiment of the present invention;
fig. 9 is an internal structural diagram of a computer device for executing a memory fault detection and location method according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention aims to solve the problem that the memory fault is difficult to detect and position in the existing embedded system, and the memory management program is used for realizing the management of the memory, specifically, when the memory request program applies for the memory, the memory is applied by the memory management program, at the moment, the SIZE of the memory actually applied by the memory management program and the system is equal to the SIZE of the memory (SIZE) required by the memory request program and the SIZE of one or two memory management structures, the memory management structures are positioned at the front end or the rear end of the memory required by the program, and when the front end or the rear end of the memory is provided with the memory management structures, the contents of the front memory management structure and the rear memory management structure are the same. Meanwhile, while storing the program data into the requested memory, the data management information related to the program data is synchronously stored into the memory management structure, so that the subsequent memory management program can create an independent memory management process, thus, the memory management process performs fault detection on the data management information stored in the memory management structure according to the preset memory fault detection rule to determine whether the system has a memory fault and can further determine the memory with the fault, when the data management information stored in the memory management structure is different, the memory fault detection rules executed by the memory management process are different, the detected memory faults are different, and the subsequent discussion can be specifically referred to.
As shown in fig. 1, a flowchart of steps of a memory fault detection and location method provided in an embodiment of the present invention specifically includes the following steps.
Step S102, fault detection is carried out on the memory management structure at the front end and/or the back end of the used memory according to a preset memory fault detection rule, and whether a memory fault exists in the system is determined.
In the embodiment of the present invention, the memory management structure is applied synchronously with the use of the memory in the process of applying the use of the memory from the program to the system, and reference may be specifically made to the foregoing description. For the step of synchronously applying for the memory management structure in the process of applying for using the memory from the program to the system, please refer to the following fig. 7 and the explanation thereof.
In the embodiment of the present invention, the memory management structure at least includes one or more of a feature identifier of the used memory, a content check code of the used memory, and size information of the used memory, and in addition, the memory management structure may further include location information of a memory application interface, last update time of the used memory, and the like.
In the embodiment of the present invention, according to different information contained in the memory management structure, common memory failures that can be determined mainly include a memory out-of-range failure, a memory accidental modification failure, a memory leak failure, and the like. Reference may be made to fig. 2 to 6 and the explanation thereof.
And step S104, when the memory fault exists in the system, determining the used memory with the fault according to a preset memory fault positioning rule.
In the embodiment of the present invention, similarly, when it is determined that a memory fault exists in the system, it may further determine, according to the memory management structure using the memory with the fault, that the memory with the fault exists, and especially, the memory out-of-range fault often causes the memory management structures of the plurality of memories to be damaged, where an implementation scheme for determining that a source of the memory out-of-range fault exists may specifically refer to fig. 3 and the explanation thereof.
The memory fault detection and positioning method provided by the embodiment of the invention is applied to an embedded system, and is characterized in that a memory management process is established, fault detection is carried out on a memory management structure positioned at the front end and/or the rear end of a used memory according to a preset period and a preset memory fault detection rule in the process, whether the memory fault exists in the system is determined, wherein the memory management structure is synchronously applied with the used memory in the process of applying the used memory to the system by a program and at least comprises one or more of a characteristic identifier of the used memory, a content check code of the used memory and size information of the used memory, and when the memory fault exists in the system, the used memory with the fault is determined according to the preset memory fault positioning rule. The memory fault detection positioning method provided by the invention synchronously applies for the memory management structure in the process of applying for using the memory from a program to a system, and writes one or more of the characteristic identifier of the used memory, the content check code of the used memory and the size information of the used memory into the memory management structure, so that the memory management structure at the front end and/or the rear end of the used memory can be conveniently subjected to fault detection subsequently according to the preset memory fault detection rule, thereby determining the memory fault corresponding to the information written into the memory management structure.
As shown in fig. 2, a flowchart of steps of a method for detecting and positioning a memory out-of-range fault according to an embodiment of the present invention specifically includes the following steps.
Step S202, determine whether there is a memory management structure with a damaged feature identifier. When it is determined that the memory management structure with the damaged feature identifier exists, step S204 is executed. And executing other steps when judging that the memory management structure with the damaged characteristic identifier does not exist.
In the embodiment of the present invention, a step flow chart of a method for detecting and positioning a memory out-of-range fault is provided, where the memory management structure includes a feature identifier of a used memory, and both a front end and a back end of the used memory have a memory management structure.
In the embodiment of the invention, when the memory has the boundary crossing fault, the access can cross the memory management structure at the rear end of the memory at the moment, so that the characteristic identifier in the memory management structure is damaged, and therefore, whether the memory boundary crossing fault exists can be judged by judging whether the memory management structure with the damaged characteristic identifier exists. The step of executing other steps generally refers to waiting for the next cycle to determine whether there is a memory management structure with a damaged characteristic identifier.
Step S204, determining the used memory corresponding to the damaged characteristic mark.
In the embodiment of the present invention, it is obvious that when it is determined that there is a memory management structure with a damaged feature identifier, a used memory corresponding to the damaged feature identifier may be determined, but it should be noted that, because a memory out-of-range fault often causes the feature identifiers in a plurality of memory management structures using the memory to be damaged, it is further necessary to trace back to the source according to a preset memory fault location rule to determine a source of the memory out-of-range fault, which is specifically shown in the following step S206.
Step S206, determine whether the feature identifier in the currently determined front-end memory management structure using the memory is damaged. When judging that the feature identifier in the currently determined front-end memory management structure using the memory is damaged, executing step S208; when it is determined that the feature identifier in the currently determined front-end memory management structure using the memory is not damaged, step S210 is executed.
In the embodiment of the present invention, it is considered that a feature identifier in a front memory management structure using a memory is damaged to indicate that there is a problem in the last memory used, and a feature identifier in a front memory management structure using a memory is not damaged and a feature identifier in a rear memory management structure is damaged to indicate that there is a problem in the access of the memory. Therefore, based on the above principle, it is possible to determine whether the last used memory has a fault or the currently used memory has a fault by determining whether the feature identifier in the currently determined front-end memory management structure using the memory is damaged.
In step S208, the last used memory of the currently determined used memory is determined as the currently determined used memory again, and the process returns to step S206.
In the embodiment of the present invention, if it is determined that the feature identifier in the front-end memory management structure of the currently determined used memory is damaged, it indicates that the last used memory has a fault, and therefore, the pointer points to the last used memory, and the step returns to step S206 to perform detection again.
Step S210, it is determined that there is a memory out-of-range fault in the currently determined used memory.
In the embodiment of the present invention, obviously, when it is determined that the currently determined front-end memory management structure using the memory is not damaged, it indicates that there is a problem in the access of the memory, that is, there is a memory out-of-range fault in the used memory, that is, a memory access out-of-range fault.
Fig. 3 is a flowchart illustrating steps of another method for detecting and locating a memory out-of-range fault according to an embodiment of the present invention, which is described in detail below.
In the embodiment of the present invention, the difference from the step flowchart of the memory boundary crossing fault detecting and positioning method shown in fig. 2 is that after the step S210, the method further includes:
step S302, determining a program code segment having a memory boundary crossing fault according to the location information of the calling memory application interface in the memory management structure using the memory having the memory boundary crossing fault.
In the embodiment of the present invention, further, the memory management structure further includes location information for calling a memory application interface, where the location information mainly includes information such as a code file name, a function name, and a number of rows, so that a program code segment having a memory boundary crossing fault can be determined according to the location information for calling the memory application interface in the memory management structure using a memory having a memory boundary crossing fault, which facilitates subsequent modification of a program.
As shown in fig. 4, a flowchart of steps of a method for detecting a fault caused by accidental modification of a memory according to an embodiment of the present invention specifically includes the following steps:
step S402, verifying the memory data according to a preset verification rule and determining a verification result.
In the embodiment of the invention, a method for detecting a fault of accidental memory modification is provided, wherein a memory management structure comprises a content check code using a memory, the content check code is obtained under a preset known check rule, the content check code is correspondingly updated every time memory data is normally updated, and when the memory data is accidentally modified, the content check code is not normally updated. Therefore, the memory data is verified through the preset verification rule, the verification result is determined, and the verification result is compared with the content verification code in the memory management structure, so that whether the memory data is accidentally modified or not can be determined.
And step S404, determining whether the system has the memory accidental modification fault according to the determination of whether the verification result is the same as the content verification code.
In the embodiment of the present invention, it is obvious that when the verification result of each memory is the same as the content verification code in the memory management structure corresponding to the memory, the system does not have a memory accidental modification fault, otherwise, the system indicates that the corresponding memory has an accidental modification fault.
Fig. 5 is a flowchart illustrating steps of another method for detecting an unexpected memory modification fault according to an embodiment of the present invention, which is described in detail below.
In the embodiment of the present invention, the difference from the step flowchart of the method for detecting a fault of accidental memory modification shown in fig. 4 is that after the step S404, the method further includes:
step S502, when the system is determined to have the memory accidental modification fault, determining the accidental modification time of the used memory according to the last update time of the used memory.
In the embodiment of the present invention, further, the memory management structure further includes a last update time of the used memory, that is, the last update time of the used memory is updated after the memory is updated each time, and when it is determined that a memory accidental modification fault exists in the system, the time of the used memory being accidentally modified can be determined according to the last update time of the used memory, and further, a possible reason why the used memory is accidentally modified can be determined by combining with an actual service scenario.
As shown in fig. 6, a flowchart of steps of a method for detecting a memory leak fault according to an embodiment of the present invention specifically includes the following steps:
step S602, determining the total size of the used memory according to the size information of the used memory in the memory management structure of the front end and/or the back end of the used memory.
In the embodiment of the present invention, the memory management structure includes information about the size of the used memory, and specifically, the memory management program further creates a memory usage statistical table for counting the situation of the used memory, that is, summing the information about the size of the used memory to determine the total size of the used memory.
Step S604, determining whether the total size of the used memory exceeds a preset threshold. When the total size of the used memory is judged to exceed the preset threshold value, executing step S606; and executing other steps when the total size of the used memory is judged not to exceed a preset threshold value.
In the embodiment of the present invention, under normal conditions, after the application and use of the memory are finished, the memory is usually released by the corresponding memory application program, so that the subsequent program further applies for the memory, however, due to various factors, after the application of the memory is finished, the memory is not effectively released, the space is occupied, the subsequent program cannot apply for the corresponding memory any more, and as time passes, more and more memories are not effectively released, and the memory space available for use is less and less, and a memory leakage fault occurs. The invention identifies the memory leakage fault by monitoring the use size of the total memory.
Step S606, it is determined that the system has a memory leak fault.
In the embodiment of the invention, when the total size of the used memories is judged to exceed the preset threshold value, a large number of memories are considered to be occupied, and the memory leakage fault exists at a high possibility, namely the memory leakage fault exists in the system, and the user is reminded by outputting the warning information.
As shown in fig. 7, a flowchart of steps of a method for applying for a memory management structure according to an embodiment of the present invention specifically includes the following steps:
in step S702, a request for applying for using a memory including program use data is obtained.
In the embodiment of the present invention, in a conventional embedded system, a memory application program directly initiates a request through an interface first to a memory, and in the technical scheme disclosed in the present invention, a memory management program is added between the memory application program and the memory, so that the memory application program can initiate a request to the memory only through the memory management program, that is, the memory management program will first obtain a request for applying a memory initiated by the memory application program. Specifically, a memory management interface (such as malloc, ralloc, free) provided by the original system is encapsulated, and the encapsulated memory management interface calls the memory management interface of the original system, so that the memory is managed.
Step S704, determining corresponding memory management information according to the program usage data.
In the embodiment of the present invention, the memory management program may determine the corresponding memory management information according to the program usage data included in the request for applying for using the memory initiated by the memory application program, so as to facilitate subsequent management of the program usage data, and the specific management may refer to the contents in fig. 2 to fig. 6.
Step S706, writing the program usage data into the corresponding used memory, creating a memory management structure at the front end and/or the back end of the used memory, and writing the memory management information.
In the embodiment of the present invention, the memory management program simultaneously applies for the memory SIZE equal to the external required memory SIZE (SIZE) plus the SIZE of one or two memory management structures, creates a memory management structure at the front end and/or the back end of the memory, writes the program use data into the corresponding used memory, and writes the memory management information into the one or two memory management structures. Whether one memory management structure or two memory management structures are applied can be actually defined according to user requirements, and certainly two memory management structures are preferably applied.
In the embodiment of the present invention, in order to better manage the memory, the memory manager may further create a separate memory maintenance data structure (which may be a linked list, a tree, or other data structure). When a user applies for the memory, the memory application event is added to the memory maintenance data structure, and the memory maintenance data structure is sorted according to the memory address.
In an embodiment of the present invention, the memory management program creates a memory usage statistics table. The method is used for recording the information of time interval, total memory application size, in-use memory size, memory application speed and the like of each process applying the memory, and then recording the information of time interval, total memory application size, in-use memory size, memory application speed and the like of each calling memory application interface position applying the memory, thereby facilitating the subsequent diagnosis of the fault.
In the embodiment of the present invention, the memory management program creates an independent memory management process, and the process is executed according to the steps shown in fig. 1 to fig. 6, so as to implement detection and positioning of a part of memory faults.
As shown in fig. 8, a schematic structural diagram of a memory fault detection and location apparatus provided in an embodiment of the present invention specifically includes the following units.
The memory fault detection unit 810 is configured to perform fault detection on the memory management structures located at the front end and/or the back end of the used memory according to a preset memory fault detection rule, and determine whether a memory fault exists in the system.
In the embodiment of the present invention, the memory management structure is applied synchronously with the use of the memory in the process of applying the use of the memory from the program to the system, and reference may be specifically made to the foregoing description. For the step of synchronously applying for the memory management structure in the process of applying for using the memory from the program to the system, please refer to the following fig. 7 and the explanation thereof.
In the embodiment of the present invention, the memory management structure at least includes one or more of a feature identifier of the used memory, a content check code of the used memory, and size information of the used memory, and in addition, the memory management structure may further include location information of a memory application interface, last update time of the used memory, and the like.
In the embodiment of the present invention, according to different information contained in the memory management structure, common memory failures that can be determined mainly include a memory out-of-range failure, a memory accidental modification failure, a memory leak failure, and the like. In particular, reference may be made to fig. 2-6 and their explanation.
And a memory fault location unit 820, configured to determine, according to a preset memory fault location rule, that there is a fault in the used memory when it is determined that there is a memory fault in the system.
In the embodiment of the present invention, similarly, when it is determined that a memory fault exists in the system, it may further determine, according to the memory management structure using the memory with the fault, that the memory with the fault exists, and especially, the memory out-of-range fault often causes the memory management structures of the plurality of memories to be damaged, where an implementation scheme for determining that a source of the memory out-of-range fault exists may specifically refer to fig. 3 and the explanation thereof.
The memory fault detection positioning device provided by the embodiment of the invention is arranged in an embedded system, and is used for detecting faults of a memory management structure at the front end and/or the rear end of a used memory according to a preset period and a preset memory fault detection rule in the process by establishing a memory management process to determine whether the system has the memory fault, wherein the memory management structure is synchronously applied with the used memory in the process of applying the used memory to the system by a program and at least comprises one or more of a characteristic identifier of the used memory, a content check code of the used memory and size information of the used memory, and when the system is determined to have the memory fault, the used memory with the fault is determined according to the preset memory fault positioning rule. The memory fault detection positioning device provided by the invention synchronously applies for the memory management structure in the process of applying for using the memory from a program to a system, and writes one or more of the characteristic identifier of the used memory, the content check code of the used memory and the size information of the used memory into the memory management structure, so that the memory management structure at the front end and/or the rear end of the used memory can be conveniently subjected to fault detection subsequently according to the preset memory fault detection rule, and the memory fault corresponding to the information written into the memory management structure is determined.
FIG. 9 is a diagram illustrating an internal structure of a computer device in one embodiment. As shown in fig. 9, the computer apparatus includes a processor, a memory, a network interface, an input device, and a display screen connected through a system bus. Wherein the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and also stores a computer program, and when the computer program is executed by a processor, the computer program can enable the processor to realize the memory fault detection and positioning method. The internal memory may also have a computer program stored therein, which when executed by the processor, causes the processor to perform the memory failure detection and location method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 9 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, the memory fault detection and location apparatus provided in the present application may be implemented in the form of a computer program, and the computer program may be run on a computer device as shown in fig. 9. The memory of the computer device may store various program modules constituting the memory failure detection and location apparatus, such as the memory failure detection unit 810 and the memory failure location unit 820 shown in fig. 8. The computer program formed by the program modules enables the processor to execute the steps in the memory fault detection and location method according to the embodiments of the present application described in the present specification.
For example, the computer device shown in fig. 9 may execute step S102 through the memory failure detection unit 810 in the memory failure detection positioning apparatus shown in fig. 8; the computer device may execute step S104 through the memory fault location unit 820.
In one embodiment, a computer device is proposed, the computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
fault detection is carried out on the memory management structure at the front end and/or the rear end of the used memory according to a preset memory fault detection rule, and whether a system has a memory fault is determined; the memory management structure is synchronously applied with the memory in the process of applying the memory to the system by the program; the memory management structure at least comprises one or more of a characteristic identifier of the used memory, a content check code of the used memory and size information of the used memory;
and when the memory fault exists in the system, determining the used memory with the fault according to a preset memory fault positioning rule.
In one embodiment, a computer readable storage medium is provided, having a computer program stored thereon, which, when executed by a processor, causes the processor to perform the steps of:
fault detection is carried out on the memory management structure at the front end and/or the rear end of the used memory according to a preset memory fault detection rule, and whether a system has a memory fault is determined; the memory management structure is synchronously applied with the memory in the process of applying the memory to the system by the program; the memory management structure at least comprises one or more of a characteristic identifier of the used memory, a content check code of the used memory and size information of the used memory;
and when the memory fault exists in the system, determining the used memory with the fault according to a preset memory fault positioning rule.
It should be understood that, although the steps in the flowcharts of the embodiments of the present invention are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in various embodiments may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. A memory fault detection positioning method is applied to an embedded system, and comprises the following steps:
fault detection is carried out on the memory management structure at the front end and/or the rear end of the used memory according to a preset memory fault detection rule, and whether a system has a memory fault is determined; the memory management structure is synchronously applied with the memory in the process of applying the memory to the system by the program; the memory management structure at least comprises one or more of a characteristic identifier of the used memory, a content check code of the used memory and size information of the used memory;
and when the memory fault exists in the system, determining the used memory with the fault according to a preset memory fault positioning rule.
2. The memory fault detection and location method according to claim 1, wherein the memory management structure includes a feature identifier using a memory; the front end and the back end of the used memory both have a memory management structure; the method comprises the following steps of carrying out fault detection on a memory management structure at the front end and/or the rear end of a used memory according to a preset memory fault detection rule to determine whether a memory fault exists in a system, and specifically comprises the following steps:
judging whether a memory management structure with damaged characteristic identification exists or not;
when judging that the memory management structure with the damaged characteristic identification exists, determining that the system has a memory out-of-range fault;
when the memory fault exists in the system, the step of determining the used memory with the fault according to the preset memory fault positioning rule specifically comprises the following steps:
when the memory out-of-range fault exists in the system, determining a used memory corresponding to the damaged characteristic identifier;
judging whether the feature identifier in the front-end memory management structure of the currently determined used memory is damaged or not;
when judging that the feature identifier in the front-end memory management structure of the currently determined used memory is damaged, re-determining the last used memory of the currently determined used memory as the currently determined used memory, and returning to the step of judging whether the feature identifier in the front-end memory management structure of the currently determined used memory is damaged;
and when judging that the characteristic mark in the front-end memory management structure of the used memory is not damaged, determining that the currently determined used memory has a memory out-of-range fault.
3. The memory fault detection and location method according to claim 2, wherein the memory management structure further includes location information for calling a memory application interface; the position information comprises a code file name, a function name and a line number; after the step of determining that the currently determined memory usage has the memory out-of-range fault, the method further includes:
and determining the program code segment with the memory boundary crossing fault according to the position information of the calling memory application interface in the memory management structure using the memory with the memory boundary crossing fault.
4. The memory fault detection and location method according to claim 1, wherein the memory management structure includes a content check code using a memory; the method comprises the following steps of carrying out fault detection on a memory management structure at the front end and/or the rear end of a used memory according to a preset memory fault detection rule to determine whether a memory fault exists in a system, and specifically comprises the following steps:
verifying the memory data according to a preset verification rule to determine a verification result;
and determining whether the system has the memory accidental modification fault according to the determination of whether the verification result is the same as the content verification code.
5. The method according to claim 4, wherein the memory management structure further comprises a last update time of using the memory; when the memory fault exists in the system, the step of determining the used memory with the fault according to the preset memory fault positioning rule specifically comprises the following steps:
and when the system is determined to have the memory accidental modification fault, determining the accidental modification time of the used memory according to the last updating time of the used memory.
6. The memory fault detection and location method according to claim 1, wherein the memory management structure includes size information of the used memory; the method comprises the following steps of carrying out fault detection on a memory management structure at the front end and/or the rear end of a used memory according to a preset memory fault detection rule to determine whether a memory fault exists in a system, and specifically comprises the following steps:
determining the total size of the used memory according to the size information of the used memory in the memory management structure of the front end and/or the back end of the used memory;
judging whether the total size of the used memory exceeds a preset threshold value or not;
and when the total size of the used memory is judged to exceed a preset threshold value, determining that the system has a memory leakage fault.
7. The method according to claim 1, wherein the step of synchronously applying for the memory management structure in the process of applying for using the memory from the system by the program specifically comprises:
acquiring a request for applying for using a memory, which comprises program using data;
determining corresponding memory management information according to the program use data; the memory management information at least comprises a characteristic identifier of the program use data, a content check code of the program use data and size information of the program use data;
and writing the program use data into a corresponding use memory, creating a memory management structure at the front end and/or the back end of the use memory, and writing memory management information.
8. A memory fault detection positioning device is characterized in that the memory fault detection positioning device is arranged in an embedded system, and the memory fault detection positioning device comprises:
the memory fault detection unit is used for carrying out fault detection on the memory management structure at the front end and/or the rear end of the used memory according to a preset memory fault detection rule to determine whether a system has a memory fault; the memory management structure is synchronously applied with the memory in the process of applying the memory to the system by the program; the memory management structure at least comprises one or more of a characteristic identifier of the used memory, a content check code of the used memory and size information of the used memory;
and the memory fault positioning unit is used for determining the used memory with the fault according to a preset memory fault positioning rule when the memory fault exists in the system.
9. A computer device comprising a memory and a processor, the memory having stored therein a computer program that, when executed by the processor, causes the processor to perform the steps of the memory failure detection and location method of any one of claims 1 to 7.
10. A computer-readable storage medium, having a computer program stored thereon, which, when executed by a processor, causes the processor to perform the steps of the memory failure detection and location method of any one of claims 1 to 7.
CN202110114980.8A 2021-01-28 2021-01-28 Memory fault detection positioning method and device, computer equipment and storage medium Pending CN112631821A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110114980.8A CN112631821A (en) 2021-01-28 2021-01-28 Memory fault detection positioning method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110114980.8A CN112631821A (en) 2021-01-28 2021-01-28 Memory fault detection positioning method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112631821A true CN112631821A (en) 2021-04-09

Family

ID=75295554

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110114980.8A Pending CN112631821A (en) 2021-01-28 2021-01-28 Memory fault detection positioning method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112631821A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113157513A (en) * 2021-05-10 2021-07-23 北京字节跳动网络技术有限公司 Heap memory damage detection method and device, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101097542A (en) * 2007-07-17 2008-01-02 中兴通讯股份有限公司 Method and device for rapid positioning EMS memory off-normal
CN101625659A (en) * 2009-07-03 2010-01-13 无敌科技(西安)有限公司 Method for monitoring memory in real time by embedded system
CN102214147A (en) * 2011-06-29 2011-10-12 深圳市五巨科技有限公司 Method and device for detecting transborder memory access
CN105528304A (en) * 2015-12-03 2016-04-27 盛趣信息技术(上海)有限公司 Memory pool management method
CN105988921A (en) * 2015-02-06 2016-10-05 中兴通讯股份有限公司 Method and device for detecting out of range problem of memory
CN107194250A (en) * 2017-03-31 2017-09-22 武汉斗鱼网络科技有限公司 The integrity checking method and device of internal storage code
CN109086205A (en) * 2018-07-25 2018-12-25 郑州云海信息技术有限公司 The EMS memory error adjustment method and device in pond based on memory

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101097542A (en) * 2007-07-17 2008-01-02 中兴通讯股份有限公司 Method and device for rapid positioning EMS memory off-normal
CN101625659A (en) * 2009-07-03 2010-01-13 无敌科技(西安)有限公司 Method for monitoring memory in real time by embedded system
CN102214147A (en) * 2011-06-29 2011-10-12 深圳市五巨科技有限公司 Method and device for detecting transborder memory access
CN105988921A (en) * 2015-02-06 2016-10-05 中兴通讯股份有限公司 Method and device for detecting out of range problem of memory
CN105528304A (en) * 2015-12-03 2016-04-27 盛趣信息技术(上海)有限公司 Memory pool management method
CN107194250A (en) * 2017-03-31 2017-09-22 武汉斗鱼网络科技有限公司 The integrity checking method and device of internal storage code
CN109086205A (en) * 2018-07-25 2018-12-25 郑州云海信息技术有限公司 The EMS memory error adjustment method and device in pond based on memory

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113157513A (en) * 2021-05-10 2021-07-23 北京字节跳动网络技术有限公司 Heap memory damage detection method and device, electronic equipment and storage medium
CN113157513B (en) * 2021-05-10 2024-06-18 北京字节跳动网络技术有限公司 Heap memory damage detection method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN102831068B (en) A kind of disposal route of internal memory operation record and device
CN104685474B (en) For the method for handling not repairable EMS memory error and non-transient processor readable medium
CN106919454B (en) Memory pool problem positioning method and system based on LTE protocol stack
CN112035472A (en) Data processing method, data processing device, computer equipment and storage medium
CN108664394B (en) Memory leakage process tracing method and device
CN109753378A (en) A kind of partition method of memory failure, device, system and readable storage medium storing program for executing
CN110674145B (en) Data consistency detection method, device, computer equipment and storage medium
CN112835528A (en) Dirty page refreshing method and device, electronic equipment and storage medium
US11822419B2 (en) Error information processing method and device, and storage medium
CN110147354B (en) Batch data editing method, device, computer equipment and storage medium
CN112631821A (en) Memory fault detection positioning method and device, computer equipment and storage medium
CN105183799B (en) Authority management method and client
CN112153375B (en) Front-end performance testing method, device, equipment and medium based on video information
CN111966461B (en) Virtual machine cluster node guarding method, device, equipment and storage medium
EP2645249A1 (en) Information processing apparatus, and method of controlling information processing apparatus
CN113312205B (en) Data verification method and device, storage medium and computer equipment
CN110569167B (en) Webpage alarm monitoring method, script error reporting method, device and computer equipment
CN111090701A (en) Service request processing method and device, readable storage medium and computer equipment
CN115470155A (en) L2P table caching method and device supporting solid state disk multi-scene multiplexing
CN115545235A (en) Power restoration method and device, computer equipment and storage medium
CN115269252A (en) Application program fault processing method, device, equipment and storage medium
CN115437571A (en) Data writing method and device, computer equipment and storage medium
CN114138734A (en) Web-based version management method facing database and file resource
CN113470725A (en) Method and device for testing dynamic random access memory
CN113688048B (en) Application stability detection method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210409