CN101414272B - Method and apparatus for detecting memory leakage - Google Patents

Method and apparatus for detecting memory leakage Download PDF

Info

Publication number
CN101414272B
CN101414272B CN 200810201396 CN200810201396A CN101414272B CN 101414272 B CN101414272 B CN 101414272B CN 200810201396 CN200810201396 CN 200810201396 CN 200810201396 A CN200810201396 A CN 200810201396A CN 101414272 B CN101414272 B CN 101414272B
Authority
CN
China
Prior art keywords
internal memory
business process
memory
detected internal
judge
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.)
Expired - Fee Related
Application number
CN 200810201396
Other languages
Chinese (zh)
Other versions
CN101414272A (en
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.)
Huawei Technologies Co Ltd
Shanghai Huawei Technologies Co Ltd
Original Assignee
Shanghai Huawei Technologies 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 Shanghai Huawei Technologies Co Ltd filed Critical Shanghai Huawei Technologies Co Ltd
Priority to CN 200810201396 priority Critical patent/CN101414272B/en
Publication of CN101414272A publication Critical patent/CN101414272A/en
Priority to PCT/CN2009/074435 priority patent/WO2010043176A1/en
Application granted granted Critical
Publication of CN101414272B publication Critical patent/CN101414272B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

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/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
    • 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/0751Error or fault detection not based on redundancy
    • G06F11/0754Error or fault detection not based on redundancy by exceeding limits
    • G06F11/0757Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a detection method for memory leak and a device thereof. The method comprises the following steps: a first judgment procedure is executed and specifically comprises a step of judging whether the currently occupied time of a detected memory exceeds a life circle which is preset for the detected memory; when the result of the first judgment procedure is positive, a second judgment procedure is triggered, and specifically the second judgment procedure comprises a step of judging whether the detected memory is used by a business process which applies for the detected memory; when the result of the second judgment procedure is positive, the detected memory is judged to have no memory leak, and when the result of the second judgment procedure is negative, the detected memory is judged to have the memory leak. The memory leak can be accurately detected by the detection method and the detection device provided by the embodiment of the invention, thus avoiding erroneous judgment.

Description

