WO2010043176A1 - Memory leak detecting method and device - Google Patents

Memory leak detecting method and device Download PDF

Info

Publication number
WO2010043176A1
WO2010043176A1 PCT/CN2009/074435 CN2009074435W WO2010043176A1 WO 2010043176 A1 WO2010043176 A1 WO 2010043176A1 CN 2009074435 W CN2009074435 W CN 2009074435W WO 2010043176 A1 WO2010043176 A1 WO 2010043176A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
detected
detected memory
leak
service process
Prior art date
Application number
PCT/CN2009/074435
Other languages
French (fr)
Chinese (zh)
Inventor
杨胜强
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2010043176A1 publication Critical patent/WO2010043176A1/en

Links

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

Definitions

  • the present invention relates to the field of computer applications, and in particular, to a method and apparatus for detecting a memory leak.
  • the memory used for data storage is a necessary resource for the business process to run.
  • the business process needs to apply before using the memory, and starts to occupy the memory.
  • the memory is released in time.
  • the memory occupied by the business process is usually divided into two cases. One is the exclusive use of memory. When the memory is occupied by a business process and is occupied, it cannot be applied and occupied by other business processes. When the memory is released into the memory resource pool by the currently occupied service process, the memory can be applied and occupied by other service processes. Another situation is the reuse of memory, that is, memory can be occupied by at least two business processes at the same time.
  • memory can record its own references, indicating that it is referenced by multiple business processes, that is, each memory can be occupied by multiple business processes.
  • a memory leak means that the business process does not release the memory after using the memory for various reasons. Memory leaks can cause fewer and fewer memory applications to be applied and occupied by business processes in the system, and eventually the system will exit the service due to insufficient memory. Therefore, the detection of memory leaks is very important.
  • the method for detecting a memory leak is: determining whether the occupied time of the memory occupied by the business process exceeds a life cycle preset for the memory, and when the occupied time of the memory exceeds the life cycle, determining the memory is Whether the number of references by the business process is zero. If it is zero, it is determined that the memory has a memory leak. If it is not zero, it is determined that there is no memory leak in the memory.
  • Embodiments of the present invention provide a method and apparatus for detecting a memory leak, which can accurately detect a memory leak and avoid a false positive phenomenon.
  • the embodiment of the invention discloses a method for detecting a memory leak, the method comprising: first determining a life cycle of the memory setting; and when the result of the first determining process is YES, triggering a second determining process, the The determining process is specifically: determining whether the detected memory is being used by a service process of the detected memory; when the result of the second determining process is YES, determining that the detected memory has no memory leak When the result of the second determining process is no, it is determined that a memory leak occurs in the detected memory.
  • the embodiment of the invention discloses a device for detecting a memory leak, the device comprising: a life cycle of the first detection setting, if yes, triggering a second detection unit; and a second detection unit, configured to determine whether the detected memory is It is used by the business process that is being applied for the detected memory, and if so, it is determined that no memory leak has occurred in the detected memory, and if not, it is determined that a memory leak occurs in the detected memory.
  • the independent reverse traceability judgment is performed, that is, the service process applying for the memory is located, and then the judgment is performed.
  • the memory is actually used by the business process. If it is determined that the business process has ended or the memory has been released by the business process, it is finally determined that a memory leak has occurred in the detected memory. This can prevent the occurrence of memory leak misjudgment and avoid the problem that the system leaks due to memory leak misjudgment.
  • FIG. 1 is a flow chart of a first embodiment of a method for detecting a memory leak according to the present invention
  • Figure 2 is a schematic diagram of the same memory being reused by three business processes
  • FIG. 3 is a structural diagram of a first embodiment of a memory leak detecting device of the present invention.
  • FIG. 4 is a flow chart of a second embodiment of a method for detecting a memory leak according to the present invention
  • FIG. 5 is a structural diagram of a second embodiment of a memory leak detecting apparatus according to the present invention.
  • FIG. 6 is a structural diagram of a third embodiment of a method for detecting a memory leak according to the present invention. detailed description
  • FIG. 1 is a flowchart of a first embodiment of a method for detecting a memory leak according to the present invention.
  • the detecting method may include the following steps:
  • Step 101 Determine whether the time that the detected memory is currently occupied by the service process exceeds the life cycle set in advance for the detected memory, and if yes, proceed to step 102;
  • the detected memory can be occupied by only one service process at the same time, and can also be reused by multiple service processes.
  • a unified life cycle may be preset for each service process, or different life cycles may be set for different business processes according to the business process logic of the business process. value.
  • three service processes sequentially refer to the same block of memory as an example to illustrate the process of determining the lifetime value of the detected memory.
  • Service process 1 applies for a block of memory at time tl.
  • the lifetime of the memory is T1.
  • business process 2 applies for the same block of memory at time t2.
  • the lifetime of the memory is T2.
  • the service process 1 and the service process 2 reuse the same memory.
  • the life cycle of the memory is updated.
  • the updated memory life cycle is the business process 2
  • the remaining time of the memory in the business process 1 and the maximum lifetime of the memory under the business process 2 or the remaining time of the memory in the business process 1 and the business process when the business process 2 refers to the memory 2
  • the sum of the lifetime values of the memory is T3.
  • the updated life cycle is the remaining time of the memory in the business process 2 when the memory is referenced by the business process 3 and the memory of the business process 3
  • Step 102 Determine whether the detected memory is being used by the service process of the detected memory, if yes, proceed to step 103, if no, proceed to step 104;
  • the above steps only determine whether the detected memory is used by the service process when the detected memory is applied by one service process at the same time. When the detected memory is applied for and reused by multiple service processes at the same time, the above steps are performed. It is necessary to judge whether the detected memory is used by each business process one by one. When there is a business process that is actually using the detected memory, it is determined that there is no memory leak in the detected memory, when all the applications for detecting the memory are detected. When the process does not use the detected memory, it is determined that a memory leak occurs in the detected memory.
  • the present invention does not limit the order of judgment of various business processes, and the order of judgment can be arbitrarily set.
  • a preferred method is that when it is first determined that a certain service process is using the detected memory, the determination process may be terminated, and the detected memory is determined. No memory leaks have occurred.
  • the determining process in the foregoing steps specifically includes: first identifying, according to the service process identifier, a service process that applies for the detected memory; and then determining whether the service process exists and whether a memory address saved by the service process is related to the The address of the memory is the same.
  • the determination result is yes, when the service process does not exist or/and If the memory address saved by the business process is different from the address of the detected memory, the determination result is no.
  • Step 103 Determine that no memory leak occurs in the detected memory, and end the process
  • the step may further include: resetting a life cycle of the detected memory.
  • the purpose of resetting the detected memory life cycle is to allow the detected memory to be re-detected in the next cycle.
  • Step 104 Determine that a memory leak occurs in the detected memory, and end the process.
  • the step may further include: releasing the detected memory.
  • FIG. 3 is a structural diagram of a first embodiment of a memory leak detecting apparatus according to the present invention.
  • the apparatus includes a first detecting unit 301 and a second detecting unit 302.
  • the internal structure and connection relationship will be further described below in conjunction with the working principle of the device.
  • the life cycle of the detected memory if yes, triggering the second detecting unit 302;
  • the second detecting unit 302 is configured to determine whether the detected memory is being used by a service process that is applied to the detected memory, and if yes, determine that no memory leak occurs in the detected memory, and if not, determine that the memory is Check for memory leaks in memory.
  • the embodiment may further include a releasing unit 305, configured to release the detected memory after the second detecting unit 302 determines that a memory leak occurs in the detected memory.
  • the embodiment may further include a lifecycle resetting unit 306, configured to reset the life cycle of the detected memory after the second detecting unit 302 determines that no memory leak occurs in the detected memory.
  • a lifecycle resetting unit 306 configured to reset the life cycle of the detected memory after the second detecting unit 302 determines that no memory leak occurs in the detected memory.
  • the second detecting unit 302 includes an identifying unit 303, configured to identify a service process for applying the detected memory according to the service process identifier, and a determining unit 304, configured to determine whether the service process exists and the service process is Whether the stored memory address is the same as the address of the detected memory, and if so, it is determined that no memory leak has occurred in the detected memory, and if not, it is determined that a memory leak occurs in the detected memory.
  • the independent reverse traceability judgment is performed, that is, the service process applying for the memory is located, and according to the business process.
  • the service process applying for the memory is located, and according to the business process.
  • FIG. 4 it is a flowchart of a second embodiment of a method for detecting a memory leak according to the present invention.
  • the difference from the first embodiment is that, in the embodiment, when the Detection When the memory is being used by a business process, the lifecycle set in advance for the detected memory is modified.
  • the detection method can include the following steps:
  • Step 401 Determine whether the time that the detected memory is currently occupied by the service process exceeds a life cycle set in advance for the detected memory, and if yes, proceed to step 402;
  • the detected memory can be occupied by only one service process at the same time, and can also be reused by multiple service processes.
  • a unified memory life cycle may be preset for each business process, or different memory may be set according to business process logic of the business process. Life cycle value.
  • Step 402 Determine whether the detected memory is being used by the service process of the detected memory, if yes, proceed to step 403, if no, proceed to step 405;
  • the foregoing step only judges whether the detected memory is used by the service process, and when the detected memory is applied and reused by multiple service processes at the same time, the above The steps need to determine whether the detected memory is used by each business process one by one. When there is a business process that is actually using the detected memory, it is determined that no memory leak occurs in the detected memory, when all applications and reuses are detected. When the memory of the service process does not use the detected memory, it is determined that a memory leak occurs in the detected memory.
  • the present invention does not limit the order of judgment of various business processes, and the order of judgment can be arbitrarily set.
  • a preferred method is that when it is first determined that a certain service process is using the detected memory, the determination process may be terminated, and the detected memory is determined. No memory leaks have occurred.
  • Step 403 Determine that no memory leak occurs in the detected memory.
  • Step 404 Add a life cycle set in advance for the detected memory, and end the process; wherein, according to the business processing logic of each business process, different life cycle values are set for different business processes and the detected memory is simultaneously When a business process is reused, it is necessary to comprehensively determine the life cycle of a detected memory according to the lifetime value of each business process.
  • the determining method has been described in detail in the first embodiment of the memory leak detecting method. Let me repeat. In this step, the added life cycle is the lifetime value of the detected memory determined by the life cycle value of each business process.
  • Step 405 Determine that a memory leak occurs in the detected memory, and end the process.
  • the step may further include: releasing the detected memory.
  • the embodiment of the present invention further provides a memory leak detecting device.
  • FIG. 5 is a structural diagram of a second embodiment of a memory leak detecting apparatus according to the present invention, the apparatus includes a first detecting unit 501, a second detecting unit 502, and a life cycle increasing unit 503. The internal structure and connection relationship will be further described below in conjunction with the working principle of the device.
  • the first detecting unit 501 is configured to determine whether the time occupied by the detected memory by the service process exceeds a life cycle set in advance for the detected memory, and if so, triggering the second detecting unit 502;
  • the second detecting unit 502 is configured to determine whether the detected memory is being used by a service process that is applied to the detected memory, and if yes, determining that a memory leak does not occur in the detected memory, triggering a lifecycle increasing unit 503, If not, it is determined that a memory leak has occurred in the detected memory.
  • the life cycle increasing unit 503 is configured to increase the life cycle of the detected memory after the second detecting unit 502 determines that the detected memory does not have a memory leak.
  • the embodiment may further include a release unit, configured to release the detected memory after the second detecting unit 502 determines that a memory leak occurs in the detected memory.
  • the second detecting unit 502 includes an identifying unit, configured to identify a service process for applying the detected memory according to the service process identifier, and a determining unit, configured to determine whether the service process exists, and determine the detected memory. No memory leak occurred, and if not, it is determined that a memory leak has occurred in the detected memory.
  • the independent reverse traceability judgment is performed, that is, the service process of applying for the memory is located, and according to the business process.
  • the service process of applying for the memory is located, and according to the business process.
  • it is determined that the detected memory is not used by the business process it is determined that the detected memory is not out. Now the memory leaks.
  • by adding the life cycle to reset the lifetime value of the detected memory it is prevented that the memory is detected again and the misjudgment occurs, and the memory detection is prevented from being too frequent, and the system CPU is wasted processing resources.
  • the service process sets different memory lifecycle values for the memory applied by different service scenarios in different service scenarios, thereby avoiding the above problems and making the system operation more stable. Referring to FIG.
  • this embodiment is a preferred method for memory detection when a detected memory is exclusively occupied by one service process.
  • a memory information record is generated, and the related information of the memory is recorded, which may include: a memory address, a memory application time, a service process identifier, a lifetime of the detected memory, and a remaining time, and then The memory information record is placed into an in-memory repository.
  • the business process releases the memory successfully, the memory information record in the memory information library is released.
  • the detection method includes the following steps:
  • Step 601 Access the memory information library, and find the memory with zero remaining time, and use this memory as the detected memory;
  • the remaining time in the memory record the life cycle of the detected memory - the current occupied time of the detected memory
  • the current occupied time of the detected memory the current time of the system - the memory application time.
  • the memory application time is the time point recorded when the business process requests this memory successfully;
  • the lifetime of the detected memory is the time occupied by the business process set in advance for the detected memory, which is an approximate estimated value.
  • the life cycle may preset a unified memory life cycle for each business process, or set different memory life cycle values for different business processes according to the business process logic of the business process.
  • a preferred solution is: Temporary memory applied within a function, the life cycle can be directly filled in 0, indicating that the requested memory is released immediately after the function is executed. If the memory is requested when sending a message, since the message memory is released from the application to the slave port, Generally it will not exceed 1000ms, so the life cycle can be set to 1000ms. If there is some complicated process processing, it is necessary to release the memory until the end of the process.
  • the business module can basically determine the life cycle of the applied memory according to the process and system processing performance.
  • the remaining time takes a value of 0.
  • the remaining time of the detected memory is not 0, it indicates that the current occupied time of the detected memory does not exceed the life cycle of the detected memory, and no memory leak occurs in the detected memory at this time.
  • Step 602 Identify, according to the service process identifier in the memory record, a service process that applies for the detected memory.
  • a service process identifier uniquely identifies a service process, which may be the address of the service process control block or the number of the service process control block.
  • Step 603 Determine whether the detected memory is occupied by the service process indicated by the service process identifier, if yes, go to step 604, if no, go to step 605;
  • the remaining time of the detected memory when the remaining time of the detected memory is 0, it indicates that the current occupied time of the detected memory has exceeded the life cycle of the detected memory, and if the occupied time of the detected memory is related to the duration of the business process, in order to prevent misjudgment, It is necessary to further determine whether the detected memory is being occupied by a business process indicated by the service identifier.
  • the above step 603 can be specifically implemented by a business process detection function, which has two parameters: a memory address and a business process identifier.
  • the service process generally records the memory address requested by the service process control block, determines the corresponding service process control block by the service process identifier, and determines whether the service process exists in the service process control block and the service process control block
  • the saved memory address is the same as the memory address of the business process detection function input parameter. If yes, it is determined that the detected memory is occupied by the business process indicated by the service process identifier. If not, it is determined that the detected memory is not indicated by the service process identifier. Business process is occupied.
  • Step 604 determining that no memory leak occurs in the detected memory, increasing the life cycle of the detected memory, and ending the process;
  • a preferred method is to double the original life cycle.
  • Step 605 determining that a memory leak occurs in the detected memory, according to the memory address in the memory record. Release the detected memory and end the process.
  • the detected memory When the detected memory is not occupied by the service process indicated by the service identifier, it indicates that the detected memory has a leak, and the actual physical address of the detected memory is found according to the memory address in the memory record of the detected memory. And release the detected memory.
  • the independent reverse traceability judgment is performed, that is, the service process applying for the memory is located, and according to the business process.
  • the service process applying for the memory is located, and according to the business process.
  • the occurrence of memory leak misjudgment can be completely solved, and the problem that the service leakage is affected due to the memory leak misjudgment is avoided.
  • the life cycle value is reset for the detected memory to prevent the memory from being detected again. A case of misjudgment.
  • the service process sets different memory lifecycle values for the memory applied by different service scenarios in different service scenarios, thereby avoiding the above problems and making the system operation more stable.
  • the first judging process, the second judging process has a life cycle; when the result of the first judging process is yes, the second judging process is triggered, specifically: determining whether the detected memory is being applied for The service process of the detected memory is used; when the result of the second determining process is YES, it is determined that no memory leak occurs in the detected memory, and when the result of the second determining process is no, the determining A memory leak occurs in the detected memory.
  • the storage medium is, for example, a ROM/RAM, a magnetic disk, an optical disk, or the like.

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

