CN104239205A - Memory repeated releasing detection method - Google Patents
Memory repeated releasing detection method Download PDFInfo
- Publication number
- CN104239205A CN104239205A CN201410449677.3A CN201410449677A CN104239205A CN 104239205 A CN104239205 A CN 104239205A CN 201410449677 A CN201410449677 A CN 201410449677A CN 104239205 A CN104239205 A CN 104239205A
- Authority
- CN
- China
- Prior art keywords
- memory
- internal memory
- released
- hash bucket
- pointer
- 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
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention provides a memory repeated releasing detection method. According to the method, a Hash bucket is firstly built; during the memory releasing for the first time, a memory pointer of a released memory is recorded, and is stored into the Hash bucket; during the memory releasing in the next time, whether the memory pointer of the released memory exists in the Hash bucket or not is found , if the memory pointer of the released memory does not exist in the Hash bucket, a Hash value of the memory pointer is calculated to obtain a sequence number, and then, the memory pointer of the released memory is stored into the Hash bucket according to the sequence number; if the memory pointer of the released memory exists in the Hash bucket, the result shows that a memory repeated releasing error occurs, and the error information is printed. The memory repeated releasing detection method has the advantages that the memory repeated release error condition can be effectively detected, in addition, simplicity and effectiveness are realized, the efficiency is high, and the actual operation is also convenient.
Description
Technical field
The present invention relates to a kind of method of detecting memory errors, especially occur that internal memory repeats to discharge the detection method of mistake.
Background technology
EMS memory error in C language and C Plus Plus program is very harmful, and they are very common, and may cause serious consequence.All caused by simple EMS memory error from the meet an urgent need the most serious many security bulletin of response team and supplier of computing machine.Since the latter stage seventies, C programmer person just discusses this type of mistake always, but its impact is still very large so far.
In addition, EMS memory error, once occur, is often difficult to the reason finding out generation, thus also cannot go to correct.Need the support by means of some powerful tools.
The C language and the C Plus Plus program that there is EMS memory error can cause various problem.If their leak memory, then travelling speed can be slack-off gradually, and finally out of service; If covering memory, then can become very fragile, be easy to the attack being subject to malicious user.
The place of C language or C Plus Plus can used, also extensively supporting to use other many general purpose languages (as Java
tM, Ruby, Haskell, C#, Perl, Smalltalk etc.), often kind of language has numerous fans and respective advantage.But from calculating angle, the major advantage that often kind of programming language is better than C language or C Plus Plus is all with to be convenient to memory management closely related.The programming relevant to internal memory is so important, and correct application is difficulty like this in practice, so that it dominates every other variable or the theory of Object-Oriented Programming Language, functional programming language, high-level programming language, declarative programming language and other programming language.
The same with the frequent fault of minority other types, EMS memory error or a kind of recessive harm: they are difficult to reproduce, and symptom can not find usually in corresponding source code.
Summary of the invention
The technical matters that the present invention need solve is to provide the detection method that a kind of simple effective, that Detection results is high internal memory repeats to discharge.
In order to solve the above problems, the present invention devises the detection method that a kind of internal memory repeats to discharge, and it comprises the following steps: step 1: first build Hash bucket; Step 2: first when releasing memory, record is released the memory pointer of internal memory, will be released the memory pointer of internal memory stored in Hash bucket; Whether step 3: during next releasing memory, search the memory pointer being released internal memory and exist in Hash bucket, if there is no, this is released the memory pointer of internal memory stored in Hash bucket; If existed, then show to create the mistake that internal memory repeats release, then print error message.
Improve further as the present invention, in described step 2, also comprise: by hash algorithm calculate be released internal memory memory pointer to obtain sequence number, according to described sequence number, by be released internal memory the position of memory pointer stored in Hash bucket correspondence on.
Improve further as the present invention, in described step 3, by be released internal memory memory pointer stored in Hash bucket time, if there is conflict, then utilize conflict chained record.
Improve further as the present invention, in described step 3, after printing error message step, also the current function call stack of program that should have being released internal memory is got.
Improve further as the present invention, in described step 3, the memory pointer this being released internal memory, stored in before Hash bucket, first calculates its cryptographic hash to obtain sequence number, and then according to sequence number, this memory pointer being released internal memory is stored in Hash bucket.
The present invention can detect that internal memory retransmits the error situation of release effectively, and simply effectively, efficiency is high, practical operation also facilitates.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet that internal memory of the present invention repeats the detection method discharged.
Embodiment
Technical scheme of the present invention is understood better in order to make relevant technical staff in the field, below in conjunction with drawings and embodiments, technical scheme in embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.
The invention provides the detection method that a kind of internal memory repeats to discharge, effectively can detect that internal memory repeats the problem discharged, fast and easy location and correction.
As shown in Figure 1, the detection method that internal memory of the present invention repeats to discharge comprises:
Step 1: first build Hash bucket.Hash bucket is released the memory pointer of internal memory for recording, like this, just can know which internal memory had been released once.If next time again releasing memory time, the memory pointer being released internal memory finds in Hash bucket, namely shows, this internal memory has been released again, exist repeat discharge mistake.
Step 2: first when releasing memory, record is released the memory pointer of internal memory, will be released the memory pointer of internal memory stored in Hash bucket.In the present embodiment, to the memory pointer of internal memory be released stored in before Hash bucket, also by hash algorithm calculate be released internal memory memory pointer to obtain sequence number, according to described sequence number, then by be released internal memory the position of memory pointer stored in Hash bucket correspondence on.The memory pointer being released internal memory is deposited in Hash bucket, means that being released internal memory had been released once, have recorded its memory pointer by Hash bucket, is equivalent to d/d foundation and is recorded in Hash bucket.
Step 3: during next releasing memory, search the memory pointer being released internal memory whether to exist in Hash bucket, if there is no, illustrate that this was not released before being released internal memory, there is not the problem repeating to discharge, now, the memory pointer that this can be released internal memory calculates cryptographic hash, obtain sequence number, then according to sequence number, the memory pointer this being released internal memory stored in Hash bucket, when the memory pointer that will be released internal memory is stored in Hash bucket, if there is conflict, then utilize conflict chained record; If existed, then show to detect that this was released before being released internal memory, create the mistake that internal memory repeats to discharge, print error message, know to allow user and detect that internal memory repeats the problem discharged, be further, after printing error message step, also the current function call stack of program that should have being released internal memory is got, to facilitate tracking and the location of contingency question.
The present invention can detect that internal memory retransmits the error situation of release effectively, and simply effectively, efficiency is high, practical operation also facilitates.
Below only have expressed one embodiment of the present invention, it describes comparatively concrete and detailed, but therefore can not be interpreted as the restriction to the scope of the claims of the present invention.It should be pointed out that for the person of ordinary skill of the art, without departing from the inventive concept of the premise, can also make some distortion and improvement, these all belong to protection scope of the present invention.Therefore, the protection domain of patent of the present invention should be as the criterion with claims.
Claims (5)
1. internal memory repeats a detection method for release, it is characterized in that, comprises the following steps:
Step 1: first build Hash bucket;
Step 2: first when releasing memory, record is released the memory pointer of internal memory, will be released the memory pointer of internal memory stored in Hash bucket;
Whether step 3: during next releasing memory, search the memory pointer being released internal memory and exist in Hash bucket, if there is no, this is released the memory pointer of internal memory stored in Hash bucket; If existed, then show to create the mistake that internal memory repeats release, then print error message.
2. internal memory repeats the detection method of release according to claim 1, it is characterized in that, in described step 2, also comprises:
By hash algorithm calculate be released internal memory memory pointer to obtain sequence number, according to described sequence number, by be released internal memory the position of memory pointer stored in Hash bucket correspondence on.
3. internal memory repeats the detection method that discharges according to claim 1, it is characterized in that, in described step 3, by be released internal memory memory pointer stored in Hash bucket time, if there is conflict, then utilize conflict chained record.
4. internal memory repeats the detection method of release according to claim 1, it is characterized in that, in described step 3, after printing error message step, is also got by the current function call stack of program that should have being released internal memory.
5. internal memory repeats the detection method of release according to claim 1, it is characterized in that, in described step 3, this is released the memory pointer of internal memory stored in before Hash bucket, first calculate its cryptographic hash to obtain sequence number, then according to sequence number, this memory pointer being released internal memory is stored in Hash bucket.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410449677.3A CN104239205A (en) | 2014-09-05 | 2014-09-05 | Memory repeated releasing detection method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410449677.3A CN104239205A (en) | 2014-09-05 | 2014-09-05 | Memory repeated releasing detection method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104239205A true CN104239205A (en) | 2014-12-24 |
Family
ID=52227321
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410449677.3A Pending CN104239205A (en) | 2014-09-05 | 2014-09-05 | Memory repeated releasing detection method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104239205A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107451054A (en) * | 2017-07-26 | 2017-12-08 | 武汉虹信通信技术有限责任公司 | A kind of memory pool adjustment method being used in linux environment |
CN109739645A (en) * | 2018-12-25 | 2019-05-10 | 新华三技术有限公司成都分公司 | EMS memory management process, device and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130054923A1 (en) * | 2011-08-24 | 2013-02-28 | Microsoft Corporation | Automatic memory leak detection |
CN103455424A (en) * | 2013-09-18 | 2013-12-18 | 哈尔滨工业大学 | Dynamic internal memory leakage detecting method and device based on VxWorks operation system |
-
2014
- 2014-09-05 CN CN201410449677.3A patent/CN104239205A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130054923A1 (en) * | 2011-08-24 | 2013-02-28 | Microsoft Corporation | Automatic memory leak detection |
CN103455424A (en) * | 2013-09-18 | 2013-12-18 | 哈尔滨工业大学 | Dynamic internal memory leakage detecting method and device based on VxWorks operation system |
Non-Patent Citations (1)
Title |
---|
高海昌等: "Linux平台下基于源代码插装的动态内存检测", 《小型微型计算机系统》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107451054A (en) * | 2017-07-26 | 2017-12-08 | 武汉虹信通信技术有限责任公司 | A kind of memory pool adjustment method being used in linux environment |
CN109739645A (en) * | 2018-12-25 | 2019-05-10 | 新华三技术有限公司成都分公司 | EMS memory management process, device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103699585B (en) | Methods, devices and systems for file metadata storage and file recovery | |
CN103034807B (en) | Malware detection methods and device | |
CN102356384B (en) | Method and device for data reliability detection | |
RU2014121249A (en) | SYSTEMS AND METHODS OF PROTECTION AGAINST MALICIOUS SOFTWARE BASED ON FUZZY WEIGHTLISTING | |
CN105103158A (en) | Profiling code execution | |
EP2795525B1 (en) | Augmenting system restore with malware detection | |
US8861718B2 (en) | Method of preventing fault-injection attacks on Chinese Remainder Theorem-Rivest Shamir Adleman cryptographic operations and recording medium for storing program implementing the same | |
EP3457659B1 (en) | Method and system for detecting attacks on cyber-physical systems using redundant devices and smart contracts | |
US9003240B2 (en) | Blackbox memory monitoring with a calling context memory map and semantic extraction | |
CN106803429A (en) | Electronic equipment and associated method with the malfunction monitoring for memory | |
CN104217137A (en) | Method and device for identifying whether intelligent terminal system is changed | |
US20160062700A1 (en) | System, method for cleaning memory space and terminal device with memory space cleaning function | |
CN104239205A (en) | Memory repeated releasing detection method | |
CN102904685A (en) | Method and device for processing hardware table entry checking error | |
CN103440461B (en) | A kind of PDF document security auditing method | |
CN103064988A (en) | Abnormal data detection method and device | |
US10348495B2 (en) | Configurable crypto hardware engine | |
CN104298935A (en) | Embedded device firmware protecting method and device | |
CN105491002A (en) | Advanced threat tracing method and system | |
CN108549551A (en) | A kind of the startup method, apparatus and equipment of server network interface card | |
CN103793633A (en) | Method and device for calibrating SDK | |
CN103778114A (en) | System and method for file recovery | |
CN103744742A (en) | Method for restoring bad block of internal memory | |
US9419793B2 (en) | Method for generating large prime number in embedded system | |
CN109951527A (en) | The hypervisor integrality detection method of Virtual system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
EXSB | Decision made by sipo to initiate substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20141224 |
|
RJ01 | Rejection of invention patent application after publication |