The detection method of memory overflow and device
Technical field
The present invention relates to computer application field, particularly relate to a kind of detection method and device of memory overflow.
Background technology
The internal memory that is used for data storage is the essential resource of business process operation, and business process needs to file an application before using internal memory, and begins to take this internal memory, timely again releasing memory after using internal memory.Internal memory is divided into two kinds of situations usually by taking of business process, a kind of is monopolizing of internal memory, promptly when internal memory is taken by a kind of business process and is in occupied state, just can not be again by other business process application with take, have only when this internal memory to be discharged by the current business process that takies and when incorporating the memory source pond again into, this internal memory just can be again by other business process application with take.Another kind of situation is reusing of internal memory, and promptly internal memory can be taken simultaneously by at least two business process.In object-oriented programming, internal memory can write down the situation of quoting of self, and expression is quoted by a plurality of business process, and just each internal memory can be taken by a plurality of business process.The leakage of internal memory just is meant: because a variety of causes can cause business process internal memory not to be discharged after using internal memory.Memory overflow can cause can be fewer and feweri by business process application and committed memory in the system, and final system can be owing to low memory withdraws from service.Therefore, the detection of memory overflow is very important.
In the prior art, the detection method of memory overflow is: judge that whether being surpassed by the holding time of the shared internal memory of business process is the predefined life cycle of internal memory, when the holding time of internal memory surpasses life cycle, judge again whether the number that internal memory is quoted by business process is zero, if be zero, assert this internal memory generation memory overflow,, assert that memory overflow does not take place this internal memory if non-vanishing.
But, the inventor finds the problem that prior art exists under study for action: the number of references of internal memory is that business process is when releasing memory and upgrade, when business process does not have the process of correct execution releasing memory, the number of references mistake that will cause internal memory self to be write down, therefore, judge by the number of references of internal memory self record whether internal memory leaks the possibility that will occur judging by accident.When since erroneous judgement and mistakenly the internal memory that leaks of releasing memory or untimely release all can further influence the normal operation of existing system.
Summary of the invention
Detection method and device that the embodiment of the invention provides a kind of internal memory to reveal detecting memory overflow exactly, are avoided misjudgment phenomenon.
The embodiment of the invention discloses a kind of detection method of memory overflow, described method comprises: first deterministic process is specially: whether the current occupied time of judging detected internal memory is above being the life cycle of described detected memory setting in advance; When the result of described first deterministic process when being, trigger second deterministic process, described second deterministic process is specially: judge that the business process whether described detected internal memory is being applied described detected internal memory uses; When the result of described second deterministic process when being, judge that memory overflow does not take place described detected internal memory, when the result of described second deterministic process for not the time, judge described detected internal memory generation memory overflow.
The embodiment of the invention discloses a kind of pick-up unit of memory overflow, described device comprises: first detecting unit, be used to judge that whether the current occupied time of detected internal memory is above being the life cycle of described detected memory setting in advance, if trigger second detecting unit; Second detecting unit, be used to judge that the business process whether described detected internal memory is being applied described detected internal memory uses, if judge that memory overflow does not take place described detected internal memory, if not, judge described detected internal memory generation memory overflow.
By the embodiment of the invention described above as can be seen, when the current occupied time of judging detected internal memory surpasses the expection life cycle, by the judgement of independently oppositely tracing to the source, promptly navigate to the business process of this internal memory of application, and then judge that described internal memory is by the real operating position of business process.If determine that business process has finished or described internal memory is discharged by business process, then this detected internal memory generation memory overflow of final decision.Thereby can solve the generation of memory overflow erroneous judgement, avoid because the memory overflow erroneous judgement influences the problem of the normal operation of system.
Description of drawings
Fig. 1 is first embodiment process flow diagram of the detection method of a kind of memory overflow of the present invention;
The synoptic diagram that Fig. 2 is reused by three business process for same internal memory;
Fig. 3 is first example structure figure of the pick-up unit of a kind of memory overflow of the present invention;
Fig. 4 is second embodiment process flow diagram of the detection method of a kind of memory overflow of the present invention;
Fig. 5 is second example structure figure of the pick-up unit of a kind of memory overflow of the present invention;
Fig. 6 is the 3rd example structure figure of the detection method of a kind of memory overflow of the present invention.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the embodiment of the invention is described in detail below in conjunction with accompanying drawing.
See also Fig. 1, it is the process flow diagram of first embodiment of the detection method of a kind of memory overflow of the present invention, and its detection method can may further comprise the steps:
Step 101: judge current whether being surpassed of detected internal memory to be the life cycle of described detected memory setting in advance, if enter step 102 by the shared time of business process;
Wherein, detected internal memory synchronization can only be monopolized by a business process, also can be reused by a plurality of business process.Wherein, when detected internal memory is reused by a plurality of business process simultaneously, can set in advance a unified life cycle at each business process, also can at different business process different life cycle values be set according to the business processing logic of business process.When different business process during, here, successively quote with three business process and to save as definite process that example illustrates the life cycle value of detected internal memory in same at same internal memory of repeated citing.Business process 1 is at internal memory of time point t1 application, and business process 1 time, the life cycle of this internal memory is T1, afterwards, when business process 1 did not also discharge this internal memory, business process 2 was again at same internal memory of time point t2 application, business process 2 times, the life cycle of this internal memory is T2.As shown in Figure 2, at this moment, business process 1 and business process 2 are reused same internal memory, when business process 2 is quoted this internal memory, upgrade the life cycle of this internal memory, at this moment, internal memory life cycle after the renewal be business process 2 when quoting this internal memory should in have the maximal value of excess time and the life cycle of 2 times these internal memories of business process in the business process 1, have the excess time in the business process 1 and the life cycle value sum of 2 times these internal memories of business process when perhaps quoting this internal memory in this for business process 2.Afterwards, have business process 3 to apply for this internal memory again, and business process 3 times, the life cycle of this internal memory is T3 at time point t3.When business process 3 is quoted this internal memory, upgrade the life cycle of this internal memory again, life cycle after then upgrading be business process 3 when quoting this internal memory should in have the maximal value of the life cycle of excess time in the business process 2 and 3 times these internal memories of business process, perhaps for business process 3 when quoting this internal memory should in have the excess time in the business process 2 and the life cycle sum of 3 times these internal memories of business process, by that analogy.
In above-mentioned steps, when judged result for not the time, judge that memory overflow does not take place described detected internal memory.
Step 102: judge that the business process whether described detected internal memory is being applied described detected internal memory uses, if, enter step 103, if not, enter step 104;
Wherein, when detected internal memory synchronization only by a business process application and when monopolizing, above-mentioned steps only judges whether detected internal memory is used by this business process, when detected internal memory synchronization is laid equal stress on the time spent by a plurality of business process applications, above-mentioned steps need judge one by one whether detected internal memory is used by each business process, when existing a business process using described detected internal memory veritably, judge that memory overflow does not take place described detected internal memory, when all apply for that the business process of detected internal memory does not all use described detected internal memory, judge described detected internal memory generation memory overflow.
The present invention does not limit in proper order to the judgement of miscellaneous service process, and its judgement order can be set arbitrarily.When judging that one by one whether detected internal memory is used by all business process, a preferable methods is, when judging that first certain business process is using described detected internal memory, can stop deterministic process, judge that memory overflow does not take place described detected internal memory.
Deterministic process in the above-mentioned steps specifically comprises: at first according to the business process sign, identify the business process of the described detected internal memory of application; Judge then whether the memory address that whether described business process exists and described business process is preserved is identical with the address of described detected internal memory, when described business process exists and described business process is preserved memory address is identical with the address of described detected internal memory, this judged result is for being, when described business process does not exist or/and the address of memory address that described business process is preserved and described detected internal memory when inequality, this judged result is not for.
Step 103: judge that memory overflow, process ends do not take place described detected internal memory;
Step 104: judge described detected internal memory generation memory overflow, process ends.
Wherein, after judging detected internal memory generation memory overflow, this step can also comprise: discharge detected internal memory.
Corresponding with the detection method of above-mentioned a kind of memory overflow, the embodiment of the invention also provides a kind of pick-up unit of memory overflow.See also Fig. 3, it is first example structure figure of the pick-up unit of a kind of memory overflow of the present invention, and this device comprises first detecting unit 301 and second detecting unit 302.Principle of work below in conjunction with this device is further introduced its inner structure and annexation.
First detecting unit 301 is used to judge that whether the current occupied time of detected internal memory is above being the life cycle of described detected memory setting in advance, if trigger second detecting unit 302;
Second detecting unit 302, be used to judge that the business process whether described detected internal memory is being applied described detected internal memory uses, if judge that memory overflow does not take place described detected internal memory, if not, judge described detected internal memory generation memory overflow.
Present embodiment can also comprise releasing unit 305, is used for discharging described detected internal memory after second detecting unit 302 is judged described detected internal memory generation memory overflow.
Wherein, second detecting unit 302 comprises recognition unit 303, is used for identifying the business process of the described detected internal memory of application according to the business process sign; Judging unit 304, be used to judge whether the memory address that whether described business process exists and described business process is preserved is identical with the address of described detected internal memory, if, judge that memory overflow does not take place described detected internal memory, if not, judge described detected internal memory generation memory overflow.
By the embodiment of the invention described above as can be seen, when the current occupied time of judging detected internal memory surpasses the expection life cycle, by the judgement of independently oppositely tracing to the source, promptly navigate to the business process of this internal memory of application, and according to the actual operating position of business process, if determine that business process has finished or internal memory is discharged by business process, then this detected internal memory generation memory overflow of final decision.Thereby can thoroughly solve the generation of memory overflow erroneous judgement, avoid because the professional normal problem of carrying out of memory overflow erroneous judgement influence.
In addition, when using a unified predefined internal memory life cycle, can not adapt to various internal memory and use scene.For example, some long business process consuming time is also at the normal internal memory that uses, but repeats the memory overflow inspection owing to overtime, causes the waste of system handles resource.And some short internal memory consuming time might not reach life cycle and can not in time be detected owing to current holding time.The embodiment of the invention is according to the business processing logic of business process, is respectively the different internal memory life cycle value of memory setting of various different scene applications by business process, avoided above problem, makes system's operation will be more stable.
See also Fig. 4, it is the process flow diagram of second embodiment of the detection method of a kind of memory overflow of the present invention, be with the difference of above-mentioned first embodiment, in the present embodiment, when judging that described detected internal memory is being used by certain business process, revising is the life cycle of described detected memory setting in advance.Its detection method can may further comprise the steps:
Step 401: judge current whether being surpassed of detected internal memory to be the life cycle of described detected memory setting in advance, if enter step 402 by the shared time of business process;
Wherein, detected internal memory synchronization can only be monopolized by a business process, also can be reused by a plurality of business process.Wherein, when detected internal memory is reused by a plurality of business process simultaneously, can set in advance a unified internal memory life cycle at each business process, also can at different business process different internal memory life cycle values be set according to the business processing logic of business process.
In the above-mentioned steps, when judged result for not the time, judge that memory overflow does not take place described detected internal memory.
Step 402: judge that the business process whether described detected internal memory is being applied described detected internal memory uses, if, enter step 403, if not, enter step 405;
Wherein, when detected internal memory synchronization only by a business process application with when monopolizing, above-mentioned steps only judges whether detected internal memory is used by this business process, when detected internal memory synchronization by a plurality of business process applications with when reusing, above-mentioned steps need judge one by one whether detected internal memory is used by each business process, when existing a business process using described detected internal memory veritably, judge that memory overflow does not take place described detected internal memory, when all applications and the business process of reusing detected internal memory do not use described detected internal memory, judge described detected internal memory generation memory overflow.
The present invention does not limit in proper order to the judgement of miscellaneous service process, and its judgement order can be set arbitrarily.When judging one by one whether detected internal memory is not had business process to use, a preferable methods is, when judging that first certain business process is using described detected internal memory, can stop deterministic process, judge that memory overflow does not take place described detected internal memory.
Step 403: judge that memory overflow does not take place described detected internal memory;
Step 404: increasing is the life cycle of described detected memory setting in advance, process ends;
Wherein, when business processing logic according to each business process, when different life cycle values and detected internal memory being set being reused by a plurality of business process simultaneously at different business process, need comprehensively determine the life cycle of a detected internal memory according to the life cycle value of each business process, it determines that method done detailed introduction in first embodiment of the detection method of memory overflow, repeats no more here.In this step, the life cycle of increase is the life cycle value of the detected internal memory comprehensively determined of described life cycle value by each business process.
Step 405: judge described detected internal memory generation memory overflow, process ends.
Wherein, after judging detected internal memory generation memory overflow, this step can also comprise: discharge detected internal memory.
Corresponding with the detection method of above-mentioned a kind of memory overflow, the embodiment of the invention also provides a kind of pick-up unit of memory overflow.See also Fig. 5, it is second example structure figure of the pick-up unit of a kind of memory overflow of the present invention, and this device comprises that first detecting unit 501, second detecting unit 502 and life cycle increase unit 503.Principle of work below in conjunction with this device is further introduced its inner structure and annexation.
First detecting unit 501 is used to judge current whether being surpassed by the shared time of business process of detected internal memory be the life cycle of described detected memory setting in advance, if trigger second detecting unit 503;
Second detecting unit 502, be used to judge that the business process whether described detected internal memory is being applied described detected internal memory uses, if, judge that memory overflow does not take place described detected internal memory, trigger life cycle and increase unit 503, if not, judge described detected internal memory generation memory overflow.
Life cycle increases unit 503, and being used for increases the life cycle of described detected internal memory after second detecting unit 502 judges that described detected internal memory memory overflow does not take place.
Present embodiment can also comprise releasing unit, is used for discharging described detected internal memory after second detecting unit 502 is judged described detected internal memory generation memory overflow.
Wherein, second detecting unit 502 comprises recognition unit, is used for identifying the business process of the described detected internal memory of application according to the business process sign; Judging unit, be used to judge whether the memory address that whether described business process exists and described business process is preserved is identical with the address of described detected internal memory, if judge that memory overflow does not take place described detected internal memory, if not, judge described detected internal memory generation memory overflow.
As can be seen from the above-described embodiment, when the current occupied time of judging detected internal memory surpasses preset life cycle, by the judgement of independently oppositely tracing to the source, promptly navigate to the business process of this internal memory of application, and according to the actual operating position of business process, if determine that business process has finished or internal memory is discharged by business process, then this detected internal memory generation memory overflow of final decision.Thereby can thoroughly solve the generation of memory overflow erroneous judgement, avoid because the professional normal problem of carrying out of memory overflow erroneous judgement influence.Simultaneously, if determine that detected internal memory is not used by this business process, judge that then memory overflow does not appear in this detected internal memory, at this moment, come to reset the life cycle value by increasing life cycle, when preventing to detect this internal memory again and the situation of erroneous judgement takes place for detected internal memory.
In addition, when using a unified predefined internal memory life cycle, can not adapt to various internal memory and use scene.For example, some long business process consuming time is also at the normal internal memory that uses, but repeats the memory overflow inspection owing to overtime, causes the waste of system handles resource.And some short internal memory consuming time might not reach life cycle and can not in time be detected owing to current holding time.The embodiment of the invention is according to the business processing logic of business process, is respectively the different internal memory life cycle value of memory setting of various different scene applications by business process, avoided above problem, makes system's operation will be more stable.
See also shown in Figure 6ly, it is the process flow diagram of the 3rd embodiment of the detection method of a kind of memory overflow of the present invention, and present embodiment is the detected internal memory optimal way that internal memory detects when being monopolized by 1 business process.After the success of business process application internal memory, generate a memory information record, write down the relevant information of this internal memory, can comprise: the life cycle and the excess time of memory address, internal memory application time, business process sign, shared detected internal memory, then a memory information storehouse put in the memory information record.After the success of business process releasing memory, in being released, deletion has the memory information record in the memory information storehouse.Enter the testing process of memory overflow when system after, this detection method may further comprise the steps:
Step 601: the access memory information bank, search excess time and be zero internal memory, with this internal memory as detected internal memory;
Wherein, in the internal memory record the excess time=current occupied time of life cycle-detected internal memory of detected internal memory, the current occupied time=current time in system of detected internal memory-internal memory application time.The time point of internal memory application time for when this internal memory of business process application is successful, being write down; The life cycle of detected internal memory be in advance for detected memory setting by the shared time of business process, be a general estimated value.
Described life cycle can set in advance a unified internal memory life cycle at each business process, also can at different business process different internal memory life cycle values be set according to the business processing logic of business process.A preferred scheme is: the interim internal memory of in a function, applying for, life cycle directly can be extended this as 0, and represent to discharge at once after this exists function to execute in being applied.If the internal memory of being applied for when sending message in view of the message internal memory just discharges, generally can not surpass 1000ms after applying for sending from port, therefore, can life cycle be set to 1000ms.If some complicated flow processing are arranged, need be after finishing in flow process releasing memory, business module also can roughly determine to be applied the life cycle of internal memory substantially according to flow process and system handles performance.When through calculating resulting result be less than 0 several the time, then get 0 value excess time.When be not 0 the excess time of detected internal memory, show that the current holding time of detected internal memory does not surpass the life cycle of detected internal memory, memory overflow does not take place in the detected internal memory of this moment.
Step 602:, identify the business process of this detected internal memory of application according to the business process sign in the internal memory record;
Wherein, business process of a business process sign unique identification can be a business process controll block address, or the numbering of business process controll block.
Step 603: judge whether detected internal memory is shared by the indicated business process of business process sign, if, enter step 604, if not, enter step 605;
Wherein, when be 0 the excess time of detected internal memory, show that the current holding time of detected internal memory has surpassed the life cycle of detected internal memory, if the holding time of detected internal memory is relevant with the duration of business process, for preventing erroneous judgement, need further to judge that the business process whether this detected internal memory indicated by service identification is shared.
Above-mentioned steps 603 specifically can realize that this function has two parameters by a business process detection function: memory address and business process sign.Business process is in order to discharge conveniently, generally all can be at the memory address of business process controll block record oneself application, determine the corresponding business process control block (PCB) by the business process sign, by the business process controll block of determining judge whether business process exists and business process controll block in the memory address preserved and the business process detection function memory address of going into to join whether identical, if, judge that detected internal memory is shared by the business process of business process sign indication, if not, judge that detected internal memory is not taken by the business process of business process sign indication.
Step 604: judge that memory overflow does not take place detected internal memory, increases the life cycle of detected internal memory, process ends;
Wherein, when detected internal memory also when the business process of being indicated by service identification is shared, illustrate that leaking does not appear in this detected internal memory, need to increase the life cycle in the internal memory record of detected internal memory.A preferable methods is: double on the basis in progenote cycle.
Step 605: judge detected internal memory generation memory overflow, the memory address according in the internal memory record discharges detected internal memory, process ends.
Wherein, when the business process of not indicated by service identification when detected internal memory is shared, illustrate that leakage has appearred in this detected internal memory, according to the memory address in the internal memory record of this detected internal memory, find the actual physical address of this detected internal memory, and discharge this detected internal memory.
By the embodiment of the invention described above as can be seen, when the current occupied time of judging detected internal memory surpasses the expection life cycle, by the judgement of independently oppositely tracing to the source, promptly navigate to the business process of this internal memory of application, and according to the actual operating position of business process, if determine that business process has finished or internal memory is discharged by business process, then this detected internal memory generation memory overflow of final decision.Thereby can thoroughly solve the generation of memory overflow erroneous judgement, avoid because the professional normal problem of carrying out of memory overflow erroneous judgement influence.Simultaneously, if determine that detected internal memory is not used by this business process, judge that then memory overflow does not appear in this detected internal memory, at this moment, come to reset the life cycle value by increasing life cycle, when preventing to detect this internal memory again and the situation of erroneous judgement takes place for detected internal memory.
In addition, when using a unified predefined internal memory life cycle, can not adapt to various internal memory and use scene.For example, some long business process consuming time is also at the normal internal memory that uses, but repeats the memory overflow inspection owing to overtime, causes the waste of system handles resource.And some short internal memory consuming time might not reach life cycle and can not in time be detected owing to current holding time.The embodiment of the invention is according to the business processing logic of business process, is respectively the different internal memory life cycle value of memory setting of various different scene applications by business process, avoided above problem, makes system's operation will be more stable.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to finish by program, described program can be stored in the computer read/write memory medium, this program comprises the steps: first deterministic process, and described second deterministic process is specially: whether the current occupied time of judging detected internal memory is above being the life cycle of described detected memory setting in advance; When the result of described first deterministic process when being, trigger second deterministic process, be specially: judge that the business process whether described detected internal memory is being applied described detected internal memory uses; When the result of described second deterministic process when being, judge that memory overflow does not take place described detected internal memory, when the result of described second deterministic process for not the time, judge described detected internal memory generation memory overflow.Described storage medium, as: ROM/RAM, magnetic disc, CD etc.
The above only is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.