A memory leak detecting method and device, the method comprises: first judgement process, judging whether the current occupied time of a detected memory exceeds a life period preset for the detected memory; and triggering second judgement process when the result of the first judgement process is yes; the second judgement process, judging whether the detected memory is being used by a service process requesting the detected memory; when the result of the second judgement process is yes, confirming that there is no memory leak of the detected memory, when the result of the second judgement process is no, confirming that there is memory leak of the detected memory. A memory leak can be detected accurately and error determination phenomenon is avoided according to the detecting method and device.

Description

内存泄漏的检测方法和装置  Memory leak detection method and device
本申请要求于 2008 年 10 月 17 日提交中国专利局、 申请号为 200810201396.0、 发明名称为"内存泄漏的检测方法和装置 "的中国专利申请的 优先权, 其全部内容通过引用结合在本申请中。  The present application claims priority to Chinese Patent Application No. 200810201396.0, entitled "Detecting Method and Apparatus for Memory Leakage", filed on October 17, 2008, the entire contents of which is incorporated herein by reference. .
技术领域 Technical field
本发明涉及计算机应用领域, 特别是涉及一种内存泄漏的检测方法和装 置。  The present invention relates to the field of computer applications, and in particular, to a method and apparatus for detecting a memory leak.
背景技术 Background technique
用于数据存储的内存是业务进程运行的必需资源,业务进程在使用内存前 需要提出申请, 并开始占用该内存, 当使用完内存后再及时释放内存。 内存被 业务进程的占用通常分为两种情况, 一种是内存的独占, 即当内存被一种业务 进程占用而处于被占用状态时, 就不能再被其它业务进程申请和占用, 只有当 该内存被当前占用的业务进程释放而重新并入内存资源池时,该内存才可以再 被其它业务进程申请和占用。 另一种情况是内存的重用, 即内存可以被至少两 个业务进程同时占用。在面向对象的编程技术里, 内存可以记录自身的引用情 况, 表示被多个业务进程引用, 也就是每个内存都可以被多个业务进程占用。 内存的泄漏就是指:由于各种原因会导致业务进程在使用完内存后没有将内存 释放掉。 内存泄漏会导致系统内可以被业务进程申请和占用内存越来越少, 最 终系统会由于内存不足而退出服务。 因此, 内存泄漏的检测是非常重要的。  The memory used for data storage is a necessary resource for the business process to run. The business process needs to apply before using the memory, and starts to occupy the memory. When the memory is used, the memory is released in time. The memory occupied by the business process is usually divided into two cases. One is the exclusive use of memory. When the memory is occupied by a business process and is occupied, it cannot be applied and occupied by other business processes. When the memory is released into the memory resource pool by the currently occupied service process, the memory can be applied and occupied by other service processes. Another situation is the reuse of memory, that is, memory can be occupied by at least two business processes at the same time. In object-oriented programming techniques, memory can record its own references, indicating that it is referenced by multiple business processes, that is, each memory can be occupied by multiple business processes. A memory leak means that the business process does not release the memory after using the memory for various reasons. Memory leaks can cause fewer and fewer memory applications to be applied and occupied by business processes in the system, and eventually the system will exit the service due to insufficient memory. Therefore, the detection of memory leaks is very important.
在现有技术中, 内存泄漏的检测方法为: 判断被业务进程所占用的内存的 占用时间是否超过为内存预先设定的一个生命周期,当内存的占用时间超过生 命周期时, 再判断内存被业务进程所引用的个数是否为零, 如果为零, 认定该 内存发生内存泄漏, 如果不为零, 认定该内存没有发生内存泄漏。  In the prior art, the method for detecting a memory leak is: determining whether the occupied time of the memory occupied by the business process exceeds a life cycle preset for the memory, and when the occupied time of the memory exceeds the life cycle, determining the memory is Whether the number of references by the business process is zero. If it is zero, it is determined that the memory has a memory leak. If it is not zero, it is determined that there is no memory leak in the memory.
但是,发明人在研究中发现现有技术存在的问题: 内存的引用数是业务进 程在释放内存时而更新的, 当业务进程没有正确执行释放内存的过程时, 就会 导致内存自身所记录的引用数错误, 因此,通过内存自身记录的引用数来判断 内存是否泄漏就会出现误判的可能。当由于误判而错误地释放内存或不及时释 放泄漏的内存都会进一步影响现有系统的正常运行。 发明内容 However, the inventors found problems in the prior art in the research: The number of references to memory is updated when the business process releases the memory. When the business process does not correctly execute the process of releasing the memory, it will cause the reference recorded by the memory itself. The number is wrong. Therefore, it is possible to judge whether the memory leaks through the number of references recorded by the memory itself. When the memory is erroneously released due to misjudgment or the leaked memory is not released in time, the normal operation of the existing system is further affected. Summary of the invention
本发明实施例提供了一种内存泄露的检测方法和装置,能够准确地检测内 存泄漏, 避免误判现象。  Embodiments of the present invention provide a method and apparatus for detecting a memory leak, which can accurately detect a memory leak and avoid a false positive phenomenon.
本发明实施例公开了一种内存泄漏的检测方法, 所述方法包括: 第一判断 内存设置的生命周期;当所述第一判断过程的结果为是时,触发第二判断过程, 所述第二判断过程具体为:判断所述被检测内存是否正在被申请所述被检测内 存的业务进程所使用; 当所述第二判断过程的结果为是时, 判定所述被检测内 存没有发生内存泄漏, 当所述第二判断过程的结果为否时, 判定所述被检测内 存发生内存泄漏。  The embodiment of the invention discloses a method for detecting a memory leak, the method comprising: first determining a life cycle of the memory setting; and when the result of the first determining process is YES, triggering a second determining process, the The determining process is specifically: determining whether the detected memory is being used by a service process of the detected memory; when the result of the second determining process is YES, determining that the detected memory has no memory leak When the result of the second determining process is no, it is determined that a memory leak occurs in the detected memory.
本发明实施例公开了一种内存泄漏的检测装置, 所述装置包括: 第一检测 设置的生命周期, 如果是, 触发第二检测单元; 第二检测单元, 用于判断所述 被检测内存是否正在被申请所述被检测内存的业务进程所使用, 如果是, 判定 所述被检测内存没有发生内存泄漏,如果否, 判定所述被检测内存发生内存泄 漏。  The embodiment of the invention discloses a device for detecting a memory leak, the device comprising: a life cycle of the first detection setting, if yes, triggering a second detection unit; and a second detection unit, configured to determine whether the detected memory is It is used by the business process that is being applied for the detected memory, and if so, it is determined that no memory leak has occurred in the detected memory, and if not, it is determined that a memory leak occurs in the detected memory.
由上述本发明的实施例可以看出,在判断出被检测内存的当前被占用时间 超过预期生命周期时,通过独立的反向溯源判断, 即定位到申请此内存的业务 进程, 进而判断所述内存被业务进程真实的使用情况。如果确定业务进程已经 结束或所述内存已经被业务进程释放, 则最终判定该被检测内存发生内存泄 漏。从而可以防止内存泄漏误判的发生,避免了由于内存泄漏误判影响系统正 常运行的问题。  It can be seen from the foregoing embodiment of the present invention that when it is determined that the current occupied time of the detected memory exceeds the expected life cycle, the independent reverse traceability judgment is performed, that is, the service process applying for the memory is located, and then the judgment is performed. The memory is actually used by the business process. If it is determined that the business process has ended or the memory has been released by the business process, it is finally determined that a memory leak has occurred in the detected memory. This can prevent the occurrence of memory leak misjudgment and avoid the problem that the system leaks due to memory leak misjudgment.
附图说明 DRAWINGS
图 1为本发明一种内存泄漏的检测方法的第一个实施例流程图;  1 is a flow chart of a first embodiment of a method for detecting a memory leak according to the present invention;
图 2为同一个内存被三个业务进程重用的示意图;  Figure 2 is a schematic diagram of the same memory being reused by three business processes;
图 3为本发明一种内存泄漏的检测装置的第一个实施例结构图  3 is a structural diagram of a first embodiment of a memory leak detecting device of the present invention;
图 4为本发明一种内存泄漏的检测方法的第二个实施例流程图  4 is a flow chart of a second embodiment of a method for detecting a memory leak according to the present invention
图 5为本发明一种内存泄漏的检测装置的第二个实施例结构图  FIG. 5 is a structural diagram of a second embodiment of a memory leak detecting apparatus according to the present invention; FIG.
图 6为本发明一种内存泄漏的检测方法的第三个实施例结构图 具体实施方式 6 is a structural diagram of a third embodiment of a method for detecting a memory leak according to the present invention; detailed description
为使本发明的上述目的、特征和优点能够更加明显易懂, 下面结合附图对 本发明实施例进行详细描述。 请参阅图 1 , 其为本发明一种内存泄漏的检测方法的第一个实施例的流程 图, 其检测方法可以包括以下步骤:  The above described objects, features, and advantages of the present invention will become more apparent from the aspects of the invention. Please refer to FIG. 1 , which is a flowchart of a first embodiment of a method for detecting a memory leak according to the present invention. The detecting method may include the following steps:
步骤 101 : 判断被检测内存当前被业务进程所占用的时间是否超过预先为 所述被检测内存设置的生命周期, 如果是, 进入步骤 102;  Step 101: Determine whether the time that the detected memory is currently occupied by the service process exceeds the life cycle set in advance for the detected memory, and if yes, proceed to step 102;
其中,被检测内存同一时刻可以只被一个业务进程独占, 也可以被多个业 务进程重用。 其中, 当被检测内存同时被多个业务进程重用时, 可以针对每一 种业务进程预先设置一个统一的生命周期,也可以根据业务进程的业务处理逻 辑,针对不同的业务进程设置不同的生命周期值。 当不同的业务进程在重复引 用同一块内存时, 这里, 以三个业务进程先后引用同一块内存为例来说明被检 测内存的生命周期值的确定过程。 业务进程 1在时间点 tl 申请一块内存, 在 业务进程 1下, 该内存的生命周期为 T1 , 之后, 在业务进程 1还没有释放该 内存时, 业务进程 2又在时间点 t2申请同一块内存, 在业务进程 2下, 该内 存的生命周期为 T2。 如图 2所示, 此时, 业务进程 1和业务进程 2重用同一 个内存, 当业务进程 2引用该内存时, 更新该内存的生命周期, 此时, 更新后 的内存生命周期为业务进程 2引用该内存时该内存在业务进程 1中的剩余时间 与业务进程 2下该内存的生命周期的最大值,或者为业务进程 2引用该内存时 该内存在业务进程 1中的剩余时间与业务进程 2下该内存的生命周期值之和。 之后, 又有业务进程 3在时间点 t3申请该内存, 并且在业务进程 3下, 该内 存的生命周期为 T3。 当业务进程 3引用该内存时, 又重新更新该内存的生命 周期, 则更新后的生命周期为业务进程 3 引用该内存时该内存在业务进程 2 中的剩余时间与业务进程 3下该内存的生命周期的最大值, 或者为业务进程 3 引用该内存时该内存在业务进程 2中的剩余时间与业务进程 3下该内存的生命 周期之和, 以此类推。  The detected memory can be occupied by only one service process at the same time, and can also be reused by multiple service processes. When the detected memory is reused by multiple service processes at the same time, a unified life cycle may be preset for each service process, or different life cycles may be set for different business processes according to the business process logic of the business process. value. When different business processes repeatedly refer to the same block of memory, here, three service processes sequentially refer to the same block of memory as an example to illustrate the process of determining the lifetime value of the detected memory. Service process 1 applies for a block of memory at time tl. In business process 1, the lifetime of the memory is T1. Then, when service process 1 has not released the memory, business process 2 applies for the same block of memory at time t2. In business process 2, the lifetime of the memory is T2. As shown in Figure 2, at this time, the service process 1 and the service process 2 reuse the same memory. When the service process 2 refers to the memory, the life cycle of the memory is updated. At this time, the updated memory life cycle is the business process 2 When the memory is referenced, the remaining time of the memory in the business process 1 and the maximum lifetime of the memory under the business process 2, or the remaining time of the memory in the business process 1 and the business process when the business process 2 refers to the memory 2 The sum of the lifetime values of the memory. After that, another business process 3 applies for the memory at time t3, and under business process 3, the lifetime of the memory is T3. When the service process 3 references the memory, and the life cycle of the memory is re-updated, the updated life cycle is the remaining time of the memory in the business process 2 when the memory is referenced by the business process 3 and the memory of the business process 3 The maximum value of the life cycle, or the sum of the remaining time of the memory in business process 2 and the life cycle of the memory under business process 3 when business process 3 refers to the memory, and so on.
在上述步骤中, 当判断结果为否时, 判定所述被检测内存没有发生内存泄 漏。 步骤 102: 判断所述被检测内存是否正在被申请所述被检测内存的业务进 程所使用, 如果是, 进入步骤 103 , 如果否, 进入步骤 104; In the above steps, when the determination result is no, it is determined that no memory leak has occurred in the detected memory. Step 102: Determine whether the detected memory is being used by the service process of the detected memory, if yes, proceed to step 103, if no, proceed to step 104;
其中, 当被检测内存同一时刻只被一个业务进程申请并独占时, 上述步骤 只判断被检测内存是否被这个业务进程所使用,当被检测内存同一时刻被多个 业务进程申请并重用时,上述步骤需要逐一判断被检测内存是否被每个业务进 程所使用, 当存在一个业务进程正在真正地使用所述被检测内存时, 判定所述 被检测内存没有发生内存泄漏,当所有申请被检测内存的业务进程都没有使用 所述被检测内存时, 判定所述被检测内存发生内存泄漏。  The above steps only determine whether the detected memory is used by the service process when the detected memory is applied by one service process at the same time. When the detected memory is applied for and reused by multiple service processes at the same time, the above steps are performed. It is necessary to judge whether the detected memory is used by each business process one by one. When there is a business process that is actually using the detected memory, it is determined that there is no memory leak in the detected memory, when all the applications for detecting the memory are detected. When the process does not use the detected memory, it is determined that a memory leak occurs in the detected memory.
本发明并不对各种业务进程的判断顺序进行限定,其判断顺序可以任意设 定。在逐一判断被检测内存是否被所有业务进程所使用时,一个优选的方法是, 当首次判断出某个业务进程正在使用所述被检测内存时, 即可终止判断过程, 判定所述被检测内存没有发生内存泄漏。  The present invention does not limit the order of judgment of various business processes, and the order of judgment can be arbitrarily set. When it is judged one by one whether the detected memory is used by all the business processes, a preferred method is that when it is first determined that a certain service process is using the detected memory, the determination process may be terminated, and the detected memory is determined. No memory leaks have occurred.
上述步骤中的判断过程具体包括: 首先根据业务进程标识,识别出申请所 述被检测内存的业务进程;然后判断所述业务进程是否存在且所述业务进程所 保存的内存地址是否与所述被检测内存的地址相同,当所述业务进程存在且所 述业务进程所保存的内存地址与所述被检测内存的地址相同时 ,该判断结果为 是, 当所述业务进程不存在或 /和所述业务进程所保存的内存地址与所述被检 测内存的地址不相同时, 该判断结果为否。  The determining process in the foregoing steps specifically includes: first identifying, according to the service process identifier, a service process that applies for the detected memory; and then determining whether the service process exists and whether a memory address saved by the service process is related to the The address of the memory is the same. When the service process exists and the memory address saved by the service process is the same as the address of the detected memory, the determination result is yes, when the service process does not exist or/and If the memory address saved by the business process is different from the address of the detected memory, the determination result is no.
步骤 103: 判定所述被检测内存没有发生内存泄漏, 结束流程;  Step 103: Determine that no memory leak occurs in the detected memory, and end the process;
其中, 当判定被检测内存没有发生内存泄漏后, 本步骤还可以包括: 重新 设置所述被检测内存的生命周期。重新设置所述被检测内存生命周期的目的就 是使被检测内存可以再下一个周期重新被检测。  After determining that no memory leak occurs in the detected memory, the step may further include: resetting a life cycle of the detected memory. The purpose of resetting the detected memory life cycle is to allow the detected memory to be re-detected in the next cycle.
步骤 104: 判定所述被检测内存发生内存泄漏, 结束流程。  Step 104: Determine that a memory leak occurs in the detected memory, and end the process.
其中, 当判定被检测内存发生内存泄漏后, 本步骤还可以包括: 释放被检 测内存。  After determining that a memory leak occurs in the detected memory, the step may further include: releasing the detected memory.
与上述一种内存泄漏的检测方法相对应,本发明实施例还提供了一种内存 泄漏的检测装置。 请参阅图 3 , 其为本发明一种内存泄漏的检测装置的第一个 实施例结构图, 该装置包括第一检测单元 301和第二检测单元 302。 下面结合 该装置的工作原理进一步介绍其内部结构以及连接关系。 为所述被检测内存设置的生命周期, 如果是, 触发第二检测单元 302; Corresponding to the above-mentioned method for detecting a memory leak, the embodiment of the present invention further provides a device for detecting a memory leak. Please refer to FIG. 3, which is a structural diagram of a first embodiment of a memory leak detecting apparatus according to the present invention. The apparatus includes a first detecting unit 301 and a second detecting unit 302. The internal structure and connection relationship will be further described below in conjunction with the working principle of the device. The life cycle of the detected memory, if yes, triggering the second detecting unit 302;
第二检测单元 302, 用于判断所述被检测内存是否正在被申请所述被检测 内存的业务进程所使用, 如果是, 判定所述被检测内存没有发生内存泄漏, 如 果否, 判定所述被检测内存发生内存泄漏。  The second detecting unit 302 is configured to determine whether the detected memory is being used by a service process that is applied to the detected memory, and if yes, determine that no memory leak occurs in the detected memory, and if not, determine that the memory is Check for memory leaks in memory.
本实施例还可以包括释放单元 305 , 用于当第二检测单元 302判定所述被 检测内存发生内存泄漏后, 释放所述被检测内存。  The embodiment may further include a releasing unit 305, configured to release the detected memory after the second detecting unit 302 determines that a memory leak occurs in the detected memory.
本实施例还可以包括生命周期重设单元 306, 用于当第二检测单元 302判 定所述被检测内存没有发生内存泄漏后, 重新设置所述被检测内存的生命周 期。  The embodiment may further include a lifecycle resetting unit 306, configured to reset the life cycle of the detected memory after the second detecting unit 302 determines that no memory leak occurs in the detected memory.
其中, 第二检测单元 302包括识别单元 303 , 用于根据业务进程标识, 识 别出申请所述被检测内存的业务进程; 判断单元 304, 用于判断所述业务进程 是否存在且所述业务进程所保存的内存地址是否与所述被检测内存的地址相 同, 如果是, 判定所述被检测内存没有发生内存泄漏, 如果否, 判定所述被检 测内存发生内存泄漏。  The second detecting unit 302 includes an identifying unit 303, configured to identify a service process for applying the detected memory according to the service process identifier, and a determining unit 304, configured to determine whether the service process exists and the service process is Whether the stored memory address is the same as the address of the detected memory, and if so, it is determined that no memory leak has occurred in the detected memory, and if not, it is determined that a memory leak occurs in the detected memory.
由上述本发明的实施例可以看出,在判断出被检测内存的当前被占用时间 超过预期生命周期时,通过独立的反向溯源判断, 即定位到申请此内存的业务 进程, 并根据业务进程的实际使用情况,如果确定业务进程已经结束或内存已 经被业务进程释放, 则最终判定该被检测内存发生内存泄漏。从而可以彻底防 止内存泄漏误判的发生, 避免了由于内存泄漏误判影响业务正常执行的问题。  It can be seen from the foregoing embodiment of the present invention that when it is determined that the current occupied time of the detected memory exceeds the expected life cycle, the independent reverse traceability judgment is performed, that is, the service process applying for the memory is located, and according to the business process. In actual use, if it is determined that the business process has ended or the memory has been released by the business process, it is finally determined that a memory leak occurs in the detected memory. Therefore, the occurrence of memory leak misjudgment can be completely prevented, and the problem of normal execution of the service due to memory leak misjudgment is avoided.
此外, 当使用统一的预先设定的一个内存生命周期时, 不能适应多样的内 存使用场景。 例如, 有些耗时较长的业务进程还在正常使用内存, 但由于超时 而重复进行内存泄漏检查,导致系统处理资源的浪费。 而有些耗时较短的内存 有可能由于当前的占用时间没有达到生命周期而不能及时被检测出来。本发明 实施例根据业务进程的业务处理逻辑,由业务进程分别为各种不同场景申请的 内存设置不同的内存生命周期值, 避免了以上问题, 使系统运行将更为稳定。 请参阅图 4, 其为本发明一种内存泄漏的检测方法的第二个实施例的流程 图, 与上述第一个实施例的不同之处在于, 在本实施例中, 当判定所述被检测 内存正在被某个业务进程使用时, 修改预先为所述被检测内存设置的生命周 期。 其检测方法可以包括以下步骤: In addition, when using a unified pre-set memory lifecycle, it is not possible to adapt to a variety of memory usage scenarios. For example, some time-consuming business processes still use memory normally, but repeated memory leak checks due to timeouts cause the system to waste resources. Some of the less time-consuming memories may not be detected in time because the current occupied time has not reached the life cycle. In the embodiment of the present invention, according to the service processing logic of the service process, the service process sets different memory lifecycle values for the memory applied for different scenarios, thereby avoiding the above problems and making the system operation more stable. Referring to FIG. 4, it is a flowchart of a second embodiment of a method for detecting a memory leak according to the present invention. The difference from the first embodiment is that, in the embodiment, when the Detection When the memory is being used by a business process, the lifecycle set in advance for the detected memory is modified. The detection method can include the following steps:
步骤 401: 判断被检测内存当前被业务进程所占用的时间是否超过预先为 所述被检测内存设置的生命周期, 如果是, 进入步骤 402;  Step 401: Determine whether the time that the detected memory is currently occupied by the service process exceeds a life cycle set in advance for the detected memory, and if yes, proceed to step 402;
其中,被检测内存同一时刻可以只被一个业务进程独占, 也可以被多个业 务进程重用。 其中, 当被检测内存同时被多个业务进程重用时, 可以针对每一 种业务进程预先设置一个统一的内存生命周期,也可以根据业务进程的业务处 理逻辑, 针对不同的业务进程设置不同的内存生命周期值。  The detected memory can be occupied by only one service process at the same time, and can also be reused by multiple service processes. When the detected memory is reused by multiple service processes at the same time, a unified memory life cycle may be preset for each business process, or different memory may be set according to business process logic of the business process. Life cycle value.
上述步骤中,当判断结果为否时,判定所述被检测内存没有发生内存泄漏。 步骤 402: 判断所述被检测内存是否正在被申请所述被检测内存的业务进 程所使用, 如果是, 进入步骤 403 , 如果否, 进入步骤 405;  In the above steps, when the determination result is no, it is determined that no memory leak has occurred in the detected memory. Step 402: Determine whether the detected memory is being used by the service process of the detected memory, if yes, proceed to step 403, if no, proceed to step 405;
其中, 当被检测内存同一时刻只被一个业务进程申请和独占时, 上述步骤 只判断被检测内存是否被这个业务进程所使用,当被检测内存同一时刻被多个 业务进程申请和重用时,上述步骤需要逐一判断被检测内存是否被每个业务进 程所使用, 当存在一个业务进程正在真正地使用所述被检测内存时, 判定所述 被检测内存没有发生内存泄漏,当所有申请和重用被检测内存的业务进程没有 使用所述被检测内存时, 判定所述被检测内存发生内存泄漏。  Wherein, when the detected memory is applied and exclusive by only one service process at the same time, the foregoing step only judges whether the detected memory is used by the service process, and when the detected memory is applied and reused by multiple service processes at the same time, the above The steps need to determine whether the detected memory is used by each business process one by one. When there is a business process that is actually using the detected memory, it is determined that no memory leak occurs in the detected memory, when all applications and reuses are detected. When the memory of the service process does not use the detected memory, it is determined that a memory leak occurs in the detected memory.
本发明并不对各种业务进程的判断顺序进行限定,其判断顺序可以任意设 定。在逐一判断被检测内存是否被没有业务进程所使用时,一个优选的方法是, 当首次判断出某个业务进程正在使用所述被检测内存时, 即可终止判断过程, 判定所述被检测内存没有发生内存泄漏。  The present invention does not limit the order of judgment of various business processes, and the order of judgment can be arbitrarily set. When it is judged one by one whether the detected memory is used by no business process, a preferred method is that when it is first determined that a certain service process is using the detected memory, the determination process may be terminated, and the detected memory is determined. No memory leaks have occurred.
步骤 403: 判定所述被检测内存没有发生内存泄漏;  Step 403: Determine that no memory leak occurs in the detected memory.
步骤 404: 增加预先为所述被检测内存设置的生命周期, 结束流程; 其中, 当根据每个业务进程的业务处理逻辑,针对不同的业务进程设置不 同的生命周期值且被检测内存同时被多个业务进程重用时,需要根据各个业务 进程的生命周期值综合确定一个被检测内存的生命周期,其确定方法已经在内 存泄漏的检测方法的第一个实施例中做了详细的介绍, 这里不再赘述。本步骤 中,增加的生命周期为所述由各个业务进程的生命周期值综合确定的被检测内 存的生命周期值。 步骤 405: 判定所述被检测内存发生内存泄漏, 结束流程。 Step 404: Add a life cycle set in advance for the detected memory, and end the process; wherein, according to the business processing logic of each business process, different life cycle values are set for different business processes and the detected memory is simultaneously When a business process is reused, it is necessary to comprehensively determine the life cycle of a detected memory according to the lifetime value of each business process. The determining method has been described in detail in the first embodiment of the memory leak detecting method. Let me repeat. In this step, the added life cycle is the lifetime value of the detected memory determined by the life cycle value of each business process. Step 405: Determine that a memory leak occurs in the detected memory, and end the process.
其中, 当判定被检测内存发生内存泄漏后, 本步骤还可以包括: 释放被检 测内存。  After determining that a memory leak occurs in the detected memory, the step may further include: releasing the detected memory.
与上述一种内存泄漏的检测方法相对应,本发明实施例还提供了一种内存 泄漏的检测装置。 请参阅图 5 , 其为本发明一种内存泄漏的检测装置的第二个 实施例结构图, 该装置包括第一检测单元 501、 第二检测单元 502和生命周期 增加单元 503。 下面结合该装置的工作原理进一步介绍其内部结构以及连接关 系。  Corresponding to the above-mentioned method for detecting a memory leak, the embodiment of the present invention further provides a memory leak detecting device. Referring to FIG. 5, which is a structural diagram of a second embodiment of a memory leak detecting apparatus according to the present invention, the apparatus includes a first detecting unit 501, a second detecting unit 502, and a life cycle increasing unit 503. The internal structure and connection relationship will be further described below in conjunction with the working principle of the device.
第一检测单元 501 , 用于判断被检测内存当前被业务进程所占用的时间是 否超过预先为所述被检测内存设置的生命周期, 如果是, 触发第二检测单元 502;  The first detecting unit 501 is configured to determine whether the time occupied by the detected memory by the service process exceeds a life cycle set in advance for the detected memory, and if so, triggering the second detecting unit 502;
第二检测单元 502, 用于判断所述被检测内存是否正在被申请所述被检测 内存的业务进程所使用, 如果是, 判定所述被检测内存没有发生内存泄漏, 触 发生命周期增加单元 503 , 如果否, 判定所述被检测内存发生内存泄漏。  The second detecting unit 502 is configured to determine whether the detected memory is being used by a service process that is applied to the detected memory, and if yes, determining that a memory leak does not occur in the detected memory, triggering a lifecycle increasing unit 503, If not, it is determined that a memory leak has occurred in the detected memory.
生命周期增加单元 503 , 用于当第二检测单元 502判定所述被检测内存没 有发生内存泄漏后, 增加所述被检测内存的生命周期。  The life cycle increasing unit 503 is configured to increase the life cycle of the detected memory after the second detecting unit 502 determines that the detected memory does not have a memory leak.
本实施例还可以包括释放单元,用于当第二检测单元 502判定所述被检测 内存发生内存泄漏后, 释放所述被检测内存。  The embodiment may further include a release unit, configured to release the detected memory after the second detecting unit 502 determines that a memory leak occurs in the detected memory.
其中, 第二检测单元 502包括识别单元, 用于根据业务进程标识, 识别出 申请所述被检测内存的业务进程; 判断单元, 用于判断所述业务进程是否存在 是, 判定所述被检测内存没有发生内存泄漏, 如果否, 判定所述被检测内存发 生内存泄漏。  The second detecting unit 502 includes an identifying unit, configured to identify a service process for applying the detected memory according to the service process identifier, and a determining unit, configured to determine whether the service process exists, and determine the detected memory. No memory leak occurred, and if not, it is determined that a memory leak has occurred in the detected memory.
由上述实施例可以看出,在判断出被检测内存的当前被占用时间超过预设 的生命周期时, 通过独立的反向溯源判断, 即定位到申请此内存的业务进程, 并根据业务进程的实际使用情况,如果确定业务进程已经结束或内存已经被业 务进程释放, 则最终判定该被检测内存发生内存泄漏。从而可以彻底防止内存 泄漏误判的发生, 避免了由于内存泄漏误判影响业务正常执行的问题。 同时, 如果确定被检测内存没有被这个业务进程所使用 ,则判定该被检测内存没有出 现内存泄漏, 此时, 通过增加生命周期来为被检测内存重新设置生命周期值, 防止再检测该内存时而又发生误判的情况, 同时避免对该内存检测过于频繁, 浪费系统 CPU处理资源。 It can be seen from the foregoing embodiment that when it is determined that the current occupied time of the detected memory exceeds a preset life cycle, the independent reverse traceability judgment is performed, that is, the service process of applying for the memory is located, and according to the business process. In actual use, if it is determined that the business process has ended or the memory has been released by the business process, it is finally determined that a memory leak occurs in the detected memory. Therefore, it is possible to completely prevent the occurrence of memory leak misjudgment, and avoid the problem that the memory leakage misjudgment affects the normal execution of the service. At the same time, if it is determined that the detected memory is not used by the business process, it is determined that the detected memory is not out. Now the memory leaks. At this time, by adding the life cycle to reset the lifetime value of the detected memory, it is prevented that the memory is detected again and the misjudgment occurs, and the memory detection is prevented from being too frequent, and the system CPU is wasted processing resources.
此外, 当使用统一的预先设定的一个内存生命周期时, 不能适应多样的内 存使用场景。 例如, 有些耗时较长的业务进程还在正常使用内存, 但由于超时 而重复进行内存泄漏检查,导致系统处理资源的浪费。 而有些耗时较短的内存 有可能由于当前的占用时间没有达到生命周期而不能及时被检测出来。本发明 实施例根据业务进程的业务处理逻辑,由业务进程分别为各种不同场景申请的 内存设置不同的内存生命周期值, 避免了以上问题, 使系统运行将更为稳定。 请参阅图 6所示,其为本发明一种内存泄漏的检测方法的第三个实施例的 流程图,本实施例为被检测内存被 1个业务进程独占时内存检测的一个优选方 式。 当业务进程申请内存成功后, 生成一条内存信息记录, 记录该内存的相关 信息, 可以包括: 内存地址、 内存申请时间、 业务进程标识、 所占用的被检测 内存的生命周期和剩余时间, 然后将内存信息记录放入到一个内存信息库。 当 业务进程释放内存成功后, 删除被释放内存在内存信息库中的内存信息记录。 当系统进入内存泄漏的检测流程后, 该检测方法包括以下步骤:  In addition, when using a unified pre-set memory lifecycle, it is not possible to adapt to a variety of memory usage scenarios. For example, some long-running business processes still use memory normally, but repeated memory leak checks due to timeouts cause the system to waste resources. Some of the less time-consuming memories may not be detected in time because the current occupied time has not reached the life cycle. According to the service processing logic of the service process, the service process sets different memory lifecycle values for the memory applied by different service scenarios in different service scenarios, thereby avoiding the above problems and making the system operation more stable. Referring to FIG. 6, which is a flowchart of a third embodiment of a method for detecting a memory leak according to the present invention, this embodiment is a preferred method for memory detection when a detected memory is exclusively occupied by one service process. After the service process successfully requests the memory, a memory information record is generated, and the related information of the memory is recorded, which may include: a memory address, a memory application time, a service process identifier, a lifetime of the detected memory, and a remaining time, and then The memory information record is placed into an in-memory repository. After the business process releases the memory successfully, the memory information record in the memory information library is released. After the system enters the detection process of the memory leak, the detection method includes the following steps:
步骤 601 : 访问内存信息库, 查找剩余时间为零的内存, 将此内存作为被 检测内存;  Step 601: Access the memory information library, and find the memory with zero remaining time, and use this memory as the detected memory;
其中, 内存记录中的剩余时间 =被检测内存的生命周期 -被检测内存的当 前被占用时间,被检测内存的当前被占用时间 =系统当前时间 -内存申请时间。 内存申请时间为在业务进程申请此内存成功时所记录的时间点;被检测内存的 生命周期为预先为被检测内存设置的被业务进程所占用的时间,是一个大概估 计值。  Among them, the remaining time in the memory record = the life cycle of the detected memory - the current occupied time of the detected memory, the current occupied time of the detected memory = the current time of the system - the memory application time. The memory application time is the time point recorded when the business process requests this memory successfully; the lifetime of the detected memory is the time occupied by the business process set in advance for the detected memory, which is an approximate estimated value.
所述的生命周期可以针对每一种业务进程预先设置一个统一的内存生命 周期,也可以根据业务进程的业务处理逻辑,针对不同的业务进程设置不同的 内存生命周期值。 一个优选的方案是: 在一个函数内申请的临时内存, 可以将 生命周期直接填写为 0, 表示这个被申请内存在函数执行完后立刻释放。 若是 发送消息时所申请的内存, 鉴于消息内存从申请到从端口发送出去后才释放, 一般都不会超过 1000ms, 因此, 可以将生命周期设置为 1000ms。 若有一些复 杂流程处理, 需要直到在流程结束后才释放内存的, 业务模块也基本可以根据 流程和系统处理性能大致确定被申请内存的生命周期。当经过计算所得到的结 果为小于 0的数时, 则剩余时间取 0值。 当被检测内存的剩余时间不为 0时, 表明被检测内存的当前占用时间没有超过被检测内存的生命周期,此时的被检 测内存没有发生内存泄漏。 The life cycle may preset a unified memory life cycle for each business process, or set different memory life cycle values for different business processes according to the business process logic of the business process. A preferred solution is: Temporary memory applied within a function, the life cycle can be directly filled in 0, indicating that the requested memory is released immediately after the function is executed. If the memory is requested when sending a message, since the message memory is released from the application to the slave port, Generally it will not exceed 1000ms, so the life cycle can be set to 1000ms. If there is some complicated process processing, it is necessary to release the memory until the end of the process. The business module can basically determine the life cycle of the applied memory according to the process and system processing performance. When the result obtained by the calculation is a number smaller than 0, the remaining time takes a value of 0. When the remaining time of the detected memory is not 0, it indicates that the current occupied time of the detected memory does not exceed the life cycle of the detected memory, and no memory leak occurs in the detected memory at this time.
步骤 602: 根据内存记录中的业务进程标识, 识别出申请该被检测内存的 业务进程;  Step 602: Identify, according to the service process identifier in the memory record, a service process that applies for the detected memory.
其中,一个业务进程标识唯一标识一个业务进程, 可以是业务进程控制块 所在地址, 或业务进程控制块的编号。  A service process identifier uniquely identifies a service process, which may be the address of the service process control block or the number of the service process control block.
步骤 603: 判断被检测内存是否正在被业务进程标识所指示的业务进程所 占用, 如果是, 进入步骤 604, 如果否, 进入步骤 605;  Step 603: Determine whether the detected memory is occupied by the service process indicated by the service process identifier, if yes, go to step 604, if no, go to step 605;
其中, 当被检测内存的剩余时间为 0时,表明被检测内存的当前占用时间 已经超过被检测内存的生命周期,如果被检测内存的占用时间与业务进程的持 续时间相关, 为防止误判, 需要进一步判断该被检测内存是否正在被业务标识 指示的业务进程所占用。  Wherein, when the remaining time of the detected memory is 0, it indicates that the current occupied time of the detected memory has exceeded the life cycle of the detected memory, and if the occupied time of the detected memory is related to the duration of the business process, in order to prevent misjudgment, It is necessary to further determine whether the detected memory is being occupied by a business process indicated by the service identifier.
上述步骤 603具体可以通过一个业务进程检测函数实现, 该函数有两个参 数: 内存地址和业务进程标识。 业务进程为了释放方便, 一般都会在业务进程 控制块记录自己申请的内存地址,通过业务进程标识确定相应的业务进程控制 块,由确定的业务进程控制块判断业务进程是否存在且业务进程控制块中保存 的内存地址与业务进程检测函数入参的内存地址是否相同,如果是, 判定被检 测内存正在被业务进程标识指示的业务进程所占用,如果否, 判定被检测内存 没有被业务进程标识指示的业务进程占用。  The above step 603 can be specifically implemented by a business process detection function, which has two parameters: a memory address and a business process identifier. For the convenience of release, the service process generally records the memory address requested by the service process control block, determines the corresponding service process control block by the service process identifier, and determines whether the service process exists in the service process control block and the service process control block The saved memory address is the same as the memory address of the business process detection function input parameter. If yes, it is determined that the detected memory is occupied by the business process indicated by the service process identifier. If not, it is determined that the detected memory is not indicated by the service process identifier. Business process is occupied.
步骤 604: 判定被检测内存没有发生内存泄漏, 增加被检测内存的生命周 期, 结束流程;  Step 604: determining that no memory leak occurs in the detected memory, increasing the life cycle of the detected memory, and ending the process;
其中, 当被检测内存还在被业务标识指示的业务进程所占用时,说明该被 检测内存没有出现泄漏, 需要增加被检测内存的内存记录中的生命周期。一个 优选的方法是: 在原生命周期的基础上增加一倍。  When the detected memory is still occupied by the service process indicated by the service identifier, it indicates that the detected memory has no leakage, and the life cycle in the memory record of the detected memory needs to be increased. A preferred method is to double the original life cycle.
步骤 605: 判定被检测内存发生内存泄漏, 根据内存记录中的内存地址, 释放被检测内存, 结束流程。 Step 605: determining that a memory leak occurs in the detected memory, according to the memory address in the memory record. Release the detected memory and end the process.
其中, 当被检测内存没有被业务标识指示的业务进程所占用时,说明该被 检测内存出现了泄漏,根据该被检测内存的内存记录中的内存地址,找到该被 检测内存的实际物理地址, 并释放该被检测内存。  When the detected memory is not occupied by the service process indicated by the service identifier, it indicates that the detected memory has a leak, and the actual physical address of the detected memory is found according to the memory address in the memory record of the detected memory. And release the detected memory.
由上述本发明的实施例可以看出,在判断出被检测内存的当前被占用时间 超过预期生命周期时,通过独立的反向溯源判断, 即定位到申请此内存的业务 进程, 并根据业务进程的实际使用情况,如果确定业务进程已经结束或内存已 经被业务进程释放, 则最终判定该被检测内存发生内存泄漏。从而可以彻底解 决内存泄漏误判的发生, 避免了由于内存泄漏误判影响业务正常执行的问题。 同时,如果确定被检测内存被这个业务进程所使用, 则判定该被检测内存没有 出现内存泄漏,此时,通过增加生命周期来为被检测内存重新设置生命周期值, 防止再检测该内存时而又发生误判的情况。  It can be seen from the foregoing embodiment of the present invention that when it is determined that the current occupied time of the detected memory exceeds the expected life cycle, the independent reverse traceability judgment is performed, that is, the service process applying for the memory is located, and according to the business process. In actual use, if it is determined that the business process has ended or the memory has been released by the business process, it is finally determined that a memory leak occurs in the detected memory. Therefore, the occurrence of memory leak misjudgment can be completely solved, and the problem that the service leakage is affected due to the memory leak misjudgment is avoided. At the same time, if it is determined that the detected memory is used by the business process, it is determined that there is no memory leak in the detected memory. At this time, by adding a life cycle, the life cycle value is reset for the detected memory to prevent the memory from being detected again. A case of misjudgment.
此外, 当使用统一的预先设定的一个内存生命周期时, 不能适应多样的内 存使用场景。 例如, 有些耗时较长的业务进程还在正常使用内存, 但由于超时 而重复进行内存泄漏检查,导致系统处理资源的浪费。 而有些耗时较短的内存 有可能由于当前的占用时间没有达到生命周期而不能及时被检测出来。本发明 实施例根据业务进程的业务处理逻辑,由业务进程分别为各种不同场景申请的 内存设置不同的内存生命周期值, 避免了以上问题, 使系统运行将更为稳定。  In addition, when using a unified pre-set memory lifecycle, it is not possible to adapt to a variety of memory usage scenarios. For example, some long-running business processes still use memory normally, but repeated memory leak checks due to timeouts cause the system to waste resources. Some of the less time-consuming memories may not be detected in time because the current occupied time has not reached the life cycle. According to the service processing logic of the service process, the service process sets different memory lifecycle values for the memory applied by different service scenarios in different service scenarios, thereby avoiding the above problems and making the system operation more stable.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤 是可以通过程序来指令相关的硬件来完成,所述的程序可以存储于一计算机可 读取存储介质中, 该程序包括如下步骤: 第一判断过程, 所述第二判断过程具 的生命周期; 当所述第一判断过程的结果为是时,触发第二判断过程,具体为: 判断所述被检测内存是否正在被申请所述被检测内存的业务进程所使用;当所 述第二判断过程的结果为是时, 判定所述被检测内存没有发生内存泄漏, 当所 述第二判断过程的结果为否时, 判定所述被检测内存发生内存泄漏。所述的存 储介质, 如: ROM/RAM、 磁碟、 光盘等。  One of ordinary skill in the art can understand that all or part of the steps of implementing the above embodiments may be completed by a program instructing related hardware, and the program may be stored in a computer readable storage medium, and the program includes the following The first judging process, the second judging process has a life cycle; when the result of the first judging process is yes, the second judging process is triggered, specifically: determining whether the detected memory is being applied for The service process of the detected memory is used; when the result of the second determining process is YES, it is determined that no memory leak occurs in the detected memory, and when the result of the second determining process is no, the determining A memory leak occurs in the detected memory. The storage medium is, for example, a ROM/RAM, a magnetic disk, an optical disk, or the like.
以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通 技术人员来说, 在不脱离本发明原理的前提下, 还可以做出若干改进和润饰, 这些改进和润饰也应该视为本发明的保护范围。 The above description is only a preferred embodiment of the present invention, and it should be noted that those skilled in the art can make several improvements and refinements without departing from the principles of the present invention. These improvements and modifications should also be considered as protection scope of the present invention.

