CN105302712A - Method for detecting C++ memory leakage - Google Patents
Method for detecting C++ memory leakage Download PDFInfo
- Publication number
- CN105302712A CN105302712A CN201410338527.5A CN201410338527A CN105302712A CN 105302712 A CN105302712 A CN 105302712A CN 201410338527 A CN201410338527 A CN 201410338527A CN 105302712 A CN105302712 A CN 105302712A
- Authority
- CN
- China
- Prior art keywords
- boundschecker
- mistake
- program
- memory leakage
- internal memory
- 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
Links
Abstract
The present invention discloses a method for detecting C++ memory leakage, and belongs to the field of software testing. The method comprises: integrating a BoundsChecker tool into a VC++ integrated development environment; compiling and running a developed program, whereiin BoundsChecker gives a fault detection result list; and locating code that causes C++ memory leakage, thereby improving stability of a C++ program. An advantage of the method provided by the present invention is that: the reliability and stability of a C++ application can be improved.
Description
Technical field
The invention belongs to software testing technology field, relate to software Black-box Testing method, be specifically related to the RAM leakage position finding and detection method of C++ soft project code level.
Background technology
At present, more and more extensive owing to using C Plus Plus to carry out project development at present, such as image rectification, image enhaucament, image acquisition, embedded development, the advantage of C Plus Plus is to develop the application program close to hardware bottom layer operation, have benefited from the use of C++ pointer, can directly the internal memory of computing machine be read and write and be applied for, therefore the application program developed has the fast feature of travelling speed, also just because of this, C++ is slightly improper on internal memory uses, easily cause RAM leakage accident, reduce computer run performance, What is more, the collapse of program can be caused, cause serious consequence, carry out detection and positioning just very must so carry out RAM leakage to C++.
Summary of the invention
The object of the invention there are provided detection, the method for positioning analyzing of the C++ memory overflow of a kind of BoundsChecker, effectively can detect pointer operation and internal memory, resource leakage mistake, the mistake of internal memory operation aspect, api function mistake in, improve the reliability and stability of C++ application program.
The technical solution used in the present invention is: utilize BoundsChecker Tool integration in VC++ Integrated Development Environment, compilation run exploitation program, BoundsChecker provides error detection result list, navigate to C++ memory overflow code, detect that pointer operation and internal memory, resource reveal mistake, the mistake of internal memory operation aspect, api function mistake in, to the clear and definite information of makeing mistakes.
The invention has the beneficial effects as follows: the reliability and stability that can improve C++ application program.
Embodiment
Specific embodiment of the invention process is as follows:
1. BoundsChecker7.2, BoundsChecker are installed be integrated in VC++ Integrated Development Environment.
2. in VC++ Integrated Development Environment, open the project that you will test.
3., due to the compiling connector of BoundsChecker will be used to recompilate linker, so we construct alone a file for BoundsChecker, in VC++ Integrated Development Environment, concrete operation method is:
A) [Build/Configurations...] menucommand is clicked;
B) in the dialog box ejected, click Ad button, in Configuration edit box, insert the title of the file that BoundsChecker creates, this title is arbitrary, and such as we are named as BoundChecker;
C) in Copysettingsfrom combo box, choose XXX-Win32Debug item, then hit OK button, then click Close button, now, we are for FinalCheck has constructed a file.
4. click [Build/SetActiveConfiguration ... ] menucommand, the file choosing you just now for BoundsChecker builds, then hit OK button, intermediate file, executable program that such BoundsChecker generates when compiling linker, under being all placed to this file.
5. select [BoundsChecker/RebuildAllwithBoundsChecker] menucommand, re-start compiling to program to connect, at this moment namely, BoundsChecker adds error-detecting code in the code of tested program, after compiling connection completes, BoundsChecker can generate executable file in your file for BoundsChecker structure, under FinalCheck pattern, the preliminary work that program detects all is carried out, at this moment can start to test by start-up routine, step with have no difference under ActiveChecker pattern, concrete steps are as follows:
5.1 guarantee that in VC++ Integrated Development Environment, [BoundsChecker/ErrorDetection] menu item and [BoundsChecker/LogEvents] menu item are in selected state, and the not outer EnableFinalCheckt arranged in [BoundsChecker/Setting] MemoryTracking option is selected state;
5.2 click [Build StartDebug] menu, and choose " Go " menu item, program starts to run under Debug state, and the test case made according to you, operates program.
5.3 when BoundsChecker detects mistake, can report to you by pop-up window, you can just process at that time, also can wait until that your operation all completes, analyze these mistakes listed after quitting a program, this depends on whether you have selected [BoundsChecker/DisplayErrorandPause] menu item completely again;
5.4 quit a program after, BoundsChecker can provide error detection result list.
Claims (1)
1. based on the detection method of the C++ memory overflow of BoundsChecker, it is characterized in that: utilize BoundsChecker Tool integration in VC++ Integrated Development Environment, compilation run exploitation program, BoundsChecker provides error detection result list, navigate to C++ memory overflow code, detect that pointer operation and internal memory, resource reveal mistake, the mistake of internal memory operation aspect, api function mistake in, to the clear and definite information of makeing mistakes.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410338527.5A CN105302712A (en) | 2014-07-17 | 2014-07-17 | Method for detecting C++ memory leakage |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410338527.5A CN105302712A (en) | 2014-07-17 | 2014-07-17 | Method for detecting C++ memory leakage |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105302712A true CN105302712A (en) | 2016-02-03 |
Family
ID=55200001
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410338527.5A Pending CN105302712A (en) | 2014-07-17 | 2014-07-17 | Method for detecting C++ memory leakage |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105302712A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018176339A1 (en) * | 2017-03-30 | 2018-10-04 | Intel Corporation | Methods and apparatus to protect memory from buffer overflow and/or underflow |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102662825A (en) * | 2012-02-22 | 2012-09-12 | 中国人民解放军国防科学技术大学 | Method for detecting memory leakage of heap operational program |
US20130054923A1 (en) * | 2011-08-24 | 2013-02-28 | Microsoft Corporation | Automatic memory leak detection |
CN103106134A (en) * | 2011-11-10 | 2013-05-15 | 阿里巴巴集团控股有限公司 | Detecting method, device and system for performance deficiency |
CN103268287A (en) * | 2013-06-05 | 2013-08-28 | 福州瑞芯微电子有限公司 | Method and device for detecting memory leaks |
-
2014
- 2014-07-17 CN CN201410338527.5A patent/CN105302712A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130054923A1 (en) * | 2011-08-24 | 2013-02-28 | Microsoft Corporation | Automatic memory leak detection |
CN103106134A (en) * | 2011-11-10 | 2013-05-15 | 阿里巴巴集团控股有限公司 | Detecting method, device and system for performance deficiency |
CN102662825A (en) * | 2012-02-22 | 2012-09-12 | 中国人民解放军国防科学技术大学 | Method for detecting memory leakage of heap operational program |
CN103268287A (en) * | 2013-06-05 | 2013-08-28 | 福州瑞芯微电子有限公司 | Method and device for detecting memory leaks |
Non-Patent Citations (1)
Title |
---|
QIUYANGZH: "单元测试工具Numega", 《HTTP://WWW.CNITBLOG.COM/QIUYANGZH/ARCHIVE/2005/07/14/975.HTML》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018176339A1 (en) * | 2017-03-30 | 2018-10-04 | Intel Corporation | Methods and apparatus to protect memory from buffer overflow and/or underflow |
US11360907B2 (en) | 2017-03-30 | 2022-06-14 | Intel Corporation | Methods and apparatus to protect memory from buffer overflow and/or underflow |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104199773B (en) | Obtain the method and device of code coverage information | |
US20090037885A1 (en) | Emulating execution of divergent program execution paths | |
US20130139129A1 (en) | Test method for handheld electronic device application | |
CN106325970A (en) | Compiling method and compiling system | |
CN103064781A (en) | Mobile software automated testing method | |
CN105338110A (en) | Remote debugging method, platform and server | |
US10120789B2 (en) | Automated test runs in an integrated development environment system and method | |
US7353498B2 (en) | Multi-process debugger | |
Singh et al. | Automated testing of mobile applications using scripting technique: A study on appium | |
CN104268310A (en) | Method for calling UVM verification environment through special graphical interface | |
CN103530221A (en) | Method for mapping procedure behavior and interface operation in Android system | |
CN102779094A (en) | Terminal and software exception test method | |
TW201321973A (en) | Handheld electronic device testing method | |
CN103257919A (en) | Inspection method and device for script programs | |
CN107368313A (en) | Code detection method, device and electronic equipment | |
WO2017044291A1 (en) | Method and apparatus for generating, capturing, storing, and loading debug information for failed tests scripts | |
CN104572428A (en) | Complicated control testing method based on windows operating system | |
CN103268241A (en) | Method for achieving hiding or display of hard disk partitions in BIOS | |
CN103186459A (en) | JAVA graphical user interface automatic test method based on scripts | |
CN105302712A (en) | Method for detecting C++ memory leakage | |
CN101706752B (en) | Method and device for in-situ software error positioning | |
US8458669B2 (en) | Automated test system | |
CN111176964A (en) | Virtualization platform hardware compatibility testing method | |
Borges Jr et al. | Speeding up GUI testing by on-device test generation | |
CN103365775B (en) | Based on the unit test method that internal state checks |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information |
Address after: 211112 Jiangning, Jiangsu Province, open source road, No. 168, No. Applicant after: NANJING PERLOVE MEDICAL EQUIPMENT CO., LTD. Address before: 211112 Jiangning, Jiangsu Province, open source road, No. 168, No. Applicant before: Nanjing Perlove Radial-video Equipment Co., Ltd. |
|
COR | Change of bibliographic data | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20160203 |
|
WD01 | Invention patent application deemed withdrawn after publication |