Claims (12)

1. the detection method of a memory overflow is characterized in that, described method comprises:
First deterministic process is specially: whether the current occupied time of judging detected internal memory is above being the life cycle of described detected memory setting in advance;
When the result of described first deterministic process when being, trigger second deterministic process, described second deterministic process is specially: judge that the business process whether described detected internal memory is being applied described detected internal memory uses, described second deterministic process comprises: identify according to business process, identify the business process of the described detected internal memory of application, judge whether the memory address that whether described business process exists and described business process is preserved is identical with the address of described detected internal memory, if, the judged result of described second deterministic process is for being, if not, the judged result of described second deterministic process is for denying;
When the result of described second deterministic process when being, judge that memory overflow does not take place described detected internal memory, when the result of described second deterministic process for not the time, judge described detected internal memory generation memory overflow.
2. method according to claim 1 is characterized in that, described method also comprises:
After described second deterministic process judges that described detected internal memory memory overflow does not take place, increase the life cycle of described detected internal memory.
3. method according to claim 1 is characterized in that, described method also comprises:
After described second deterministic process is judged described detected internal memory generation memory overflow, discharge described detected internal memory.
4. method according to claim 1 is characterized in that, describedly comprises for the life cycle of detected memory setting in advance:
Be the unified life cycle that is provided with of detected internal memory of all business process in advance;
Perhaps,
According to the business processing logic of business process self, the life cycle that is provided with respectively for the detected internal memory of each business process in advance.
5. method according to claim 1 is characterized in that, described business process sign comprises:
The numbering of the address of business process controll block or business process controll block.
6. method according to claim 1 is characterized in that, described according to the business process sign, the business process that identifies the described detected internal memory of application comprises:
After the described detected internal memory success of described business process application, corresponding described business process is set up the internal memory record that includes the business process sign, according to the described business process sign in the described internal memory record, identify the business process of the described detected internal memory of application.
7. method according to claim 6 is characterized in that, described internal memory record comprises: memory address, internal memory application time, business process sign and internal memory life cycle.
8. according to any described method of claim 1-7, it is characterized in that described detected internal memory comprises:
Internal memory or at least two internal memories that business process is reused of synchronization quilt that synchronization is monopolized by a business process.
9. the pick-up unit of a memory overflow is characterized in that, described device comprises:
First detecting unit is used to judge that whether the current occupied time of detected internal memory is above being the life cycle of described detected memory setting in advance, if trigger second detecting unit;
Second detecting unit, be used to judge that the business process whether described detected internal memory is being applied described detected internal memory uses, if, judge that memory overflow does not take place described detected internal memory, if not, judge described detected internal memory generation memory overflow, wherein, described second detecting unit identifies according to business process, identifies the business process of the described detected internal memory of application, judges whether the memory address that whether described business process exists and described business process is preserved is identical with the address of described detected internal memory, if, the judged result of described second detecting unit is for being, if not, the judged result of described second detecting unit is not for.
10. device according to claim 9 is characterized in that, described second detecting unit comprises:
Recognition unit is used for identifying the business process of the described detected internal memory of application according to the business process sign;
Judging unit, be used to judge whether the memory address that whether described business process exists and described business process is preserved is identical with the address of described detected internal memory, if judge that memory overflow does not take place described detected internal memory, if not, judge described detected internal memory generation memory overflow.
11. device according to claim 9 is characterized in that, described device also comprises:
Life cycle increases the unit, is used for increasing the life cycle of described detected internal memory after described second detecting unit judges that described detected internal memory memory overflow does not take place.
12. device according to claim 9 is characterized in that, described device also comprises:
Releasing unit is used for discharging described detected internal memory after described second detecting unit is judged described detected internal memory generation memory overflow.
CN 200810201396 2008-10-17 2008-10-17 Method and apparatus for detecting memory leakage Expired - Fee Related CN101414272B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN 200810201396 CN101414272B (en) 2008-10-17 2008-10-17 Method and apparatus for detecting memory leakage
PCT/CN2009/074435 WO2010043176A1 (en) 2008-10-17 2009-10-14 Memory leak detecting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200810201396 CN101414272B (en) 2008-10-17 2008-10-17 Method and apparatus for detecting memory leakage