Claims

权 利 要 求 Rights request
1、 一种内存泄漏的检测方法, 其特征在于, 所述方法包括: 为所述被检测内存设置的生命周期;  A method for detecting a memory leak, the method comprising: setting a life cycle for the detected memory;
当所述第一判断过程的结果为是时,触发第二判断过程, 所述第二判断过 程具体为:判断所述被检测内存是否正在被申请所述被检测内存的业务进程所 使用;  When the result of the first determining process is YES, the second determining process is triggered, where the second determining process is specifically: determining whether the detected memory is being used by a service process that is applied for the detected memory;
当所述第二判断过程的结果为是时,判定所述被检测内存没有发生内存泄 漏, 当所述第二判断过程的结果为否时, 判定所述被检测内存发生内存泄漏。  When the result of the second determining process is YES, it is determined that no memory leak occurs in the detected memory, and when the result of the second determining process is negative, it is determined that a memory leak occurs in the detected memory.
2、 根据权利要求 1所述的方法, 其特征在于, 所述方法还包括: 当所述第二判断过程判定所述被检测内存没有发生内存泄漏后,增加所述 被检测内存的生命周期。  2. The method according to claim 1, wherein the method further comprises: increasing a life cycle of the detected memory after the second determining process determines that a memory leak has not occurred in the detected memory.
3、 根据权利要求 1所述的方法, 其特征在于, 所述方法还包括: 当所述第二判断过程判定所述被检测内存发生内存泄漏后,释放所述被检 测内存。  The method according to claim 1, wherein the method further comprises: releasing the detected memory after the second determining process determines that a memory leak occurs in the detected memory.
4、 根据权利要求 1所述的方法, 其特征在于, 所述预先为被检测内存设 置的生命周期包括:  4. The method according to claim 1, wherein the life cycle set in advance for the detected memory comprises:
预先为所有业务进程的被检测内存统一设置的一个生命周期;  A life cycle that is set in advance for the detected memory of all business processes;
或者,  Or,
根据业务进程自身的业务处理逻辑,预先为每个业务进程的被检测内存分 别设置的生命周期。  According to the business process logic of the business process itself, the life cycle set for the detected memory of each business process is pre-defined.
5、 根据权利要求 1所述的方法, 其特征在于, 所述第二判断过程包括: 根据业务进程标识, 识别出申请所述被检测内存的业务进程;  The method according to claim 1, wherein the second determining process comprises: identifying, according to the service process identifier, a service process for applying for the detected memory;
判断所述业务进程是否存在且所述业务进程所保存的内存地址是否与所 述被检测内存的地址相同, 如果是, 所述第二判断过程的判断结果为是, 如果 否, 所述第二判断过程的判断结果为否。  Determining whether the service process exists and whether the memory address saved by the service process is the same as the address of the detected memory, and if yes, the determination result of the second determining process is yes, if not, the second The judgment result of the judgment process is No.
6、 根据权利要求 5所述的方法, 其特征在于, 所述业务进程标识包括: 业务进程控制块的地址或者业务进程控制块的编号。  The method according to claim 5, wherein the service process identifier comprises: an address of a service process control block or a number of a service process control block.
7、 根据权利要求 5所述的方法, 其特征在于, 所述根据业务进程标识, 识别出申请所述被检测内存的业务进程包括: The method according to claim 5, wherein the according to the service process identifier, Identifying the business processes for applying for the detected memory includes:
当所述业务进程申请所述被检测内存成功后,对应所述业务进程建立包含 有业务进程标识的内存记录,根据所述内存记录中的所述业务进程标识,识别 出申请所述被检测内存的业务进程。  After the service process is applied to the detected memory, the memory process includes the memory record containing the service process identifier, and the application for the detected memory is identified according to the service process identifier in the memory record. Business process.
8、 根据权利要求 7所述的方法, 其特征在于, 所述内存记录包括: 内存 地址、 内存申请时间、 业务进程标识和内存生命周期。  8. The method according to claim 7, wherein the memory record comprises: a memory address, a memory application time, a business process identifier, and a memory life cycle.
9、 根据权利要求 1-8任意一项所述的方法, 其特征在于, 所述被检测内 存包括:  The method according to any one of claims 1-8, wherein the detected memory comprises:
同一时刻被一个业务进程独占的内存或者同一时刻被至少两个业务进程 重用的内存。  Memory that is exclusively occupied by one business process at the same time or memory that is reused by at least two business processes at the same time.
10、 根据权利要求 1所述的方法, 其特征在于, 当所述第二判断过程判定 所述被检测内存没有发生内存泄漏后, 重新设置所述被检测内存的生命周期。  10. The method according to claim 1, wherein the life cycle of the detected memory is reset after the second determining process determines that no memory leak has occurred in the detected memory.
11、 一种内存泄漏的检测装置, 其特征在于, 所述装置包括: 述被检测内存设置的生命周期, 如果是, 触发第二检测单元;  A device for detecting a memory leak, characterized in that: the device comprises: a life cycle of the detected memory setting, and if so, triggering the second detecting unit;
第二检测单元,用于判断所述被检测内存是否正在被申请所述被检测内存 的业务进程所使用,如果是,判定所述被检测内存没有发生内存泄漏,如果否, 判定所述被检测内存发生内存泄漏。  a second detecting unit, configured to determine whether the detected memory is being used by a service process that is applied to the detected memory, and if yes, determine that a memory leak does not occur in the detected memory, and if not, determine that the detected A memory leak has occurred in the memory.
12、 根据权利要求 11所述的装置, 其特征在于, 所述第二检测单元包括: 识别单元, 用于根据业务进程标识,识别出申请所述被检测内存的业务进 程;  The device according to claim 11, wherein the second detecting unit comprises: an identifying unit, configured to identify, according to the service process identifier, a service process for applying for the detected memory;
判断单元,用于判断所述业务进程是否存在且所述业务进程所保存的内存 地址是否与所述被检测内存的地址相同,如果是, 判定所述被检测内存没有发 生内存泄漏, 如果否, 判定所述被检测内存发生内存泄漏。  a determining unit, configured to determine whether the service process exists and whether a memory address saved by the service process is the same as an address of the detected memory, and if yes, determining that a memory leak does not occur in the detected memory, if not, A memory leak is determined to be detected in the detected memory.
13、 根据权利要求 11所述的装置, 其特征在于, 所述装置还包括: 生命周期增加单元,用于当所述第二检测单元判定所述被检测内存没有发 生内存泄漏后, 增加所述被检测内存的生命周期。  The device according to claim 11, wherein the device further comprises: a life cycle increasing unit, configured to: add, after the second detecting unit determines that the detected memory does not have a memory leak The lifetime of the memory being tested.
14、 根据权利要求 11所述的装置, 其特征在于, 所述装置还包括: 释放单元, 用于当所述第二检测单元判定所述被检测内存发生内存泄漏 后, 释放所述被检测内存。 The device according to claim 11, wherein the device further comprises: a releasing unit, configured to: when the second detecting unit determines that a memory leak occurs in the detected memory After that, the detected memory is released.
15、 根据权利要求 11所述的装置, 其特征在于, 所述装置还包括: 生命周期重设单元,用于当所述第二检测单元判定所述被检测内存没有发 生内存泄漏后, 重新设置所述被检测内存的生命周期。  The device according to claim 11, wherein the device further comprises: a lifecycle resetting unit, configured to: after the second detecting unit determines that the detected memory has not experienced a memory leak, resetting The life cycle of the detected memory.
PCT/CN2009/074435 2008-10-17 2009-10-14 Memory leak detecting method and device WO2010043176A1 (en)

