Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Positioning method and system for memory leak

A technology of memory leakage and positioning method, which is applied in the direction of instruments, electrical digital data processing, calculation, etc., and can solve the problems that users cannot know about errors, memory cannot be reused, memory leaks, etc.

Inactive Publication Date: 2017-06-13
SHENZHEN YIHUA COMP +2
View PDF3 Cites 8 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

A memory leak does not refer to the physical disappearance of memory, but rather the loss of control over a certain segment of memory due to a program design error after the application allocates a certain segment of memory, resulting in the failure of this segment of memory to be used again, resulting in a waste of memory
[0003] A small memory leak may not require too much attention, but if the program leaks large blocks of memory, or incrementally leaks memory, it will cause the following symptoms: first system performance degradation, and then cause complex memory exhaustion errors; worst case Yes, a memory leaking program may use up a lot of memory and cause other programs to fail, and the user cannot know where the error is coming from
Also, a seemingly innocuous memory leak may be a harbinger of another problem

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Positioning method and system for memory leak
  • Positioning method and system for memory leak
  • Positioning method and system for memory leak

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0045] figure 1 It is a flow chart of a method for locating a memory leak provided by Embodiment 1 of the present invention. This method is applicable to the situation of quickly searching and locating the memory leaked in the program during the program debugging stage, and can be executed by a memory leak locating system. . The system can be realized by means of hardware and / or software. The method specifically includes the following steps:

[0046] Step 110 , when the memory application operation is detected, obtain the identity information of memory allocated for the application.

[0047] Usually, there are many existing standard library functions that can be called directly according to the programming language used. Therefore, the library function that realizes a specific function can be directly called in the software program. When there is no required library function, it can also be called. Customize some functional functions, and call the corresponding functional f...

Embodiment 2

[0060] figure 2 It is a schematic flowchart of a method for locating memory leaks provided by Embodiment 2 of the present invention. On the basis of Embodiment 1, this embodiment further optimizes the method. For details, see figure 2 As shown, the method specifically includes the following:

[0061] Step 210, when it is detected that a memory application function is called to apply for memory, determine that there is an operation to apply for memory.

[0062] Step 220, obtain the identity information of the memory allocated for the application by overloading the memory application function.

[0063] Among them, an overloaded function is a special case of a function, that is, it is allowed to declare several functions with the same name and similar functions in the same declaration domain, but the formal parameters of these functions with the same name must be different, and the formal parameters can specifically refer to individual parameters Number, type, or order, etc.,...

Embodiment 3

[0072] image 3 It is a schematic flowchart of a method for locating memory leaks provided by Embodiment 3 of the present invention. On the basis of the above-mentioned embodiments, this embodiment has been further optimized. For details, see image 3 As shown, the method is as follows:

[0073] Step 310 , when the memory application operation is detected, obtain the identity information of memory allocated for the application.

[0074] Step 320: Save the identity information in a preset circular linked list node, and generate node information.

[0075] Step 330 , when it is detected that a memory release function is called to release memory, determine that there is a memory release operation.

[0076] Step 340, obtain the identity information of the released memory by overloading the memory release function.

[0077] Step 350: Traverse the circular linked list according to the identity information of the freed memory, search for node information matching the released memor...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a positioning method and system for memory leak. The positioning method comprises when detecting an memory operation application, acquiring an identity information of a memory allocation aiming at the application; saving the identity information in a preset circular link list node to generate node information; when detecting freeing memory operation, traversing the circular link list according to the identity information of freeing memory, researching the node information matched with the identity information of freeing memory and deleting the reached node information from the circular link list; locating leak memory according to the rest node information of the circular link list. The positioning method and system for memory leak realizes locating the target of source code location of the memory leak fast and effectively.

Description

technical field [0001] The embodiments of the present invention relate to the technical field of testing, and in particular to a method and system for locating memory leaks. Background technique [0002] In computer science, a memory leak is a situation in which, due to inadvertence or error, a program fails to free memory that is no longer in use. A memory leak does not refer to the physical disappearance of memory, but rather the loss of control over a certain segment of memory due to a program design error after the application allocates a certain segment of memory, resulting in the failure of this segment of memory to be used again, resulting in a waste of memory . [0003] A small memory leak may not require too much attention, but if the program leaks large blocks of memory, or incrementally leaks memory, it will cause the following symptoms: first system performance degradation, and then cause complex memory exhaustion errors; worst case Yes, a memory leaking progra...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F11/36
CPCG06F11/3636
Inventor 蒋玉萍
Owner SHENZHEN YIHUA COMP
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products