Publications (2)

Publication Number Publication Date
CN101414272A CN101414272A (en) 2009-04-22
CN101414272B true CN101414272B (en) 2011-06-08

Family

ID=40594810

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200810201396 Expired - Fee Related CN101414272B (en) 2008-10-17 2008-10-17 Method and apparatus for detecting memory leakage

Country Status (2)

Country Link
CN (1) CN101414272B (en)
WO (1) WO2010043176A1 (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101414272B (en) * 2008-10-17 2011-06-08 上海华为技术有限公司 Method and apparatus for detecting memory leakage
CN102279797A (en) * 2011-08-30 2011-12-14 深圳宝德科技集团股份有限公司 Method and system for detecting memory leakage
CN103984603B (en) * 2012-03-31 2017-12-05 华为技术有限公司 A kind of method and apparatus for detecting internal storage location
CN105700968A (en) * 2016-01-11 2016-06-22 厦门雅迅网络股份有限公司 Method and device for memory leakage diagnosis processing in embedded system
CN106095689B (en) * 2016-06-24 2019-02-12 北京奇虎科技有限公司 A kind of detection method and device of application memory leakage
CN109154963B (en) * 2016-07-14 2021-01-29 华为技术有限公司 Equipment and method for preventing memory data from being leaked
CN109857615B (en) * 2018-12-29 2022-07-19 奇安信科技集团股份有限公司 Method and device for detecting memory leakage
CN110704217A (en) * 2019-08-27 2020-01-17 努比亚技术有限公司 Memory leak detection method, terminal and computer readable storage medium
CN110795355A (en) * 2019-10-30 2020-02-14 深圳开立生物医疗科技股份有限公司 Method and device for detecting memory leakage
CN112035289A (en) * 2020-09-03 2020-12-04 浙江大华技术股份有限公司 Method and device for determining data block leakage, storage medium and electronic device
CN113381895B (en) * 2021-06-16 2022-06-24 杭州迪普科技股份有限公司 Network fault detection method and device
CN113900867A (en) * 2021-09-06 2022-01-07 浪潮软件股份有限公司 Method, apparatus and computer readable medium for detecting IOS memory leak
CN113868673B (en) * 2021-12-06 2022-04-19 荣耀终端有限公司 Vulnerability detection method and device
CN114968645B (en) * 2022-07-27 2022-10-11 北京睿芯高通量科技有限公司 Memory leak detection method and device, electronic equipment and storage medium
CN117971626A (en) * 2024-03-28 2024-05-03 天津南大通用数据技术股份有限公司 Shared memory leakage detection method based on multi-process coroutine model

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1466057A (en) * 2002-06-20 2004-01-07 华为技术有限公司 Method for checking sofeware memory leak
CN1604050A (en) * 2003-09-30 2005-04-06 国际商业机器公司 System and method for autonomic memory leak detection and remediation
CN101162436A (en) * 2006-10-13 2008-04-16 中兴通讯股份有限公司 Ems memory leakage testing method in communication apparatus system
CN101178669A (en) * 2007-12-13 2008-05-14 华为技术有限公司 Resource recovery method and apparatus

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7398369B2 (en) * 2004-10-28 2008-07-08 International Business Machines Corporation Memory leakage management
US7716648B2 (en) * 2005-08-02 2010-05-11 Oracle America, Inc. Method and apparatus for detecting memory leaks in computer systems
CN100530110C (en) * 2005-12-08 2009-08-19 中兴通讯股份有限公司 System for automatically monitoring memory leakage and memory out-of-range in inlaid system
CN101414272B (en) * 2008-10-17 2011-06-08 上海华为技术有限公司 Method and apparatus for detecting memory leakage

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1466057A (en) * 2002-06-20 2004-01-07 华为技术有限公司 Method for checking sofeware memory leak
CN1604050A (en) * 2003-09-30 2005-04-06 国际商业机器公司 System and method for autonomic memory leak detection and remediation
CN101162436A (en) * 2006-10-13 2008-04-16 中兴通讯股份有限公司 Ems memory leakage testing method in communication apparatus system
CN101178669A (en) * 2007-12-13 2008-05-14 华为技术有限公司 Resource recovery method and apparatus

Also Published As

Publication number Publication date
CN101414272A (en) 2009-04-22
WO2010043176A1 (en) 2010-04-22

Similar Documents

Publication Publication Date Title
CN101414272B (en) Method and apparatus for detecting memory leakage
CN101470632B (en) Sharing internal memory management method and apparatus
CN107085548A (en) A kind of method, device and electronic equipment for monitoring application program internal memory
WO2016123908A1 (en) Memory overflow detection method and apparatus
CN106775877A (en) A kind of firmware method for refreshing and a kind of server
CN103810106A (en) Method and device for testing fluency of interfaces
US20080201618A1 (en) Method for Running a Computer Program on a Computer System
CN111324450A (en) Method and system for memory pool leakage based on LTE protocol stack
CN100392606C (en) Method for leaking memory of positioning virtual operation system
CN103914355A (en) Method and device for positioning memory repeated release
CN103559098A (en) Smart card test number control method, device and system
US20240095174A1 (en) Method for detecting error of operating system kernel memory in real time
CN107679423A (en) Partition integrity inspection method and device
CN112506802A (en) Test data management method and system
CN108733567A (en) The monitoring method and system of software resource leak case
CN116795718A (en) eBPF-based Linux system memory leak detection method and system
CN107590013B (en) Efficient method for detecting leakage of Android application Service component
CN107168875B (en) Activity component leakage detection method based on android application multi-entry characteristics
CN111651350A (en) Test case processing method, device and equipment and computer readable storage medium
CN115840707A (en) Flash test method, device and medium
CN105243011A (en) Memory leak positioning method and apparatus
CN106776169A (en) A kind of method and device of the PSU of testing service device
CN103109265A (en) Method and system for performing system maintenance in a computing device
CN101661399B (en) Method for modular software removal
CN112463621B (en) Regression test management method, storage medium management method, device, equipment and medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20110608

Termination date: 20151017

EXPY Termination of patent right or utility model