Applications Claiming Priority (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
CN200810201396.0 2008-10-17

Publications (1)

Publication Number Publication Date
WO2010043176A1 true WO2010043176A1 (en) 2010-04-22

Family

ID=40594810

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2009/074435 WO2010043176A1 (en) 2008-10-17 2009-10-14 Memory leak detecting method and device

Country Status (2)

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

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857615A (en) * 2018-12-29 2019-06-07 北京奇安信科技有限公司 A kind of detection method and device of memory overflow
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
CN113381895A (en) * 2021-06-16 2021-09-10 杭州迪普科技股份有限公司 Network fault detection method and device
CN113868673A (en) * 2021-12-06 2021-12-31 荣耀终端有限公司 Vulnerability detection method and device
CN113900867A (en) * 2021-09-06 2022-01-07 浪潮软件股份有限公司 Method, apparatus and computer readable medium for detecting IOS memory leak
CN114968645A (en) * 2022-07-27 2022-08-30 北京睿芯高通量科技有限公司 Memory leak detection method and device, electronic equipment and storage medium

Families Citing this family (8)

* 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
CN112035289A (en) * 2020-09-03 2020-12-04 浙江大华技术股份有限公司 Method and device for determining data block leakage, storage medium and electronic device
CN117971626A (en) * 2024-03-28 2024-05-03 天津南大通用数据技术股份有限公司 Shared memory leakage detection method based on multi-process coroutine model

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070033365A1 (en) * 2005-08-02 2007-02-08 Kalyanaraman Vaidyanathan Method and apparatus for detecting memory leaks in computer systems
CN1979426A (en) * 2005-12-08 2007-06-13 中兴通讯股份有限公司 System for automatically monitoring memory leakage and memory out-of-range in inlaid system
CN101162436A (en) * 2006-10-13 2008-04-16 中兴通讯股份有限公司 Ems memory leakage testing method in communication apparatus system
US20080168444A1 (en) * 2004-10-28 2008-07-10 Marc Alan Dickenson Memory leakage management
CN101414272A (en) * 2008-10-17 2009-04-22 上海华为技术有限公司 Method and apparatus for detecting memory leakage

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1248114C (en) * 2002-06-20 2006-03-29 华为技术有限公司 Method for checking sofeware memory leak
US20050081190A1 (en) * 2003-09-30 2005-04-14 International Business Machines Corporation Autonomic memory leak detection and remediation
CN100590598C (en) * 2007-12-13 2010-02-17 华为技术有限公司 Memory leak detection method and apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080168444A1 (en) * 2004-10-28 2008-07-10 Marc Alan Dickenson Memory leakage management
US20070033365A1 (en) * 2005-08-02 2007-02-08 Kalyanaraman Vaidyanathan Method and apparatus for detecting memory leaks in computer systems
CN1979426A (en) * 2005-12-08 2007-06-13 中兴通讯股份有限公司 System for automatically monitoring memory leakage and memory out-of-range in inlaid system
CN101162436A (en) * 2006-10-13 2008-04-16 中兴通讯股份有限公司 Ems memory leakage testing method in communication apparatus system
CN101414272A (en) * 2008-10-17 2009-04-22 上海华为技术有限公司 Method and apparatus for detecting memory leakage

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857615A (en) * 2018-12-29 2019-06-07 北京奇安信科技有限公司 A kind of detection method and device of memory overflow
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
CN113381895A (en) * 2021-06-16 2021-09-10 杭州迪普科技股份有限公司 Network fault detection method and 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
CN113868673A (en) * 2021-12-06 2021-12-31 荣耀终端有限公司 Vulnerability detection method and device
CN114968645A (en) * 2022-07-27 2022-08-30 北京睿芯高通量科技有限公司 Memory leak detection method and device, electronic equipment and storage medium
CN114968645B (en) * 2022-07-27 2022-10-11 北京睿芯高通量科技有限公司 Memory leak detection method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN101414272A (en) 2009-04-22
CN101414272B (en) 2011-06-08

Similar Documents

Publication Publication Date Title
WO2010043176A1 (en) Memory leak detecting method and device
US8380839B2 (en) Clearing SCSI reservations for non-detectable initiators for extended duration
CN102063338B (en) Method and device for requesting exclusive resource
WO2009114985A1 (en) Memory leaking detecting device and method
KR102564163B1 (en) METHOD FOR HANDLING COMMAND ID CONFLICT SCENARIO IN NON-VOLATILE MEMORY EXPRESS(NVMe) BASED SOLID STATE DRIVE (SSD) CONTROLLER
US20100083043A1 (en) Information processing device, recording medium that records an operation state monitoring program, and operation state monitoring method
WO2016123908A1 (en) Memory overflow detection method and apparatus
CN107273231A (en) Distributed memory system hard disk tangles fault detect, processing method and processing device
KR20170019192A (en) Method and apparatus for formal verification of network service in network function virtualization
JP2015529927A (en) Notification of address range with uncorrectable errors
CN114443332B (en) Storage pool detection method and device, electronic equipment and storage medium
US20090228870A1 (en) On-demand monitoring of memory usage
US9141439B2 (en) System and method for reporting a synchronization event in a runtime system of a computer system
US20100037094A1 (en) Application Failure Recovery
US20240095174A1 (en) Method for detecting error of operating system kernel memory in real time
CN111858290B (en) Method and apparatus for detecting memory leak path of object code
CN105205160A (en) Data write-in method and device
US20110202903A1 (en) Apparatus and method for debugging a shared library
US20150378799A1 (en) Automatic memory leak detection
CN104504348A (en) Data protecting method based on high availability storage system
CN114327981A (en) Safety verification system, method and device of function safety mechanism
EP2960798B1 (en) Automatic memory leak detection
CN112905422A (en) Alarm rule management method and equipment based on search server
CN114531499A (en) Port sharing method, system and server based on QUIC protocol
CN107491347B (en) Method and equipment for virtual machine live migration

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 09820252

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 09820252

Country of ref document: EP

Kind code of ref document: A1