Check patentability & draft patents in minutes with Patsnap Eureka AI!

A method and a device for detecting memory leakage of an object

A memory leak and object detection technology, applied in the computer field, can solve problems such as count mismatch, cumbersome, object memory leaks, etc., and achieve the effect of easy bug repair

Pending Publication Date: 2019-05-03
珠海西山居互动娱乐科技有限公司 +1
View PDF5 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] 1) When a circular reference occurs, the object may not be released correctly (when object A and object B refer to each other as their own member variables, and only when they are destroyed by themselves, the reference count of the member variable can be reduced by 1, because the object The destruction of A depends on the destruction of object B, and the destruction of object B depends on the destruction of object A, which causes circular references, even if no external pointer can access them, they still cannot be released)
[0005] 2) Since the objects are referenced layer by layer, when it is very complex, the reference count mismatch may occur due to improper operation. Once it occurs, some objects will never be released and cause memory leaks
[0006] When a memory leak occurs, it is extremely difficult to find the root cause of the problem. The commonly used tool umdh can often only locate which line of code causes the memory leak, but how the leak occurs, you need to read the context of the line of code, and how to search layer by layer. The count does not match, the workload is large and cumbersome

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
  • A method and a device for detecting memory leakage of an object
  • A method and a device for detecting memory leakage of an object
  • A method and a device for detecting memory leakage of an object

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0034] The idea, specific structure and technical effects of the present invention will be clearly and completely described below in conjunction with the embodiments and accompanying drawings, so as to fully understand the purpose, scheme and effect of the present invention.

[0035] It should be noted that, unless otherwise specified, the singular forms of "a", "said" and "the" used in this disclosure are intended to include plural forms unless the context clearly indicates otherwise. Also, unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art. The terms used in the specification herein are for describing specific embodiments only, and are not intended to limit the present invention. As used herein, the term "and / or" includes any combination of one or more of the associated listed items.

[0036] It should be understood that although the terms first, second, third etc. may be ...

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 relates to a method and device for detecting memory leakage of an object, and belongs to the technical field of computers. The method comprises the following steps that A, testing according to a preset testing rule, monitoring and recording reference counting operation and a current reference counting value of a to-be-monitored object, and the reference counting operation comprises reference counting plus 1 operation and reference counting minus 1 operation; B, after the test is finished, reading the reference count value of each object to be monitored, and screening a memory leakage object which is an object with a non-zero reference count value in the objects to be monitored; C, repeating the test in the step A again, and monitoring and recording corresponding call stack information when a memory leakage object has a reference counting operation; and D, analyzing the information of the call stack, searching the call stack which is not matched with the operation of adding 1 to the reference count and subtracting 1 from the reference count, and positioning the code block corresponding to the call stack. According to the method and the device, the reason of memory leakage can be quickly analyzed, so that a program developer can repair bugs more easily.

Description

technical field [0001] The invention relates to a method and device for detecting memory leakage of an object, belonging to the technical field of computers. Background technique [0002] Various types of applications developed by C++ generally use the method of reference counting to maintain the life cycle of the corresponding objects. [0003] The most basic form of reference counting is to associate each managed object with a reference counter, which records the number of times the object is currently referenced, and the counter is incremented whenever a new reference is created to point to the object. 1, the counter is decremented by 1 each time the reference to the object becomes invalid. When the value of this counter drops to 0, the object is considered dead. Each counter only records the local information of its corresponding object - the number of references, without the global reference information of the object; [0004] 1) When a circular reference occurs, the...

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
IPC IPC(8): G06F11/36G06F12/02
Inventor 潘亚楠廖泉辉
Owner 珠海西山居互动娱乐科技有限公司
Features
  • R&D
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More