JP5327886B2 - Memory leak determination device, memory leak determination method and program - Google Patents

Memory leak determination device, memory leak determination method and program Download PDF

Info

Publication number
JP5327886B2
JP5327886B2 JP2010105153A JP2010105153A JP5327886B2 JP 5327886 B2 JP5327886 B2 JP 5327886B2 JP 2010105153 A JP2010105153 A JP 2010105153A JP 2010105153 A JP2010105153 A JP 2010105153A JP 5327886 B2 JP5327886 B2 JP 5327886B2
Authority
JP
Japan
Prior art keywords
memory
memory usage
leak
usage
maximum value
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
JP2010105153A
Other languages
Japanese (ja)
Other versions
JP2011233075A (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.)
NEC System Technologies Ltd
Original Assignee
NEC System Technologies 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 NEC System Technologies Ltd filed Critical NEC System Technologies Ltd
Priority to JP2010105153A priority Critical patent/JP5327886B2/en
Publication of JP2011233075A publication Critical patent/JP2011233075A/en
Application granted granted Critical
Publication of JP5327886B2 publication Critical patent/JP5327886B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To detect a failure of computer resource release early and reduce a risk of erroneous determination on a failure of computer resource release regardless of the magnitude of an increase rate of computer resource usage. <P>SOLUTION: In a memory leak determination device (a resource release failure determination device) 1, a memory usage obtaining unit (a resource usage obtaining unit) 21 obtains memory usage (resource usage) for each process, and a maximum value update counter 22 counts the number of updating the maximum value of the memory usage for every process. A memory leak determination unit (a resource release failure determination unit) 23 determines that a memory leak (a resource release failure) is occurring when the number of updating the maximum value of the memory usage is equal to or greater than a predetermined threshold and the memory usage is equal to or greater than a predetermined threshold. <P>COPYRIGHT: (C)2012,JPO&amp;INPIT

Description

本発明は、メモリリーク判定装置、メモリリーク判定方法およびプログラムに関する。 The present invention, main Moririku determination device, a memory leak judgment method, and a program.

プログラムのバグやウィルスの混入など何らかの原因で、オペレーティングシステム(Operating System;OS)やアプリケーションソフトのプロセスが、動的に確保したメモリ領域を開放しない現象は、メモリリークと呼ばれている。メモリリークが生じると、使用可能なメモリ領域が減少してコンピュータの処理能力が低下する、あるいは、コンピュータの動作が不安定になるおそれがある。
メモリリークの有無を判定する方法として、プロセス毎のメモリ使用量を検出し、いずれかのプロセスのメモリ使用量が所定の閾値を超えた場合に、メモリリーク有りと判定する方法がある。しかし、この方法では、メモリ使用量が当該閾値を超えるまでメモリリーク有りとの判定が行われず、メモリリークの検知が遅れてしまう。また、実際にはメモリリークが発生しておらず、メモリ使用量が一時的に閾値を超えたに過ぎない場合も、メモリリーク有りとの誤検出を行ってしまう。
そこで、特許文献1では、プロセス毎に、直近24時間のメモリ使用量平均値と過去のメモリ使用量平均値とを比較してメモリ使用量増加率を算出し、いずれかのプロセスのメモリ使用量増加率が予め定められた閾値を超える場合に、メモリリーク有りと判定する方法が示されている。この方法によれば、メモリ使用量増加率に基づいてメモリリークの有無を判定するので、メモリ使用量が比較的小さい早期段階でメモリリークを検知し得る。
A phenomenon in which an operating system (OS) or application software process does not free a dynamically allocated memory area due to a program bug or virus contamination is called a memory leak. When a memory leak occurs, there is a possibility that the usable memory area decreases and the computer processing capacity decreases, or the operation of the computer becomes unstable.
As a method of determining the presence or absence of a memory leak, there is a method of detecting the memory usage amount for each process and determining that there is a memory leak when the memory usage amount of any process exceeds a predetermined threshold. However, in this method, it is not determined that there is a memory leak until the memory usage exceeds the threshold, and detection of the memory leak is delayed. In addition, when no memory leak actually occurs and the memory usage amount only temporarily exceeds the threshold value, it is erroneously detected that there is a memory leak.
Therefore, in Patent Document 1, for each process, a memory usage increase rate is calculated by comparing the memory usage average value for the last 24 hours with the past memory usage average value, and the memory usage of any process A method of determining that there is a memory leak when the increase rate exceeds a predetermined threshold is shown. According to this method, since the presence / absence of a memory leak is determined based on the memory usage increase rate, the memory leak can be detected at an early stage where the memory usage is relatively small.

特開2005-250751号公報JP 2005-250751 A

しかしながら、特許文献1の方法では、比較的大きなメモリ領域を確保するプロセスが一定時間以上(例えば、直近24時間近く)実行状態にある場合にも、メモリ使用量増加率が閾値を超えることが考えられる。この場合、実際にはメモリリークが発生していないにもかかわらず、メモリリーク有りとの誤判定を行ってしまうおそれがある。また、この方法では、メモリ使用量増加率が閾値以下のメモリリークを検出することはできない。   However, in the method of Patent Document 1, even when a process for securing a relatively large memory area is in an execution state for a certain time or more (for example, the latest 24 hours), the memory usage increase rate may exceed the threshold value. It is done. In this case, there is a risk of erroneously determining that there is a memory leak even though no memory leak actually occurs. Also, with this method, it is not possible to detect a memory leak whose memory usage rate is below a threshold.

また、かかる課題は、メモリ資源に限らず様々なコンピュータ資源について生じうる。例えば、プロセスがオープンしたファイルのクローズ漏れの有無を、プロセスがオープンしたファイル数と閾値との比較により判定する場合や、マルチスレッド処理を行うプロセスのスレッド終了漏れを、スレッド数と閾値との比較により判定する場合も、上記の場合と同様に、オープンファイル数やスレッド数の一時的な増加により誤判定を行ってしまうおそれがある。   Such a problem may occur not only for memory resources but also for various computer resources. For example, when determining whether or not a process opened file is closed by comparing the number of files opened by the process with a threshold value, or comparing the thread end leakage of a process that performs multithread processing with the thread number and the threshold value. As in the case described above, there is a risk of erroneous determination due to a temporary increase in the number of open files and the number of threads.

本発明は、このような事情を考慮してなされたものであり、その目的は、コンピュータ資源の解放漏れを早期に検知し、かつ、コンピュータ資源使用量増加率の大小にかかわらず、コンピュータ資源解放漏れ有無の誤判定を行うおそれの少ないメモリリーク判定装置、メモリリーク判定方法およびプログラムを提供することにある。 The present invention has been made in consideration of such circumstances, and its purpose is to detect computer resource release omissions at an early stage, and to release computer resources regardless of the rate of increase in computer resource usage. fear of small Ime Moririku determination device performs erroneous determination of leak presence is to provide a memory leak judgment method, and a program.

この発明は上述した課題を解決するためになされたもので、本発明の一態様によるメモリリーク判定装置は、プロセスがメモリを使用するメモリリークの有無を判定するメモリリーク判定装置であって、前記プロセスのメモリ使用量を取得するメモリ使用量取得部と、前記メモリ使用量取得部が取得する前記メモリ使用量の最大値更新回数を計数する最大値更新回数計数部と、前記最大値更新回数計数部が計数する前記最大値更新回数に基づいて、前記メモリリークの有無を判定するメモリリーク判定部と、を具備し、前記メモリリーク判定部は、プロセス起動から一定時間経過後に前記メモリ使用量取得部が最初に取得した前記メモリ使用量であるメモリ使用量初期値を所定定数倍した値を閾値として、前記最大値更新回数が所定の回数より以上となり、かつ、前記メモリ使用量が前記閾値以上となった場合に、前記メモリリーク有りと判定することを特徴とする。 The present invention has been made to solve the problems described above, a memory leak determination device according to an aspect of the present invention, the process is a memory leakage determination unit determines the presence or absence of memory leaks using memory, the and memory usage acquisition unit for acquiring the memory usage of the process, the maximum value update count counting section for counting the maximum number of updates of the memory usage the memory usage acquisition unit acquires the maximum value update count counting A memory leak determination unit that determines the presence or absence of the memory leak based on the maximum number of update times counted by the unit, and the memory leak determination unit obtains the memory usage after a lapse of a certain time from process startup. The maximum value update count is a predetermined number of times, using a value obtained by multiplying a memory constant initial value, which is the memory usage initially acquired by the unit, by a predetermined constant. Becomes higher, and, if the memory usage is equal to or greater than the threshold value, and wherein the determining that there is the memory leak.

また、本発明の一態様による資源解放漏れ判定方法は、プロセスがメモリを使用する際のメモリリークの有無を判定するメモリリーク判定装置のメモリリーク判定方法であって、メモリ使用量取得部が、前記プロセスのメモリ使用量を取得するメモリ使用量取得ステップと、最大値更新回数計数部が、前記メモリ使用量取得部が取得する前記メモリ使用量の最大値更新回数を計数する最大値更新回数計数ステップと、メモリリーク判定部が、前記最大値更新回数計数部が計数する前記最大値更新回数に基づいて、前記メモリリークの有無を判定するメモリリーク判定ステップと、を具備し、前記メモリリーク判定ステップでは、前記メモリリーク判定部は、プロセス起動から一定時間経過した後に前記メモリ使用量取得部が最初に取得した前記メモリ使用量であるメモリ使用量初期値を所定定数倍した値を閾値として、前記最大値更新回数が所定の回数より以上となり、かつ、前記メモリ使用量が前記閾値以上となった場合に、前記メモリリーク有りと判定することを特徴とする。 A resource release leak determination method according to an aspect of the present invention is a memory leak determination method of a memory leak determination apparatus that determines whether or not a memory leak occurs when a process uses memory, and the memory usage acquisition unit includes: and memory usage acquiring the memory usage of the process, the maximum value update count counting section, the maximum value update count counting to count the maximum number of updates of the memory usage the memory usage acquisition unit acquires a step, a memory leak determination unit, based on the maximum value update number of times the maximum value updating count counting section counts, anda memory leakage determination step of determining whether the memory leak, the memory leak determination In the step, the memory leak determination unit is configured so that the memory usage acquisition unit acquires the first time after a predetermined time has elapsed since the process startup. When a value obtained by multiplying a memory usage initial value that is a memory usage by a predetermined constant is a threshold, the maximum value update count is greater than or equal to a predetermined count, and the memory usage is equal to or greater than the threshold, It is determined that there is a memory leak .

また、本発明の一態様によるプログラムは、プロセスがメモリを使用する際のメモリリークの有無を判定するメモリリーク判定装置としてのコンピュータに、前記プロセスのメモリ使用量を取得するメモリ使用量取得ステップと、前記メモリ使用量取得ステップにて取得する前記メモリ使用量の最大値更新回数を計数する最大値更新回数計数ステップと、前記最大値更新回数計数ステップにて計数する前記最大値更新回数に基づいて、前記メモリリークの有無を判定するメモリリーク判定ステップと、を実行させ、前記メモリリーク判定ステップでは、プロセス起動から一定時間経過した後に最初に取得した前記メモリ使用量であるメモリ使用量初期値を所定定数倍した値を閾値として、前記最大値更新回数が所定の回数より以上となり、かつ、前記メモリ使用量が前記閾値以上となった場合に、前記メモリリーク有りと判定させるためのプログラムである。
The program according to an aspect of the present invention causes a computer as a memory leak determining device determines the presence or absence of memory leaks when the process uses memory, and memory usage acquiring the memory usage of the process , the maximum value update count counting step for counting the maximum number of updates of the memory usage of acquired by the memory usage acquisition step, on the basis of the maximum value update count for counting at the maximum value updating number counting step the memory leakage determination step of determining whether a memory leak, is executed, the in memory leakage determination step, the memory use amount initial value is the memory usage acquired first after the elapse from the process starts a predetermined time With the value multiplied by a predetermined constant as a threshold value, the maximum value update count is greater than the predetermined count, , If the memory usage is equal to or greater than the threshold value, a program for determining that there is the memory leak.

本発明によれば、コンピュータ資源の解放漏れを早期に検知し、かつ、コンピュータ資源使用量増加率の大小にかかわらず、コンピュータ資源解放漏れ有無の誤判定を行うおそれを少なくできる。   According to the present invention, it is possible to detect a computer resource release omission early and to reduce the possibility of erroneous determination of the presence or absence of a computer resource release regardless of the magnitude of the increase rate of the computer resource usage.

本発明の一実施形態におけるメモリリーク判定装置の概略構成を示す構成図である。It is a block diagram which shows schematic structure of the memory leak determination apparatus in one Embodiment of this invention. 同実施形態において、プロセス情報記憶部311が記憶するプロセス情報の例を示す図である。In the same embodiment, it is a figure which shows the example of the process information which the process information storage part 311 memorize | stores. 同実施形態において、メモリ使用量情報記憶部312が記憶するメモリ使用量情報の例を示す図である。5 is a diagram illustrating an example of memory usage information stored in a memory usage information storage unit 312 in the embodiment. FIG. 同実施形態において、判定条件情報記憶部313が記憶する判定条件情報の例を示す図である。4 is a diagram illustrating an example of determination condition information stored in a determination condition information storage unit 313 in the embodiment. FIG. 同実施形態において、処理内容情報記憶部314が記憶する処理内容情報の例を示す図である。In the same embodiment, it is a figure which shows the example of the process content information which the process content information storage part 314 memorize | stores. 同実施形態において、処理結果情報記憶部315が記憶する処理結果情報の例を示す図である。In the same embodiment, it is a figure which shows the example of the process result information which the process result information storage part 315 memorize | stores. 同実施形態において、メモリリーク判定部23が、メモリリーク有りと判定する例を示すグラフである。In the embodiment, the memory leak determination unit 23 is a graph showing an example of determining that there is a memory leak. 同実施形態において、メモリリーク判定部が、メモリリーク無しと判定する第1の例を示すグラフである。4 is a graph illustrating a first example in which the memory leak determination unit determines that there is no memory leak in the embodiment. 同実施形態において、メモリリーク判定部が、メモリリーク無しと判定する第2の例を示すグラフである。In the embodiment, the memory leak determination unit is a graph showing a second example of determining that there is no memory leak. 同実施形態において、メモリリーク判定部が、メモリリーク無しと判定する第3の例を示すグラフである。In the embodiment, the memory leak determination unit is a graph showing a third example of determining that there is no memory leak. 同実施形態において、メモリリーク判定装置1が、ある1つのプロセスに関して行う、メモリリーク有無の判定処理手順を示す図である。FIG. 6 is a diagram illustrating a processing procedure for determining whether there is a memory leak, which is performed by the memory leak determination apparatus 1 regarding a certain process in the embodiment. 本発明の第1の変形例におけるファイルリーク判定装置の概略構成を示す構成図である。It is a block diagram which shows schematic structure of the file leak determination apparatus in the 1st modification of this invention. 本発明の第2の変形例におけるスレッドリーク判定装置の概略構成を示す構成図である。It is a block diagram which shows schematic structure of the thread leak determination apparatus in the 2nd modification of this invention.

以下、図面を参照して、本発明の実施の形態について説明する。
図1は、本発明の一実施形態におけるメモリリーク判定装置の概略構成を示す構成図である。同図において、メモリリーク判定装置(資源解放漏れ判定装置)1は、操作入力部11と、表示部12と、メモリ使用量取得部(コンピュータ資源使用量取得部)21と、最大値更新回数計数部22と、メモリリーク判定部(解放漏れ判定部)23と、対策処理実行部24と、記憶部31とを具備する。記憶部31は、プロセス情報記憶部311と、メモリ使用量情報記憶部312と、判定条件情報記憶部313と、処理内容情報記憶部314と、処理結果情報記憶部315とを具備する。
Embodiments of the present invention will be described below with reference to the drawings.
FIG. 1 is a configuration diagram showing a schematic configuration of a memory leak determination apparatus according to an embodiment of the present invention. In the figure, a memory leak determination device (resource release leak determination device) 1 includes an operation input unit 11, a display unit 12, a memory usage acquisition unit (computer resource usage acquisition unit) 21, and a maximum value update count. Unit 22, memory leak determination unit (release leak determination unit) 23, countermeasure processing execution unit 24, and storage unit 31. The storage unit 31 includes a process information storage unit 311, a memory usage information storage unit 312, a determination condition information storage unit 313, a processing content information storage unit 314, and a processing result information storage unit 315.

メモリリーク判定装置1は、コンピュータ上のプロセスのメモリ使用量に基づいて、メモリリークの有無を判定する。
記憶部31は、メモリリーク判定対象のコンピュータ(以下では、単に「コンピュータ」という)の記憶領域上に実現されて、各種情報を記憶する。プロセス情報記憶部311は、メモリリーク判定装置1が各プロセスのメモリ使用量を取得するために用いる情報であるプロセス情報をプロセス毎に記憶する。
図2は、プロセス情報記憶部311が記憶するプロセス情報の例を示す図である。同図の例では、プロセス情報には、プロセスの識別番号である「プロセスID」と、当該プロセスの「プロセス名」と、当該プロセスの「実行開始時刻」と、メモリリーク判定装置1が次に当該プロセスのメモリ使用量を取得する時刻である「次回時刻」とが含まれている。
The memory leak determination apparatus 1 determines the presence or absence of a memory leak based on the memory usage of a process on the computer.
The storage unit 31 is realized on a storage area of a computer subject to memory leak determination (hereinafter simply referred to as “computer”), and stores various types of information. The process information storage unit 311 stores process information, which is information used by the memory leak determination apparatus 1 for acquiring the memory usage of each process, for each process.
FIG. 2 is a diagram illustrating an example of process information stored in the process information storage unit 311. In the example shown in the figure, the process information includes “process ID” that is an identification number of the process, “process name” of the process, “execution start time” of the process, and the memory leak determination device 1 The “next time” that is the time to acquire the memory usage of the process is included.

メモリ使用量情報記憶部312は、実行中のプロセスのメモリ使用量に関する情報であるメモリ使用量情報をプロセス毎に記憶する。
図3は、メモリ使用量情報記憶部312が記憶するメモリ使用量情報の例を示す図である。同図の例では、メモリ使用量情報には、上述した「プロセスID」および「プロセス名」と、当該プロセスのメモリ使用量の「初期値」および「最大値」および「現在値」と、当該最大値が更新された回数を示す「最大値更新回数」と、メモリリーク判定装置1がメモリリークの判定を行う際に用いる閾値である「メモリ使用量閾値」とが含まれている。
The memory usage information storage unit 312 stores memory usage information, which is information related to the memory usage of the process being executed, for each process.
FIG. 3 is a diagram illustrating an example of memory usage information stored in the memory usage information storage unit 312. In the example of the figure, the memory usage information includes the above-mentioned “process ID” and “process name”, “initial value”, “maximum value” and “current value” of the memory usage of the process, A “maximum value update count” indicating the number of times the maximum value has been updated and a “memory usage threshold” that is a threshold used when the memory leak determination apparatus 1 determines a memory leak are included.

判定条件情報記憶部313は、メモリリーク判定装置1がメモリリークの判定を行う際の閾値や閾値算出基準を記憶する。
図4は、判定条件情報記憶部313が記憶する判定条件情報の例を示す図である。同図の例では、判定条件情報には、メモリ使用量最大値の更新回数の閾値である「更新回数閾値」と、メモリ使用量の閾値の算出基準である「メモリ使用量閾値算出係数」と、メモリリーク判定装置1がメモリリークの有無を判定する時間間隔である「判定時間間隔」とが含まれている。更新回数閾値とメモリ使用量閾値算出係数と判定時間間隔とは、例えば、ユーザの操作を受けた操作入力部11が、判定条件情報記憶部313に書き込む。
The determination condition information storage unit 313 stores a threshold value and a threshold value calculation reference when the memory leak determination device 1 determines a memory leak.
FIG. 4 is a diagram illustrating an example of determination condition information stored in the determination condition information storage unit 313. In the example of the figure, the determination condition information includes an “update count threshold” that is a threshold for the update count of the memory usage maximum value, and a “memory usage threshold calculation coefficient” that is a calculation criterion for the threshold of the memory usage. In addition, a “determination time interval”, which is a time interval in which the memory leak determination apparatus 1 determines whether or not there is a memory leak, is included. The update count threshold value, the memory usage threshold value calculation coefficient, and the determination time interval are written in the determination condition information storage unit 313, for example, by the operation input unit 11 that has received a user operation.

処理内容情報記憶部314は、メモリリーク有りと判定されたプロセスに対する処理の内容を記憶する。
図5は、処理内容情報記憶部314が記憶する処理内容情報の例を示す図である。同図の例で示すように、処理内容情報には、メモリリーク有りと判定されたプロセスに対して行う処理の「処理項目名」と、当該処理を実行するための「実行コマンド」と、当該処理を行うか否かを示す「選択フラグ」とが含まれている。処理項目名としては、メモリリーク有りと判定されたプロセスを停止させる(KILLする)「対象プロセス停止」や、予め定められたスクリプトを実行する「スクリプト実行」や、メモリリークに関する情報をログに出力する「ログ出力」と、メモリリークが発生したことをユーザ(コンピュータの管理者)に警告する「警告表示」とが示されている。実行コマンド欄には、当該処理を実行するためのコマンドが格納されている。また、選択フラグの「○」は、当該処理を行うことを示し、「×」は当該処理を行わないことを示す。選択フラグの値は、例えば、ユーザの入力操作を受けた操作入力部11が、処理内容情報記憶部314に書き込む。
The processing content information storage unit 314 stores the processing content for the process determined to have a memory leak.
FIG. 5 is a diagram illustrating an example of the processing content information stored in the processing content information storage unit 314. As shown in the example of the figure, the processing content information includes a “processing item name” of processing performed on the process determined to have a memory leak, an “execution command” for executing the processing, A “selection flag” indicating whether or not to perform processing is included. As the process item name, “process stop” to stop (KILL) the process determined to have a memory leak, “script execution” to execute a predetermined script, and information related to memory leak are output to the log "Log output" to be performed, and "Warning display" to warn the user (computer administrator) that a memory leak has occurred. In the execution command column, a command for executing the processing is stored. Further, “◯” in the selection flag indicates that the process is performed, and “×” indicates that the process is not performed. The value of the selection flag is written in the processing content information storage unit 314 by the operation input unit 11 that has received the user's input operation, for example.

処理結果情報記憶部315は、メモリリーク有りと判定されたプロセスに対する処理結果を記憶する。
図6は、処理結果情報記憶部315が記憶する処理結果情報の例を示す図である。同図の例では、処理結果情報には、メモリリーク判定装置がメモリリーク有りと判定した「判定時刻」と、メモリリーク有りと判定されたプロセスの「プロセスID」および「プロセス名」と、当該プロセスに対する「処理項目名」と、当該処理を行った結果の記録である「処理結果」とが含まれている。
The processing result information storage unit 315 stores a processing result for a process determined to have a memory leak.
FIG. 6 is a diagram illustrating an example of the processing result information stored in the processing result information storage unit 315. In the example of the figure, the processing result information includes “determination time” at which the memory leak determination device determines that there is a memory leak, “process ID” and “process name” of the process determined to have memory leak, A “processing item name” for the process and a “processing result” that is a record of the result of the processing are included.

メモリ使用量取得部21は、実行中の各プロセスのメモリ使用量を取得して、メモリ使用量情報記憶部312の現在値の欄に書き込む。例えばメモリリーク有無の判定時間間隔が5分に設定されている場合、メモリ使用量取得部21は、プロセス情報記憶部311が記憶する次回時刻に基づいてメモリ使用量を取得し、取得後速やかに、次回時刻に5分加算することにより、実行中の各プロセスについて5分毎にメモリ使用量を取得する。
最大値更新回数計数部22は、メモリ使用量取得部の取得するメモリ使用量が最大値か否かを判定し、最大値と判定した場合は、メモリ使用量情報記憶部312の記憶するメモリ使用量の最大値と最大値更新回数とを書き換える。
The memory usage acquisition unit 21 acquires the memory usage of each process being executed and writes it in the current value column of the memory usage information storage unit 312. For example, when the determination time interval for the presence / absence of memory leak is set to 5 minutes, the memory usage acquisition unit 21 acquires the memory usage based on the next time stored in the process information storage unit 311 and promptly after acquisition By adding 5 minutes to the next time, the memory usage is acquired every 5 minutes for each process being executed.
The maximum value update count counting unit 22 determines whether or not the memory usage acquired by the memory usage acquisition unit is the maximum value. If it is determined to be the maximum value, the memory usage stored in the memory usage information storage unit 312 is determined. Rewrite the maximum value and the maximum value update count.

メモリリーク判定部23は、メモリリークの有無を、プロセスのメモリ使用量の最大値更新回数が更新回数閾値以上であり、かつ、メモリ使用量の現在値がメモリ使用量閾値以上であるか否かに基づいて、メモリリークの有無を判定する。
対策処理実行部24は、メモリリーク判定部23がメモリリーク有りと判定した場合に、処理内容情報記憶部314が記憶する処理内容情報に基づいて対策処理を行う。
The memory leak determination unit 23 determines whether or not there is a memory leak, whether or not the maximum number of updates of the memory usage of the process is equal to or greater than an update count threshold and the current value of the memory usage is equal to or greater than the memory usage threshold. Based on the above, the presence or absence of a memory leak is determined.
The countermeasure processing execution unit 24 performs countermeasure processing based on the processing content information stored in the processing content information storage unit 314 when the memory leak determination unit 23 determines that there is a memory leak.

操作入力部11は、キーボードやマウス等を具備し、ユーザの入力操作を受け付ける。操作入力部11は、更新回数閾値、または、メモリ使用量閾値算出係数の入力を受け付けると判定条件情報記憶部313の該当欄に書込み、選択フラグの値の入力を受け付けると処理内容情報記憶部314の記憶する選択フラグの該当欄に書き込む。
表示部12は、液晶ディスプレイ等の表示画面を含み、メモリリーク発生時に警告を表示する。具体的には、警告表示の選択フラグが「○」になっている場合、メモリリークが発生すると、対策処理実行部24から表示部12に対して、警告画面の画像データが出力される。表示部12は、対策処理実行部24から出力される画像データに基づいて、メモリリーク発生を示す警告画面を表示する。
The operation input unit 11 includes a keyboard, a mouse, and the like, and accepts user input operations. When the operation input unit 11 receives an input of the update count threshold value or the memory usage threshold value calculation coefficient, the operation input unit 11 writes in the corresponding field of the determination condition information storage unit 313, and receives an input of the value of the selection flag, the processing content information storage unit 314 Is written in the corresponding column of the selection flag stored.
The display unit 12 includes a display screen such as a liquid crystal display, and displays a warning when a memory leak occurs. Specifically, when the warning display selection flag is “◯”, the image data of the warning screen is output from the countermeasure processing execution unit 24 to the display unit 12 when a memory leak occurs. The display unit 12 displays a warning screen indicating that a memory leak has occurred based on the image data output from the countermeasure processing execution unit 24.

なお、メモリリーク判定装置1は、メモリリーク判定対象のコンピュータ内に実現されていてもよいし、当該コンピュータとは独立した装置として実現されていてもよい。
メモリリーク判定装置1がメモリリーク判定対象のコンピュータ内に実現される場合、例えば、メモリ使用量取得部21と、最大値更新回数計数部22と、メモリリーク判定部23と対策処理実行部24とは、コンピュータの中央演算装置(Central Processing Unit;CPU)上のプロセスとして実現され、記憶部31の各部は、コンピュータの記憶装置上に記憶領域を確保することにより実現される。
Note that the memory leak determination apparatus 1 may be realized in a computer that is a memory leak determination target, or may be realized as an apparatus independent of the computer.
When the memory leak determination device 1 is realized in a memory leak determination target computer, for example, a memory usage amount acquisition unit 21, a maximum value update count counter 22, a memory leak determination unit 23, and a countermeasure processing execution unit 24 Is realized as a process on a central processing unit (CPU) of the computer, and each unit of the storage unit 31 is realized by securing a storage area on the storage device of the computer.

メモリリーク判定装置1がメモリリーク判定対象のコンピュータと独立した装置として実現される場合、メモリリーク判定装置1は、メモリリーク判定対象のコンピュータと通信して当該コンピュータ上で実行中の各プロセスのメモリ使用量を取得する。また、メモリリーク有りと判定した場合は、当該コンピュータに対策処理の実行を指示する信号を送信する。メモリリーク判定装置1は、他のコンピュータ上に実現されていてもよいし、専用の演算回路等により専用のハードウェア装置として実現されていてもよい。   When the memory leak determination apparatus 1 is realized as an apparatus independent of the memory leak determination target computer, the memory leak determination apparatus 1 communicates with the memory leak determination target computer and stores the memory of each process being executed on the computer. Get usage. If it is determined that there is a memory leak, a signal instructing execution of countermeasure processing is transmitted to the computer. The memory leak determination device 1 may be realized on another computer, or may be realized as a dedicated hardware device by a dedicated arithmetic circuit or the like.

次に、図7〜図10を参照して、メモリリーク判定部23が行うメモリリーク有無の判定について説明する。
図7は、メモリリーク判定部23が、メモリリーク有りと判定する例を示すグラフであり、メモリ使用量取得部21が取得する、あるプロセスのメモリ使用量の変化を示す。同図の縦軸はメモリサイズを示す。また、同図の横軸は時間軸であり、プロセスが起動してからの時間を示す。点P101〜P110は、それぞれの時間においてメモリ使用量取得部21が取得する、当該プロセスのメモリ使用量を示す。また、THRはメモリ使用量閾値であり、メモリ使用量初回取得時の点P101におけるメモリ使用量VPに、判定条件情報記憶部313が記憶するメモリ使用量閾値算出係数を乗じた値を示す。
Next, the determination of the presence or absence of a memory leak performed by the memory leak determination unit 23 will be described with reference to FIGS.
FIG. 7 is a graph illustrating an example in which the memory leak determination unit 23 determines that there is a memory leak, and shows a change in memory usage of a certain process acquired by the memory usage acquisition unit 21. The vertical axis in the figure indicates the memory size. In addition, the horizontal axis of the figure is the time axis, and indicates the time since the process started. Points P101 to P110 indicate the memory usage of the process acquired by the memory usage acquisition unit 21 at each time. THR is a memory usage threshold value, and indicates a value obtained by multiplying the memory usage value VP at the point P101 at the time of initial acquisition of the memory usage value by the memory usage threshold value calculation coefficient stored in the determination condition information storage unit 313.

メモリリーク判定部23は、メモリ使用量情報記憶部312のメモリ使用量情報を参照して、メモリ使用量の現在値がメモリ使用量閾値以上であり、かつ、メモリ使用量最大値更新回数が判定条件情報記憶部313の記憶する更新回数閾値以上である場合にメモリリーク有りと判定する。以下、図7〜図10で説明する例では、更新回数閾値は「8」に設定されている。
図7の例では、点P109および点P110において、メモリ使用量の現在値がメモリ使用量閾値THR以上となっている。また、最大値更新回数計数部22は、メモリ使用量初回取得時の点P101では、最大値更新回数を「0」としてメモリ使用量情報記憶部312の最大値更新回数欄に書き込む。以降、点P102で最大値更新回数を「1」、点P103で「2」というように、最大値が更新される毎に最大値更新回数に1を加算してメモリ使用量情報記憶部312の最大値更新回数欄に書き込む。図7の場合、点P106では最大値が更新されていないので、点P110において、最大値更新回数が更新回数閾値の「8」に達する。
The memory leak determination unit 23 refers to the memory usage information in the memory usage information storage unit 312 to determine whether the current value of the memory usage is equal to or greater than the memory usage threshold and the memory usage maximum value update count It is determined that there is a memory leak when it is equal to or greater than the update count threshold stored in the condition information storage unit 313. Hereinafter, in the example illustrated in FIGS. 7 to 10, the update count threshold is set to “8”.
In the example of FIG. 7, at the point P109 and the point P110, the current value of the memory usage is equal to or greater than the memory usage threshold THR. Further, the maximum value update count counter 22 writes the maximum value update count as “0” in the maximum value update count column of the memory usage information storage unit 312 at the point P101 when the memory usage is initially acquired. Thereafter, each time the maximum value is updated, 1 is added to the maximum value update count, such as “1” at the point P102 and “2” at the point P103, and the memory usage information storage unit 312 Write in the maximum update count column. In the case of FIG. 7, since the maximum value is not updated at the point P106, the maximum value update count reaches the update count threshold “8” at the point P110.

あるプロセスにメモリリークが発生している場合、当該プロセスが確保したメモリ領域のうちメモリリークする領域が解放されないので、当該プロセスのメモリ使用量は図7に示すように時間経過に応じて増加していくと考えられる。そこで、メモリリーク判定部23は、メモリ使用量の最大値更新回数が更新回数閾値以上であることを、メモリリーク判定条件の1つとしている。一方、プロセスの正常動作においてメモリ使用量が増加する場合は、当該プロセスの確保したメモリ領域が処理終了後に解放されることにより、当該プロセスのメモリ使用量が一定の範囲内に収まる、すなわち一定値以上とならないことが期待できる。そこで、メモリリーク判定部23は、プロセスの正常動作におけるメモリ使用量の漸増によりメモリリーク有りとする誤判定を低減させるために、メモリ使用量の現在値が、メモリ使用量閾値THR以下である場合は、メモリ使用量の最大値更新回数が更新回数閾値以上か否かにかかわらず、メモリリーク無しと判定する。   When a memory leak occurs in a process, the memory leaking area of the memory area secured by the process is not released, so the memory usage of the process increases with time as shown in FIG. It is thought to go. Therefore, the memory leak determination unit 23 sets one of the memory leak determination conditions that the maximum value update count of the memory usage is equal to or greater than the update count threshold. On the other hand, if the memory usage increases during normal operation of the process, the memory area secured by the process is released after the processing is completed, so that the memory usage of the process falls within a certain range, that is, a certain value It can be expected that it will not be more. Accordingly, the memory leak determination unit 23 is configured to reduce the erroneous determination that there is a memory leak due to the gradual increase of the memory usage during normal operation of the process, when the current value of the memory usage is equal to or less than the memory usage threshold THR. Determines that there is no memory leak regardless of whether or not the maximum memory usage update count is equal to or greater than the update count threshold.

なお、メモリリーク判定部23が、メモリ使用量最大値の更新回数と更新回数閾値との比較のみでメモリリークの有無を判定するようにしてもよい。この場合、メモリ使用量の最大値更新回数が更新回数閾値以上となると、メモリリーク判定部23は、メモリ使用量の現在値にかかわらずメモリリーク有りと判定するので、より早い段階でメモリリークを検出し得る。
一方、上述のように、メモリ使用量最大値の更新回数が更新回数閾値以上であることに加えて、メモリ使用量の現在値がメモリ使用量閾値THR以上であることも判定条件とすることにより、正常動作におけるメモリ使用量の漸増によりメモリリーク有りと誤判定する可能性を低減できる。
Note that the memory leak determination unit 23 may determine the presence or absence of a memory leak only by comparing the number of updates of the memory usage maximum value with the update count threshold. In this case, when the maximum number of updates of the memory usage exceeds the update count threshold, the memory leak determination unit 23 determines that there is a memory leak regardless of the current value of the memory usage. Can be detected.
On the other hand, as described above, in addition to the update count of the memory usage maximum value being equal to or greater than the update count threshold, the determination that the current value of the memory usage is equal to or greater than the memory usage threshold THR The possibility of erroneous determination that there is a memory leak can be reduced by gradually increasing the memory usage during normal operation.

なお、プロセス起動直後は、プロセスが未だメモリ領域を確保しておらず、メモリ使用量が極端に小さい値を示すことが考えられる。このため、メモリ使用量取得部21が、メモリ使用量の初回取得値としてプロセス起動直後のメモリ使用量を取得し、この値に基づいてメモリ使用量閾値THRを算出すると、メモリ使用量閾値THRの値が極端に小さい値となり、上述した、プロセスの正常動作におけるメモリ使用量の漸増によりメモリリーク有りとする誤判定の低減を行えないおそれがある。そこで、メモリ使用量取得部21は、プロセス起動から一定時間経過後の点P101において初回のメモリ使用量取得を行っている。
なお、プロセスが起動時に直ちにメモリ領域を確保するようプログラムされている場合は、メモリ使用量取得部21が、プロセス起動時に初回のメモリ使用量取得を行うようにしてもよい。これにより、メモリ使用量取得部21が、プロセス起動から一定時間経過後に初回のメモリ使用量取得を行う場合よりも更に早い段階でメモリリークを検出し得る。
It should be noted that immediately after the process is activated, the process has not yet secured a memory area, and the memory usage may be extremely small. For this reason, when the memory usage acquisition unit 21 acquires the memory usage immediately after starting the process as the initial acquisition value of the memory usage, and calculates the memory usage threshold THR based on this value, the memory usage threshold THR The value becomes extremely small, and there is a possibility that the erroneous determination that there is a memory leak cannot be reduced due to the gradual increase of the memory usage amount in the normal operation of the process described above. Therefore, the memory usage acquisition unit 21 acquires the first memory usage at a point P101 after a predetermined time has elapsed since the process activation.
If the process is programmed to reserve a memory area immediately upon startup, the memory usage acquisition unit 21 may acquire the initial memory usage when the process is started. As a result, the memory usage acquisition unit 21 can detect a memory leak at an earlier stage than when the memory usage acquisition is performed for the first time after a predetermined time has elapsed since the process activation.

図8は、メモリリーク判定部が、メモリリーク無しと判定する第1の例を示すグラフであり、プロセスのメモリ使用量が一時的にメモリ使用量閾値以上となる例を示している。図7と同様、図8の縦軸はメモリサイズを示し、横軸はプロセスが起動してからの時間を示す。点P201〜P210は、それぞれの時間においてメモリ使用量取得部21が取得する、当該プロセスのメモリ使用量を示す。THRはメモリ使用量閾値を示す。   FIG. 8 is a graph illustrating a first example in which the memory leak determination unit determines that there is no memory leak, and illustrates an example in which the memory usage of the process temporarily exceeds the memory usage threshold. As in FIG. 7, the vertical axis of FIG. 8 indicates the memory size, and the horizontal axis indicates the time since the process was started. Points P201 to P210 indicate the memory usage of the process acquired by the memory usage acquisition unit 21 at each time. THR indicates a memory usage threshold.

グラフ表示されているプロセスのメモリ使用量は、点P202においてメモリ使用量閾値THR以上となっているが、この時点でのメモリ使用量の最大値更新回数は「1」であり、更新回数閾値「8」未満なので、メモリリーク判定部23は、メモリリーク無しと判定する。また、点P203〜P210でのメモリ使用量は、点P202でのメモリ使用量以下なので、メモリ使用量の最大値更新回数は「1」のまままである。このため、メモリ使用量の最大値更新回数が「0」の点P201も含め、点P201および点P203〜P210でも、メモリリーク判定部23は、メモリリーク無しと判定する。なお、点P201および点P203〜210では、メモリ使用量の現在値がメモリ使用量閾値THR未満であることからも、メモリリーク判定部23は、メモリリーク無しと判定する。   The memory usage of the process displayed in the graph is equal to or greater than the memory usage threshold value THR at the point P202, but the maximum memory usage update count at this point is “1”, and the update frequency threshold “ Since it is less than 8 ”, the memory leak determination unit 23 determines that there is no memory leak. Further, since the memory usage at the points P203 to P210 is equal to or less than the memory usage at the point P202, the maximum number of times the memory usage is updated remains “1”. For this reason, the memory leak determination unit 23 also determines that there is no memory leak at the point P201 and the points P203 to P210 including the point P201 where the maximum value of the memory usage amount is “0”. Note that at the point P201 and the points P203 to 210, the current value of the memory usage is less than the memory usage threshold THR, so the memory leak determination unit 23 determines that there is no memory leak.

このように、メモリリーク判定部23は、メモリ使用量の最大値更新回数に基づいてメモリリークの有無を判定するので、メモリ使用量とメモリ使用量閾値との比較のみでメモリリークの判定を行う方法とは異なり、プロセスの正常動作において増減するメモリ使用量が、一時的にメモリ使用量閾値よりも大きくなった場合に、メモリリーク有りと誤判定する可能性を低減できる。   As described above, the memory leak determination unit 23 determines the presence / absence of a memory leak based on the maximum number of times the memory usage is updated. Therefore, the memory leak is determined only by comparing the memory usage with the memory usage threshold. Unlike the method, when the memory usage that increases or decreases in the normal operation of the process temporarily exceeds the memory usage threshold, it is possible to reduce the possibility of erroneously determining that there is a memory leak.

図9は、メモリリーク判定部が、メモリリーク無しと判定する第2の例を示すグラフであり、プロセスが定期的に一定のメモリ領域を確保する場合の例を示している。図7〜図8と同様、図9の縦軸はメモリサイズを示し、横軸はプロセスが起動してからの時間を示す。点P301〜P310は、それぞれの時間においてメモリ使用量取得部21が取得する、当該プロセスのメモリ使用量を示す。THRはメモリ使用量閾値を示す。   FIG. 9 is a graph illustrating a second example in which the memory leak determination unit determines that there is no memory leak, and illustrates an example in which a process periodically secures a certain memory area. As in FIGS. 7 to 8, the vertical axis in FIG. 9 indicates the memory size, and the horizontal axis indicates the time since the process was started. Points P301 to P310 indicate the memory usage of the process acquired by the memory usage acquisition unit 21 at each time. THR indicates a memory usage threshold.

グラフ表示されているプロセスのメモリ使用量は、点P302においてメモリ使用量閾値THR以上となっているが、この時点でのメモリ使用量の最大値更新回数は「1」であり、更新回数閾値「8」未満なので、メモリリーク判定部23は、メモリリーク無しと判定する。また、点P306および点P309でのメモリ使用量は、点P303でのメモリ使用量と同じであり、点P304〜P310でメモリ使用量の最大値更新回数は「1」のままである。このため、メモリ使用量の最大値更新回数が「0」の点P301〜P302も含め、点P301〜P302および点P304〜P310でも、メモリリーク判定部23は、メモリリーク無しと判定する。なお、点P301とP302とP304とP305とP307とP308とP310とでは、メモリ使用量の現在値がメモリ使用量閾値THR未満であることからも、メモリリーク判定部23は、メモリリーク無しと判定する。   The memory usage of the process displayed in the graph is equal to or greater than the memory usage threshold THR at the point P302, but the maximum memory usage update count at this point is “1”, and the update count threshold “ Since it is less than 8 ”, the memory leak determination unit 23 determines that there is no memory leak. In addition, the memory usage at the points P306 and P309 is the same as the memory usage at the point P303, and the maximum number of times the memory usage is updated at points P304 to P310 remains “1”. For this reason, the memory leak determination unit 23 also determines that there is no memory leak in the points P301 to P302 and the points P304 to P310, including the points P301 to P302 where the maximum number of times of updating the memory usage is “0”. At points P301, P302, P304, P305, P307, P308, and P310, the memory leak determination unit 23 determines that there is no memory leak because the current value of the memory usage is less than the memory usage threshold THR. To do.

このように、メモリリーク判定部23は、メモリ使用量の最大値更新回数に基づいてメモリリークの有無を判定するので、メモリ使用量とメモリ使用量閾値との比較のみでメモリリークの判定を行う方法とは異なり、プロセスの正常動作において増減するメモリ使用量が、定期的にメモリ使用量閾値よりも大きくなる場合にも、メモリリーク有りと誤判定する可能性を低減できる。   As described above, the memory leak determination unit 23 determines the presence / absence of a memory leak based on the maximum number of times the memory usage is updated. Therefore, the memory leak is determined only by comparing the memory usage with the memory usage threshold. Unlike the method, it is possible to reduce the possibility of erroneously determining that there is a memory leak even when the memory usage that increases or decreases in the normal operation of the process regularly exceeds the memory usage threshold.

図10は、メモリリーク判定部が、メモリリーク無しと判定する第3の例を示すグラフであり、プロセスのメモリ使用量がメモリ使用量閾値未満の範囲で変化する場合の例を示している。図7〜図9と同様、図10の縦軸はメモリサイズを示し、横軸はプロセスが起動してからの時間を示す。点P401〜P410は、それぞれの時間においてメモリ使用量取得部21が取得する、当該プロセスのメモリ使用量を示す。THRはメモリ使用量閾値を示す。   FIG. 10 is a graph illustrating a third example in which the memory leak determination unit determines that there is no memory leak, and illustrates an example in which the memory usage of the process changes within a range less than the memory usage threshold. Similar to FIGS. 7 to 9, the vertical axis in FIG. 10 indicates the memory size, and the horizontal axis indicates the time since the process was started. Points P401 to P410 indicate the memory usage of the process acquired by the memory usage acquisition unit 21 at each time. THR indicates a memory usage threshold.

同図の例では、点P402〜P409でメモリ使用量の最大値が更新され、点409で最大値更新回数が更新回数閾値と同じ「8」となっている。しかし、点P409の現在値は判定閾値THRよりも小さいため、メモリリーク判定部23は、点P409でメモリリーク無しと判定する。また、点P401〜P408およびP410でも、メモリ使用量はメモリ使用量閾値未満であり、メモリリーク判定部23はメモリリーク無しと判定する。なお、点P401〜P408では、メモリ使用量の最大値更新回数は、更新回数閾値「8」未満であり、この点でも、メモリリーク判定部23は、メモリリーク無しと判定する。   In the example of the figure, the maximum value of the memory usage is updated at points P402 to P409, and the maximum value update count is “8” at the point 409, which is the same as the update count threshold value. However, since the current value of the point P409 is smaller than the determination threshold value THR, the memory leak determination unit 23 determines that there is no memory leak at the point P409. Also, at points P401 to P408 and P410, the memory usage is less than the memory usage threshold, and the memory leak determination unit 23 determines that there is no memory leak. At points P401 to P408, the maximum memory usage update count is less than the update count threshold “8”. In this respect as well, the memory leak determination unit 23 determines that there is no memory leak.

プロセスの正常動作においてメモリ使用量が増加する場合は、当該プロセスの確保したメモリ領域が処理終了後に解放されることにより、例えば図10の点P410のように、メモリ使用量が減少することが期待できる。これにより、当該プロセスのメモリ使用量が一定の範囲内に収まる、すなわち一定値以上とならないことが期待できる。そこで、前述したように、メモリリーク判定部23は、プロセスの正常動作におけるメモリ使用量の漸増によりメモリリーク有りとする誤判定を低減させるために、メモリ使用量の現在値が、メモリ使用量閾値THR以上であることを、メモリリーク判定条件の1つとしている。   When the memory usage increases in the normal operation of the process, it is expected that the memory usage will decrease as the memory area secured by the process is released after the processing is completed, for example, as indicated by a point P410 in FIG. it can. Thereby, it can be expected that the memory usage of the process falls within a certain range, that is, not more than a certain value. Therefore, as described above, the memory leak determination unit 23 determines that the current value of the memory usage is the memory usage threshold value in order to reduce the erroneous determination that there is a memory leak due to the gradual increase of the memory usage during the normal operation of the process. One of the memory leak determination conditions is THR or more.

次に、図11を参照して、メモリリーク判定装置1の動作について説明する。
図11は、メモリリーク判定装置1が、ある1つのプロセスに関して行う、メモリリーク有無の判定処理手順を示す図である。メモリリーク判定装置1は、新たにプロセスが実行されると同図の処理を開始する。以下では、同図でメモリリーク有無の判定対象となるプロセスを「対象プロセス」という。
新たに対象プロセスが実行されると、例えばOS(Operating System)が、対象プロセスのプロセスIDとプロセス名と実行開始時刻とをメモリ使用量取得部21に出力する。メモリ使用量取得部21は、OSから出力されたプロセスIDとプロセス名と実行開始時刻とを対応付けて、プロセス情報記憶部311が記憶するプロセス情報に追加する。また、メモリ使用量取得部21は、OSから出力されたプロセスIDとプロセス名とを対応付けて、メモリ使用量情報記憶部312が記憶するメモリ使用量情報に追加する(以上、ステップS101)。
Next, the operation of the memory leak determination apparatus 1 will be described with reference to FIG.
FIG. 11 is a diagram showing a procedure for determining whether or not there is a memory leak, which the memory leak determination apparatus 1 performs regarding a certain process. When a new process is executed, the memory leak determination apparatus 1 starts the process shown in FIG. In the following, the process for determining whether or not there is a memory leak is referred to as “target process” in FIG.
When the target process is newly executed, for example, an OS (Operating System) outputs the process ID, process name, and execution start time of the target process to the memory usage acquisition unit 21. The memory usage acquisition unit 21 associates the process ID, process name, and execution start time output from the OS, and adds them to the process information stored in the process information storage unit 311. In addition, the memory usage acquisition unit 21 associates the process ID output from the OS with the process name and adds it to the memory usage information stored in the memory usage information storage unit 312 (step S101).

その後、メモリ使用量取得部21は、所定の時間経過を待って(ステップS102)、対象プロセスのメモリ使用量を取得する(ステップS103)。
所定の時間経過を待つのは、上述したように、対象プロセスが未だメモリ領域を確保していない状態における、極端に小さいメモリ使用量に基づいて、メモリ使用量閾値THRを算出することを防止するためである。ステップS102での待ち時間は、判定条件情報記憶部313が記憶する判定時間間隔と同じであってもよいし、判定時間間隔とは別に定められた時間であってもよい。例えば、ユーザが、プロセスの正常動作時における時間毎のメモリ使用量の統計をとり、この統計に基づいてステップS102の待ち時間とメモリ使用量閾値算出係数とを決定して判定条件情報記憶部313に書き込むようにしてもよい。
メモリ使用量取得部21は、例えば、実行中の各プロセスのプロセスIDとプロセス名とメモリ使用量との出力をOSから随時受けており、ステップS102の所定時間経過時にOSから出力されるメモリ使用量を、メモリ使用量取得値とする。
Thereafter, the memory usage acquisition unit 21 waits for a predetermined time (step S102) and acquires the memory usage of the target process (step S103).
As described above, waiting for the elapse of the predetermined time prevents the memory usage threshold value THR from being calculated based on an extremely small memory usage amount in a state where the target process has not yet secured the memory area. Because. The waiting time in step S102 may be the same as the determination time interval stored in the determination condition information storage unit 313, or may be a time determined separately from the determination time interval. For example, the user takes statistics of memory usage for each time during normal operation of the process, and determines the waiting time and memory usage threshold value calculation coefficient in step S102 based on the statistics, thereby determining the condition information storage unit 313. You may make it write in.
The memory usage acquisition unit 21 receives, for example, the process ID, process name, and memory usage of each process being executed from the OS as needed, and the memory usage output from the OS when a predetermined time elapses in step S102. Let the amount be the memory usage acquisition value.

メモリ使用量取得部21は、取得したメモリ使用量を、メモリ使用量情報記憶部312の記憶するメモリ使用量情報の、対象プロセスの行の初期値欄と最大値欄と現在値欄とに書き込む。また、メモリ使用量取得部21は、判定条件情報記憶部313からメモリ使用量閾値算出係数を読み出し、読み出したメモリ使用量閾値算出係数を、先に取得したメモリ使用量に乗じることにより、メモリ使用量閾値を算出する。メモリ使用量取得部21は、算出したメモリ使用量閾値を、メモリ使用量情報の対象プロセスの行のメモリ使用量閾値欄に書き込む。さらに、メモリ使用量取得部21は、メモリ使用量情報の対象プロセスの行の最大値更新回数欄に「0」を書き込む。加えて、メモリ使用量取得部21は、判定条件情報記憶部313から判定時間間隔を読み出し、読み出した判定時間間隔を、ステップS103においてメモリ使用量を取得した時刻に加えることにより、対象プロセスのメモリリーク有無の判定を次に行う時刻を算出する。メモリ使用量取得部21は、算出した時刻を、プロセス情報の当該プロセスの行の次回時刻欄に書き込む(以上、ステップS104)。   The memory usage acquisition unit 21 writes the acquired memory usage in the initial value column, maximum value column, and current value column of the target process row of the memory usage information stored in the memory usage information storage unit 312. . The memory usage acquisition unit 21 reads out the memory usage threshold value calculation coefficient from the determination condition information storage unit 313, and multiplies the read memory usage threshold value calculation coefficient by the previously acquired memory usage amount, thereby increasing the memory usage. An amount threshold is calculated. The memory usage acquisition unit 21 writes the calculated memory usage threshold in the memory usage threshold column of the target process row of the memory usage information. Further, the memory usage acquisition unit 21 writes “0” in the maximum value update count column of the row of the target process of the memory usage information. In addition, the memory usage acquisition unit 21 reads the determination time interval from the determination condition information storage unit 313, and adds the read determination time interval to the time when the memory usage is acquired in step S103, so that the memory of the target process is obtained. The next time for determining whether there is a leak is calculated. The memory usage acquisition unit 21 writes the calculated time in the next time column of the process line of the process information (step S104).

そして、メモリ使用量取得部21は、次回時刻に書き込んだ時刻となるまで時間経過待ちを行う(ステップS105)。その後、メモリ使用量取得部21は、対象プロセスが実行中か否かを判定する。例えば、メモリ使用量取得部21は、OSから随時出力される実行中のプロセスの情報に、対象プロセスのプロセスIDとプロセス名とが含まれている場合は、対象プロセスが実行中であると判定する。一方、対象プロセスのプロセスIDとプロセス名とが含まれていない場合は、メモリ使用量取得部21は、対象プロセスが実行中ではないと判定する(以上、ステップS106)。対象プロセスが実行中でないと判定した場合(ステップS106:NO)、メモリ使用量取得部21は、プロセス情報とメモリ使用量情報とから、対象プロセスの行を削除する(ステップS121)。その後、図11の処理を終了する。   Then, the memory usage acquisition unit 21 waits for the elapse of time until the time written at the next time is reached (step S105). Thereafter, the memory usage acquisition unit 21 determines whether the target process is being executed. For example, the memory usage acquisition unit 21 determines that the target process is being executed when the process ID and process name of the target process are included in the information of the process being executed that is output as needed from the OS. To do. On the other hand, when the process ID and the process name of the target process are not included, the memory usage acquisition unit 21 determines that the target process is not being executed (step S106). If it is determined that the target process is not being executed (step S106: NO), the memory usage acquisition unit 21 deletes the row of the target process from the process information and the memory usage information (step S121). Then, the process of FIG. 11 is complete | finished.

一方、ステップS106で、対象プロセスが実行中であると判定した場合(ステップS106:YES)、メモリ使用量取得部21は、対象プロセスのメモリ使用量を取得し(ステップS107)、メモリ使用量情報記憶部312が記憶する対象プロセスのメモリ使用量の現在値を、取得したメモリ使用量に更新する。
また、メモリ使用量取得部21は、プロセス情報記憶部311が記憶するプロセス情報から次回時刻を読み出す。上述したように、次回時刻は、メモリリーク判定装置1(のメモリリーク判定部23)が、次に対象プロセスのメモリリークを判定する時刻を示す情報である。また、メモリ使用量取得部21は、判定条件情報記憶部313が記憶する判定条件情報から、判定時間間隔を読み出す。メモリ使用量取得部21は、読み出した次回時刻に判定時間間隔を加えることにより新たな次回時刻を算出し、プロセス情報記憶部311の記憶する対象プロセスの次回時刻を、算出した次回時刻に更新する。
On the other hand, when it is determined in step S106 that the target process is being executed (step S106: YES), the memory usage acquisition unit 21 acquires the memory usage of the target process (step S107), and the memory usage information The current value of the memory usage of the target process stored in the storage unit 312 is updated to the acquired memory usage.
In addition, the memory usage acquisition unit 21 reads the next time from the process information stored in the process information storage unit 311. As described above, the next time is information indicating the time when the memory leak determination device 1 (the memory leak determination unit 23) next determines the memory leak of the target process. Further, the memory usage acquisition unit 21 reads the determination time interval from the determination condition information stored in the determination condition information storage unit 313. The memory usage acquisition unit 21 calculates a new next time by adding a determination time interval to the read next time, and updates the next time of the target process stored in the process information storage unit 311 to the calculated next time. .

その後、メモリ使用量取得部21は、メモリ使用量の現在値を更新したことを示す信号を最大値更新回数計数部22に出力する。例えば、メモリ使用量取得部21は、メモリ使用量現在値を更新したことを示す信号に対象プロセスのプロセスIDを含めて出力する。これにより、最大値更新回数計数部22は、対象プロセスがどのプロセスかを把握できる(以上、ステップS108)。   Thereafter, the memory usage acquisition unit 21 outputs a signal indicating that the current value of the memory usage has been updated to the maximum value update count counter 22. For example, the memory usage acquisition unit 21 outputs a signal indicating that the memory usage current value has been updated, including the process ID of the target process. Thereby, the maximum value update number counting unit 22 can grasp which process is the target process (step S108).

最大値更新回数計数部22は、メモリ使用量の現在値を更新したことを示す信号の出力を受けると、対象プロセスのメモリ使用量の現在値と最大値とをメモリ使用量情報記憶部312から読み出す。そして、最大値更新回数計数部22は、最大値が更新されたか否か、すなわち、読み出した現在値が最大値よりも大きいか否かを判定する(以上、ステップS109)。最大値が更新されたと判定した場合(ステップS109:YES)、最大値更新回数計数部22は、メモリ使用量情報記憶部312の記憶する、対象プロセスのメモリ使用量の最大値欄に、対象プロセスのメモリ使用量の現在値を書き込む。また、最大値更新回数計数部22は、メモリ使用量情報記憶部312の記憶する、対象プロセスのメモリ使用量の最大値更新回数を、当該最大値更新回数に1を加えた値に更新する。
その後、最大値更新回数計数部22は、メモリ使用量取得部21から出力された、メモリ使用量の現在値を更新したことを示す信号を、メモリリーク判定部23に出力(転送)する(以上、ステップS110)。
When receiving the output of the signal indicating that the current value of the memory usage is updated, the maximum value update count counting unit 22 obtains the current value and the maximum value of the memory usage of the target process from the memory usage information storage unit 312. read out. Then, the maximum value update count counter 22 determines whether or not the maximum value has been updated, that is, whether or not the read current value is greater than the maximum value (step S109). When it is determined that the maximum value has been updated (step S109: YES), the maximum value update count counter 22 stores the target process in the maximum value column of the memory usage of the target process stored in the memory usage information storage unit 312. Write the current value of memory usage for. In addition, the maximum value update count counter 22 updates the maximum value update count of the memory usage of the target process stored in the memory usage information storage 312 to a value obtained by adding 1 to the maximum update count.
Thereafter, the maximum value update count counter 22 outputs (transfers) a signal output from the memory usage acquisition unit 21 and indicating that the current value of the memory usage has been updated to the memory leak determination unit 23 (above). Step S110).

メモリリーク判定部23は、メモリ使用量の現在値を更新したことを示す信号の出力を受けると、対象プロセスに関するメモリリークの有無を判定する。上述したように、メモリリーク判定部23は、メモリ使用量情報記憶部312から、対象プロセスのメモリ使用量の現在値Mと、最大値更新回数Uと、メモリ使用量閾値Tとを読み出し、判定条件情報記憶部313から、更新回数閾値Tを読み出す。そして、メモリリーク判定部23は、式(1)が成立する場合は、対象プロセスに関してメモリリーク有りと判定し、成立しない場合は、対象プロセスに関してメモリリーク無しと判定する(以上ステップS111)。
M≧T、かつ、U≧T ・・・ 式(1)
When receiving a signal indicating that the current value of the memory usage has been updated, the memory leak determination unit 23 determines whether there is a memory leak related to the target process. As described above, the memory leak determination unit 23 reads the current value M of the memory usage of the target process, the maximum value update count U, and the memory usage threshold T M from the memory usage information storage unit 312. from the determination condition information storage unit 313, reads the number of updates threshold T U. The memory leak determination unit 23 determines that there is a memory leak with respect to the target process when Expression (1) is satisfied, and determines that there is no memory leak with respect to the target process when the expression (1) is not satisfied (step S111).
M ≧ T M and U ≧ T U Formula (1)

メモリリーク有りと判定した場合(ステップS111:YES)、メモリリーク判定部23は、対策処理の実行を指示する信号に対象プロセスのプロセスIDを含めて対策処理実行部24に出力する。
対策処理実行部24は、対策処理の実行を指示する信号の出力を受けると、メモリリークに対する対策処理を実行する。具体的には、対策処理実行部24は、対策処理の実行を指示する信号から対象プロセスのプロセスIDを読み出し、また、処理内容情報記憶部314から、選択フラグが「○」になっている処理の実行コマンドを読み出す。そして、対策処理実行部24は、読み出したプロセスIDが示す対象プロセスに関して、読み出した実行コマンドを実行する(以上ステップS112)。その後、ステップS105に戻る。
If it is determined that there is a memory leak (step S111: YES), the memory leak determination unit 23 includes the process ID of the target process in a signal instructing execution of the countermeasure process, and outputs the signal to the countermeasure process execution unit 24.
When the countermeasure processing execution unit 24 receives an output of a signal instructing execution of the countermeasure processing, the countermeasure processing executing unit 24 executes countermeasure processing for the memory leak. Specifically, the countermeasure process execution unit 24 reads the process ID of the target process from the signal instructing execution of the countermeasure process, and the process whose selection flag is “◯” from the process content information storage unit 314. Read the execution command. Then, the countermeasure processing execution unit 24 executes the read execution command for the target process indicated by the read process ID (step S112). Thereafter, the process returns to step S105.

一方、ステップS109において、最大値が更新されていないと判定した場合(ステップS109:NO)はステップS111に進む。すなわち、最大値および最大値更新回数を更新せずに、メモリリーク有無の判定に進む。
また、ステップS111でメモリリーク無しと判定した場合(ステップS111:NO)はステップS105に戻る。すなわち、メモリリークに対する対策処理を行わずに、次回時刻到達を待ち受ける。
On the other hand, if it is determined in step S109 that the maximum value has not been updated (step S109: NO), the process proceeds to step S111. That is, the process proceeds to the determination of the presence or absence of memory leak without updating the maximum value and the maximum value update count.
If it is determined in step S111 that there is no memory leak (step S111: NO), the process returns to step S105. That is, the next time arrival is awaited without taking measures against the memory leak.

以上のように、メモリリーク判定装置1のメモリリーク判定部23は、対象プロセスのメモリ使用量の最大値更新回数が最大値更新回数閾値以上か否かに基づいてメモリリークの有無を判定する。したがって、プロセスのメモリ使用量が閾値以上か否かのみでメモリリークの有無を判定するメモリリーク判定装置と比較すると、メモリリーク判定装置1は、メモリ使用量が当該閾値未満の、より早い段階でメモリリークを検出できる。この点で、メモリリーク判定装置1は、メモリリークの発生を早期に検知できる。
また、実際にはメモリリークが発生しておらず、対象プロセスのメモリ使用量が一時的に増加したに過ぎない場合、メモリリーク判定装置1は、対象プロセスのメモリ使用量の最大値更新回数に基づいて、メモリリーク無しと判定し得る。
As described above, the memory leak determination unit 23 of the memory leak determination apparatus 1 determines the presence or absence of a memory leak based on whether or not the maximum value update count of the memory usage of the target process is equal to or greater than the maximum value update count threshold. Therefore, when compared with a memory leak determination device that determines whether or not a memory leak is present only by whether or not the memory usage of the process is equal to or greater than a threshold, the memory leak determination device 1 is earlier in the memory usage than the threshold. A memory leak can be detected. In this respect, the memory leak determination apparatus 1 can detect the occurrence of the memory leak at an early stage.
In addition, when no memory leak actually occurs and the memory usage of the target process is merely increased temporarily, the memory leak determination apparatus 1 sets the maximum number of times of update of the memory usage of the target process. Based on this, it can be determined that there is no memory leak.

また、比較的大きなメモリ領域を確保するプロセスが一定時間以上実行状態にある場合など、メモリ使用量増加率が大きな値となる場合でも、メモリリークが発生していない場合は、メモリ使用量が一定の範囲内に収まり、メモリ使用量の最大値更新回数が最大値更新回数閾値を超えないことが期待できる。この場合、メモリリーク判定装置1は、メモリリーク無しと判定できる。この点で、メモリリーク判定装置1は、メモリ使用量増加率の大小にかかわらず、メモリリークの有無について誤判定を行うおそれが少ない。
さらに、メモリリークが発生している場合は、メモリ使用量の増加率の大小にかかわらず、メモリ使用量が増加し続けることが考えられる。メモリ使用量の増加率が小さい場合でも、メモリリーク検出装置1は、メモリ使用量の最大値更新回数が更新回数閾値以上、かつ、メモリ使用量がメモリ使用量閾値以上となった時点で、メモリ使用量が増加し続けていることを検出し、メモリリーク有りと判定できる。この点でも、メモリリーク判定装置1は、メモリ使用量増加率の大小にかかわらず、メモリリークの有無について誤判定を行うおそれが少ない。
Also, even if the memory usage increase rate is a large value, such as when a process that secures a relatively large memory area has been in a running state for a certain period of time, the memory usage is constant if no memory leak has occurred. It can be expected that the maximum update count of the memory usage will not exceed the maximum update count threshold. In this case, the memory leak determination apparatus 1 can determine that there is no memory leak. In this respect, the memory leak determination apparatus 1 is less likely to make an erroneous determination regarding the presence or absence of a memory leak regardless of the size of the memory usage increase rate.
Furthermore, when a memory leak occurs, it is conceivable that the memory usage continues to increase regardless of the increase rate of the memory usage. Even when the increase rate of the memory usage is small, the memory leak detection device 1 does not change the memory usage when the maximum memory usage update count is equal to or greater than the update count threshold and the memory usage is equal to or greater than the memory usage threshold. It can be determined that there is a memory leak by detecting that the usage amount continues to increase. In this respect as well, the memory leak determination apparatus 1 is less likely to make an erroneous determination as to whether or not there is a memory leak regardless of the amount of increase in memory usage.

また、メモリリーク判定部23は、対象プロセスのメモリ使用量の最大値更新回数が最大値更新回数閾値以上か否かに加えて、対象プロセスのメモリ使用量の現在値がメモリ使用量閾値以上か否かに基づいてメモリリークの有無を判定する。これにより、メモリリークが発生しておらず、対象プロセスのメモリ使用量が一定の範囲内に収まる場合に、プロセスの正常動作におけるメモリ使用量の漸増によりメモリリーク有りとする誤判定を低減できる。
また、メモリリーク判定装置1は、プロセスのメモリ使用量が閾値以上か否かのみでメモリリークの有無を判定するメモリリーク判定装置と比較すると、メモリ使用量閾値を小さい値に設定しても誤判定の可能性を低減できる。なぜなら、対象プロセスのメモリ使用量が一時的にあるいは定期的にメモリ使用量閾値以上となる場合でも、対象プロセスのメモリ使用量の最大値更新回数が最大値更新回数閾値以上か否かの判定により、メモリリークが発生していないにもかかわらずメモリリーク有りとする誤判定の可能性を低減し得るからである。
したがって、プロセスのメモリ使用量が閾値以上か否かのみでメモリリークの有無を判定するメモリリーク判定装置よりも、対象プロセスのメモリ使用量が小さい段階で、すなわち、より早期にメモリリークを検出できる。
Further, the memory leak determination unit 23 determines whether the current value of the memory usage of the target process is equal to or greater than the memory usage threshold, in addition to whether or not the maximum update count of the memory usage of the target process is equal to or greater than the maximum value update count threshold. The presence or absence of a memory leak is determined based on whether or not. As a result, when a memory leak does not occur and the memory usage of the target process falls within a certain range, it is possible to reduce an erroneous determination that there is a memory leak by gradually increasing the memory usage during normal operation of the process.
In addition, the memory leak determination apparatus 1 is erroneous even if the memory usage threshold value is set to a small value, as compared with the memory leak determination apparatus that determines the presence or absence of a memory leak only by determining whether the memory usage amount of the process is equal to or greater than the threshold value. The possibility of determination can be reduced. Because even if the memory usage of the target process temporarily or periodically exceeds the memory usage threshold, it is determined whether the maximum update count of the memory usage of the target process is equal to or higher than the maximum update count threshold. This is because it is possible to reduce the possibility of erroneous determination that there is a memory leak even though no memory leak has occurred.
Therefore, it is possible to detect a memory leak at a stage where the memory usage of the target process is small, that is, earlier than a memory leak determination device that determines whether or not a memory leak exists based on whether or not the memory usage of the process is equal to or greater than a threshold. .

また、メモリリーク判定装置1では、メモリ使用量取得部21は、メモリ使用量の初期値にメモリ使用量閾値算出係数を乗じた値、すなわち、メモリ使用量の初期値を所定定数倍した値をメモリ使用量閾値とし、メモリリーク判定部23は、このメモリ使用量閾値を用いてメモリリークの有無を判定する。このように、メモリリーク判定部23は、判定対象のプロセスの規模に応じて設定されたメモリ使用量閾値を用いてメモリリーク有無を判定するので、より正確にメモリリーク有無を判定できることが期待できる。   Further, in the memory leak determination device 1, the memory usage amount acquisition unit 21 calculates a value obtained by multiplying the initial value of the memory usage amount by the memory usage threshold calculation coefficient, that is, a value obtained by multiplying the initial value of the memory usage amount by a predetermined constant. The memory usage threshold is used, and the memory leak determination unit 23 determines the presence or absence of a memory leak using the memory usage threshold. As described above, the memory leak determination unit 23 determines the presence / absence of a memory leak by using the memory usage threshold set according to the scale of the determination target process, so that it can be expected that the presence / absence of the memory leak can be determined more accurately. .

なお、メモリリーク判定部23が、複数のプロセスについて纏めてメモリリークの有無を判定するようにしてもよい。例えば、メモリ使用量取得部21は、実行中の全プロセスについてメモリ使用量を取得し、実行中の全プロセスのメモリ使用量を実行中のプロセス数で除したメモリ使用量平均値を算出する。メモリリーク判定部23は、メモリ使用量取得部21が算出したメモリ使用量平均値について、当該メモリ使用量平均値の最大値更新回数が更新回数閾値以上、かつ、当該メモリ使用量平均値がメモリ使用量平均値閾値以上のときに、メモリリーク有りと判定する。
このように、複数のプロセスについて纏めてメモリリークの有無を判定することにより、メモリ使用量情報等をプロセス毎に記憶する必要が無いので、メモリリーク判定に用いるメモリ容量を低減できる。
Note that the memory leak determination unit 23 may collectively determine the presence or absence of a memory leak for a plurality of processes. For example, the memory usage acquisition unit 21 acquires the memory usage for all the processes being executed, and calculates a memory usage average value obtained by dividing the memory usage of all the processes being executed by the number of processes being executed. The memory leak determination unit 23 has a memory usage average value calculated by the memory usage acquisition unit 21, the maximum update count of the memory usage average value is equal to or greater than an update count threshold, and the memory usage average value is a memory It is determined that there is a memory leak when the usage average value threshold is exceeded.
Thus, by determining whether or not there is a memory leak for a plurality of processes, it is not necessary to store memory usage information or the like for each process, so that the memory capacity used for memory leak determination can be reduced.

なお、メモリリーク判定部23がメモリリークの有無の判定に用いるメモリ使用量閾値は、上述したメモリ使用量の初期値に基づくものに限らない。例えば、プロセスの種類に応じて、メモリ使用量閾値が予め定められていてもよい。これにより、メモリ使用量取得部がメモリ使用量閾値を算出する負荷を削減できる。   Note that the memory usage threshold used by the memory leak determination unit 23 to determine whether there is a memory leak is not limited to the above-described initial value of the memory usage. For example, a memory usage threshold value may be determined in advance according to the type of process. Thereby, it is possible to reduce the load for the memory usage amount obtaining unit to calculate the memory usage threshold value.

<第1の変形例>
以上ではメモリリークの有無の判定を行う場合について説明したが、本発明は、プロセスがオープンしたファイルのクローズ漏れ(以下では、「ファイルリーク」という)の有無の判定にも適用できる。
ファイルリークが発生すると、クローズ漏れしたファイルのメモリ領域が解放されないことによりメモリリークが生じる。また、クローズ漏れしたファイルの解放を待っているプロセスが存在する場合、当該プロセスが当該ファイルを取得でないことにより、当該プロセス、ひいてはコンピュータの処理速度低下や動作不安定化が生じるおそれがある。
<First Modification>
Although the case where the presence / absence of a memory leak is determined has been described above, the present invention can also be applied to the determination of the presence / absence of a close of a file opened by a process (hereinafter referred to as “file leak”).
When a file leak occurs, a memory leak occurs because the memory area of the file that has been closed is not released. In addition, when there is a process waiting for the release of a file that has been closed, the process does not acquire the file, which may cause a reduction in the processing speed of the process, and instability of the computer.

図12は、本発明の第1の変形例におけるファイルリーク判定装置の概略構成を示す構成図である。同図において、ファイルリーク判定装置(コンピュータ資源解放漏れ判定装置)4は、操作入力部11と、表示部12と、オープンファイル数取得部(コンピュータ資源使用量取得部)51と、最大値更新回数計数部52と、ファイルリーク判定部(解放漏れ判定部)53と、対策処理実行部24と、記憶部61とを具備する。記憶部61は、プロセス情報記憶部311と、オープンファイル数情報記憶部612と、判定条件情報記憶部613と、処理内容情報記憶部314と、処理結果情報記憶部315とを具備する。
同図において、図1の各部と同様の機能を有する部分には、同一の符号(11、12、24、311、314、315)を付し、説明を省略する。
FIG. 12 is a block diagram showing a schematic configuration of the file leak determination apparatus in the first modification of the present invention. In the figure, a file leak determination device (computer resource release leak determination device) 4 includes an operation input unit 11, a display unit 12, an open file number acquisition unit (computer resource usage acquisition unit) 51, and a maximum value update count. A counting unit 52, a file leak determination unit (release leak determination unit) 53, a countermeasure processing execution unit 24, and a storage unit 61 are provided. The storage unit 61 includes a process information storage unit 311, an open file number information storage unit 612, a determination condition information storage unit 613, a processing content information storage unit 314, and a processing result information storage unit 315.
In the figure, the same reference numerals (11, 12, 24, 311, 314, 315) are given to the portions having the same functions as those in FIG.

オープンファイル数情報記憶部612は、実行中の各プロセスのメモリ使用量の初期値と最大値と現在値とに換えて、実行中の各プロセスのオープンファイル数の初期値と最大値と現在値とを記憶する点、および、メモリ使用量閾値に代えて、オープンファイル数閾値(オープンファイル数の現在値に対する判定閾値)を記憶する点で、図1のメモリ使用量情報記憶部312と異なる。
判定条件情報記憶部613は、メモリ使用量閾値算出係数に換えて、オープンファイル数閾値算出係数を記憶する点で、図1の判定条件情報記憶部313と異なる。オープンファイル数閾値算出係数は、オープンファイル数情報記憶部612が記憶するオープンファイル数初期値に乗じることにより、同じくオープンファイル数情報記憶部612が記憶するオープンファイル数閾値を算出するための係数である。
The open file number information storage unit 612 replaces the initial value, maximum value, and current value of the memory usage of each process being executed with the initial value, maximum value, and current value of the number of open files of each process being executed. And a memory usage amount information storage unit 312 of FIG. 1 in that an open file number threshold value (determination threshold value for the current value of the open file number) is stored instead of the memory usage amount threshold value.
The determination condition information storage unit 613 is different from the determination condition information storage unit 313 of FIG. 1 in that it stores an open file number threshold calculation coefficient instead of the memory usage threshold calculation coefficient. The open file number threshold calculation coefficient is a coefficient for calculating the open file number threshold stored in the open file number information storage unit 612 by multiplying the open file number initial value stored in the open file number information storage unit 612. is there.

オープンファイル数取得部51は、実行中の各プロセスのオープンファイル数をOSから取得し、各プロセスのオープンファイル数の初期値や現在値やオープンファイル数閾値を含むオープンファイル数情報を、オープンファイル数情報記憶部612に書き込む点で、実行中の各プロセスのメモリ使用量をOSから取得し、各プロセスのメモリ使用量の初期値や現在値やメモリ使用量閾値を含むメモリ使用量情報を、メモリ使用量情報記憶部312に書き込む図1のメモリ使用量取得部21と異なる。
最大値更新回数計数部52は、オープンファイル数の最大値が更新されたか否かを判定し、更新されたと判定した場合は、オープンファイル数情報記憶部612が記憶するオープンファイル数の最大値と最大値更新回数とを更新する点で、メモリ使用量の最大値が更新されたか否かを判定し、更新されたと判定した場合には、メモリ使用量情報記憶部312が記憶するメモリ使用量の最大値と最大値更新回数とを更新する図1の最大値更新回数計数部22と異なる。
ファイルリーク判定部53は、オープンファイル数情報記憶部612からオープンファイル数の現在値と最大値更新回数とオープンファイル数閾値とを読み出し、判定条件情報記憶部613から更新回数閾値を読み出して、最大値更新回数閾値が更新回数閾値以上であり、かつ、オープンファイル数の現在値がオープンファイル数閾値以上である場合にファイルリーク有りと判定する点で、メモリ使用量情報記憶部312からメモリ使用量の現在値と最大値更新回数とメモリ使用量閾値とを読み出し、判定条件情報記憶部313から更新回数閾値を読み出して、最大値更新回数閾値が更新回数閾値以上であり、かつ、メモリ使用量の現在値がメモリ使用量閾値以上である場合にメモリリーク有りと判定する図1のメモリリーク判定部23と異なる。
The open file number acquisition unit 51 acquires the number of open files of each process being executed from the OS, and displays the open file number information including the initial value, current value, and open file number threshold of the number of open files of each process. At the point of writing to the number information storage unit 612, the memory usage of each process being executed is acquired from the OS, and the memory usage information including the initial value, current value, and memory usage threshold of the memory usage of each process is obtained. This is different from the memory usage acquisition unit 21 of FIG. 1 that writes to the memory usage information storage unit 312.
The maximum value update number counting unit 52 determines whether or not the maximum value of the number of open files has been updated. If it is determined that the maximum value has been updated, the maximum number of open files stored in the open file number information storage unit 612 is determined. It is determined whether the maximum value of the memory usage has been updated in terms of updating the maximum value update count. If it is determined that the maximum value has been updated, the memory usage information storage unit 312 stores the memory usage This is different from the maximum value update count counter 22 in FIG. 1 that updates the maximum value and the maximum value update count.
The file leak determination unit 53 reads the current value of the open file number, the maximum value update count, and the open file count threshold value from the open file number information storage unit 612, and reads the update count threshold value from the determination condition information storage unit 613 to obtain the maximum When the value update count threshold is equal to or greater than the update count threshold and the current value of the number of open files is equal to or greater than the open file count threshold, it is determined from the memory usage information storage unit 312 that there is a file leak. Current value, maximum value update count, and memory usage threshold value are read, the update count threshold value is read from the determination condition information storage unit 313, the maximum value update count threshold value is equal to or greater than the update count threshold value, and the memory usage amount Unlike the memory leak determination unit 23 in FIG. 1 that determines that there is a memory leak when the current value is equal to or greater than the memory usage threshold. That.

ファイルリーク判定装置4は、オープンファイル数の最大値更新回数に基づいてファイルリークの有無を判定するので、オープンファイル数が閾値以上か否かのみでファイルリークの有無を判定するファイルリーク判定装置と比較すると、オープンファイル数が当該閾値未満の、より早い段階でファイルリークを検出できる。
また、実際にはファイルリークが発生しておらず、ファイルリーク判定対象のプロセス(以下、「対象プロセス」という)のオープンファイル数が一時的に増加したに過ぎない場合、ファイルリーク判定装置4は、対象プロセスのオープンファイル数の最大値更新回数に基づいて、ファイルリーク無しと判定し得る。
Since the file leak determination device 4 determines the presence / absence of a file leak based on the maximum number of updates of the number of open files, a file leak determination device that determines whether there is a file leak based only on whether the number of open files is equal to or greater than a threshold value In comparison, a file leak can be detected at an earlier stage where the number of open files is less than the threshold.
If no file leak actually occurs and the number of open files of the file leak determination target process (hereinafter referred to as “target process”) has only increased temporarily, the file leak determination apparatus 4 Based on the maximum number of updates of the number of open files of the target process, it can be determined that there is no file leak.

また、多数のファイルを使用するプロセスが一定時間以上実行状態にある場合など、オープンファイル数増加率が大きな値となる場合でも、ファイルリークが発生していない場合は、オープンファイル数が一定の範囲内に収まり、オープンファイル数の最大値更新回数が最大値更新回数閾値を超えないことが期待できる。この場合、ファイルリーク判定装置4は、ファイルリーク無しと判定できる。この点で、ファイルリーク判定装置1は、オープンファイル数増加率の大小にかかわらず、ファイルリークの有無について誤判定を行うおそれが少ない。
さらに、ファイルリークが発生している場合は、オープンファイル数の増加率の大小にかかわらず、オープンファイル数が増加し続けることが考えられる。オープンファイル数の増加率が小さい場合でも、ファイルリーク検出装置4は、オープンファイル数の最大値更新回数が更新回数閾値以上、かつ、オープンファイル数がオープンファイル数閾値以上となった時点で、オープンファイル数が増加し続けていることを検出し、ファイルリーク有りと判定できる。この点でも、ファイルリーク判定装置4は、オープンファイル数増加率の大小にかかわらず、ファイルリークの有無について誤判定を行うおそれが少ない。
Also, even if the increase rate of the number of open files is large, such as when a process that uses a large number of files has been in a running state for a certain period of time, if there is no file leak, the number of open files is within a certain range. It can be expected that the maximum update count of the number of open files will not exceed the maximum update count threshold. In this case, the file leak determination device 4 can determine that there is no file leak. In this respect, the file leak determination apparatus 1 is less likely to make an erroneous determination regarding the presence or absence of a file leak regardless of the increase rate of the number of open files.
Furthermore, if a file leak occurs, the number of open files may continue to increase regardless of the increase rate of the number of open files. Even when the rate of increase in the number of open files is small, the file leak detection device 4 opens when the maximum number of open file updates exceeds the update count threshold and the number of open files exceeds the open file count threshold. By detecting that the number of files continues to increase, it can be determined that there is a file leak. Also in this respect, the file leak determination device 4 is less likely to make an erroneous determination as to whether or not there is a file leak regardless of the increase rate of the number of open files.

また、ファイルリーク判定部53は、対象プロセスのオープンファイル数の最大値更新回数が最大値更新回数閾値以上か否かに加えて、対象プロセスのオープンファイル数の現在値がオープンファイル数閾値以上か否かに基づいてファイルリークの有無を判定する。これにより、ファイルリークが発生しておらず、対象プロセスのオープンフィル数が一定の範囲内に収まる場合に、プロセスの正常動作におけるオープンファイル数の漸増によりファイルリーク有りとする誤判定を低減できる。
また、ファイルリーク判定装置4は、プロセスのオープンファイル数が閾値以上か否かのみでファイルリークの有無を判定するファイルリーク判定装置と比較すると、オープンファイル数閾値を小さい値に設定しても誤判定の可能性を低減できる。なぜなら、対象プロセスのオープンファイル数が一時的にあるいは定期的にオープンファイル数閾値以上となる場合でも、対象プロセスのオープンファイル数の最大値更新回数が最大値更新回数閾値以上か否かの判定により、ファイルリークが発生していないにもかかわらずファイルリーク有りとする誤判定の可能性を低減し得るからである。
したがって、プロセスのオープンファイル数が閾値以上か否かのみでファイルリークの有無を判定するファイルリーク判定装置よりも、対象プロセスのオープンファイル数が小さい段階で、すなわち、より早期にファイルリークを検出できる。
Further, the file leak determination unit 53 determines whether the current value of the number of open files of the target process is equal to or greater than the threshold of open files, in addition to whether or not the maximum value of the number of open files of the target process is equal to or greater than the maximum value update count threshold. Whether or not there is a file leak is determined based on whether or not the file leaks. Thereby, when there is no file leak and the number of open files of the target process falls within a certain range, it is possible to reduce erroneous determination that there is a file leak by gradually increasing the number of open files in the normal operation of the process.
In addition, the file leak determination device 4 is erroneous even if the open file number threshold is set to a small value as compared with the file leak determination device that determines whether or not there is a file leak only by whether or not the number of open files in the process is equal to or greater than the threshold. The possibility of determination can be reduced. Because, even when the number of open files in the target process temporarily or periodically exceeds the open file count threshold, it is determined whether the maximum update count of the target process open file count is equal to or greater than the maximum update count threshold. This is because the possibility of erroneous determination that there is a file leak even though no file leak has occurred can be reduced.
Therefore, it is possible to detect a file leak at a stage where the number of open files of the target process is small, that is, earlier than a file leak determination device that determines whether there is a file leak only by determining whether the number of open files in the process is equal to or greater than a threshold. .

また、ファイルリーク判定装置4では、オープンファイル数取得部51は、オープンファイル数の初期値にオープンファイル数閾値算出係数を乗じた値、すなわち、オープンファイル数の初期値を所定定数倍した値をオープンファイル数閾値とし、ファイルリーク判定部53は、このオープンファイル数閾値を用いてファイルリークの有無を判定する。このように、ファイルリーク判定部53は、判定対象のプロセスの規模に応じて設定されたオープンファイル数閾値用いてファイルリーク有無を判定するので、より正確にファイルリーク有無を判定できることが期待できる。   In the file leak determination device 4, the open file number acquisition unit 51 calculates a value obtained by multiplying an initial value of the number of open files by an open file number threshold value calculation coefficient, that is, a value obtained by multiplying the initial value of the number of open files by a predetermined constant. The open file count threshold is used, and the file leak determination unit 53 determines whether there is a file leak using the open file count threshold. As described above, the file leak determination unit 53 determines the presence / absence of a file leak using the open file number threshold set in accordance with the scale of the process to be determined, so it can be expected that the file leak presence / absence can be determined more accurately.

<第2の変形例>
また、本発明は、マルチスレッド処理を行うプロセスのスレッド終了漏れ(以下では、「スレッドリーク」という)の有無の判定にも適用できる。
スレッドリークが発生すると、終了漏れしたスレッドが使用する資源の解放漏れが生じ、この解放漏れした資源を他のプロセスや他のスレッドが使用でないことにより、当該プロセス、ひいてはコンピュータの処理速度低下や動作不安定化が生じるおそれがある。
<Second Modification>
The present invention can also be applied to determining whether or not there is a thread end leak (hereinafter referred to as “thread leak”) of a process that performs multithread processing.
When a thread leak occurs, there is a release leak of resources used by the thread whose termination has been leaked, and other processes or other threads do not use the released leak resources, which reduces the processing speed or operation of the process. Instability may occur.

図13は、本発明の第2の変形例におけるスレッドリーク判定装置の概略構成を示す構成図である。同図において、スレッドリーク判定装置(コンピュータ資源解放漏れ判定装置)7は、操作入力部11と、表示部12と、スレッド数取得部(コンピュータ資源使用量取得部)81と、最大値更新回数計数部82と、スレッドリーク判定部(解放漏れ判定部)83と、対策処理実行部24と、記憶部91とを具備する。記憶部91は、プロセス情報記憶部311と、スレッド数情報記憶部912と、判定条件情報記憶部913と、処理内容情報記憶部314と、処理結果情報記憶部315とを具備する。
同図において、図1の各部と同様の機能を有する部分には、同一の符号(11、12、24、311、314、315)を付し、説明を省略する。
FIG. 13 is a configuration diagram showing a schematic configuration of a thread leak determination apparatus according to the second modification of the present invention. In the figure, a thread leak determination device (computer resource release leak determination device) 7 includes an operation input unit 11, a display unit 12, a thread number acquisition unit (computer resource usage acquisition unit) 81, and a maximum value update count. Unit 82, thread leak determination unit (release leak determination unit) 83, countermeasure processing execution unit 24, and storage unit 91. The storage unit 91 includes a process information storage unit 311, a thread number information storage unit 912, a determination condition information storage unit 913, a processing content information storage unit 314, and a processing result information storage unit 315.
In the figure, the same reference numerals (11, 12, 24, 311, 314, 315) are given to the portions having the same functions as those in FIG.

スレッド数情報記憶部912は、実行中の各プロセスのメモリ使用量の初期値と最大値と現在値とに換えて、実行中の各プロセスのスレッド数の初期値と最大値と現在値とを記憶する点、および、メモリ使用量閾値に代えて、スレッド数閾値(スレッド数の現在値に対する判定閾値)を記憶する点で、図1のメモリ使用量情報記憶部312と異なる。
判定条件情報記憶部913は、メモリ使用量閾値算出係数に換えて、スレッド数閾値算出係数を記憶する点で、図1の判定条件情報記憶部313と異なる。スレッド数閾値算出係数は、スレッド数情報記憶部912が記憶するスレッド数初期値に乗じることにより、同じくスレッド数情報記憶部912が記憶するスレッド数閾値を算出するための係数である。
The thread number information storage unit 912 replaces the initial value, maximum value, and current value of the memory usage of each process being executed with the initial value, maximum value, and current value of the thread number of each process being executed. It differs from the memory usage information storage unit 312 of FIG. 1 in that it stores a thread number threshold value (determination threshold value for the current value of the thread number) instead of the memory usage threshold value.
The determination condition information storage unit 913 is different from the determination condition information storage unit 313 of FIG. 1 in that it stores a thread count threshold calculation coefficient instead of the memory usage threshold calculation coefficient. The thread number threshold value calculation coefficient is a coefficient for calculating the thread number threshold value similarly stored in the thread number information storage unit 912 by multiplying the thread number initial value stored in the thread number information storage unit 912.

スレッド数取得部81は、実行中の各プロセスのスレッド数をOSから取得し、各プロセスのスレッド数の初期値や現在値やスレッド数閾値を含むスレッド数情報を、スレッド数情報記憶部912に書き込む点で、実行中の各プロセスのメモリ使用量をOSから取得し、各プロセスのメモリ使用量の初期値や現在値やメモリ使用量閾値を含むメモリ使用量情報を、メモリ使用量情報記憶部312に書き込む図1のメモリ使用量取得部21と異なる。
最大値更新回数計数部82は、スレッド数の最大値が更新されたか否かを判定し、更新されたと判定した場合は、スレッド数情報記憶部912が記憶するスレッド数の最大値と最大値更新回数とを更新する点で、メモリ使用量の最大値が更新されたか否かを判定し、更新されたと判定した場合には、メモリ使用量情報記憶部312が記憶するメモリ使用量の最大値と最大値更新回数とを更新する図1の最大値更新回数計数部22と異なる。
スレッドリーク判定部83は、スレッド数情報記憶部912からスレッド数の現在値と最大値更新回数とスレッド数閾値とを読み出し、判定条件情報記憶部913から更新回数閾値を読み出して、最大値更新回数閾値が更新回数閾値以上であり、かつ、スレッド数の現在値がスレッド数閾値以上である場合にスレッドリーク有りと判定する点で、メモリ使用量情報記憶部312からメモリ使用量の現在値と最大値更新回数とメモリ使用量閾値とを読み出し、判定条件情報記憶部313から更新回数閾値を読み出して、最大値更新回数閾値が更新回数閾値以上であり、かつ、メモリ使用量の現在値がメモリ使用量閾値以上である場合にメモリリーク有りと判定する図1のメモリリーク判定部23と異なる。
The thread number acquisition unit 81 acquires the thread number of each process being executed from the OS, and stores thread number information including the initial value, current value, and thread number threshold of the number of threads of each process in the thread number information storage unit 912. At the point of writing, the memory usage of each process being executed is acquired from the OS, and the memory usage information including the initial value, current value, and memory usage threshold of the memory usage of each process is stored in the memory usage information storage unit. Different from the memory usage acquisition unit 21 of FIG.
The maximum value update count counting unit 82 determines whether or not the maximum value of the number of threads has been updated. If it is determined that the maximum value has been updated, the maximum number of threads and the maximum value update stored in the thread number information storage unit 912 are determined. In the point of updating the number of times, it is determined whether or not the maximum value of the memory usage has been updated. If it is determined that the maximum value has been updated, the maximum value of the memory usage stored in the memory usage information storage unit 312 This is different from the maximum value update count counter 22 in FIG. 1 that updates the maximum value update count.
The thread leak determination unit 83 reads the current value of the thread number, the maximum value update count, and the thread count threshold value from the thread number information storage unit 912, reads the update count threshold value from the determination condition information storage unit 913, and determines the maximum value update count. The current value of memory usage and the maximum value from the memory usage information storage unit 312 are determined in that it is determined that there is a thread leak when the threshold is greater than or equal to the update count threshold and the current value of the thread count is greater than or equal to the thread count threshold. The value update count and the memory usage threshold are read, the update count threshold is read from the determination condition information storage unit 313, the maximum value update count threshold is equal to or greater than the update count threshold, and the current value of the memory usage is the memory usage 1 is different from the memory leak determination unit 23 of FIG.

スレッドリーク判定装置7は、スレッド数の最大値更新回数に基づいてスレッドリークの有無を判定するので、スレッド数が閾値以上か否かのみでスレッドリークの有無を判定するスレッドリーク判定装置と比較すると、スレッド数が当該閾値未満の、より早い段階でスレッドリークを検出できる。
また、実際にはスレッドリークが発生しておらず、スレッドリーク判定対象のプロセス(以下、「対象プロセス」という)のスレッド数が一時的に増加したに過ぎない場合、スレッドリーク判定装置7は、対象プロセスのスレッド数の最大値更新回数に基づいて、スレッドリーク無しと判定し得る。
Since the thread leak determination device 7 determines the presence or absence of a thread leak based on the maximum number of updates of the number of threads, the thread leak determination device 7 is compared with the thread leak determination device that determines the presence or absence of a thread leak only by whether or not the number of threads is equal to or greater than a threshold The thread leak can be detected at an earlier stage where the number of threads is less than the threshold value.
If no thread leak actually occurs and the number of threads of the thread leak determination target process (hereinafter referred to as “target process”) has only temporarily increased, the thread leak determination apparatus 7 It can be determined that there is no thread leak based on the maximum number of updates of the number of threads of the target process.

また、多数のスレッドを使用するプロセスが一定時間以上実行状態にある場合など、スレッド数増加率が大きな値となる場合でも、スレッドリークが発生していない場合は、スレッド数が一定の範囲内に収まり、スレッド数の最大値更新回数が最大値更新回数閾値を超えないことが期待できる。この場合、スレッドリーク判定装置4は、スレッドリーク無しと判定できる。この点で、スレッドリーク判定装置7は、スレッド数増加率の大小にかかわらず、スレッドリークの有無について誤判定を行うおそれが少ない。
さらに、スレッドリークが発生している場合は、スレッド数の増加率の大小にかかわらず、スレッド数が増加し続けることが考えられる。スレッド数の増加率が小さい場合でも、スレッドリーク検出装置7は、スレッド数の最大値更新回数が更新回数閾値以上、かつ、スレッド数がスレッド数閾値以上となった時点で、スレッド数が増加し続けていることを検出し、スレッドリーク有りと判定できる。この点でも、スレッドリーク判定装置7は、スレッド数増加率の大小にかかわらず、スレッドリークの有無について誤判定を行うおそれが少ない。
Also, even if the thread increase rate is a large value, such as when a process that uses a large number of threads is running for a certain period of time, if the thread leak does not occur, the number of threads is within a certain range. It can be expected that the maximum update count of the number of threads does not exceed the maximum update count threshold. In this case, the thread leak determination device 4 can determine that there is no thread leak. In this respect, the thread leak determination device 7 is less likely to make an erroneous determination as to whether or not there is a thread leak regardless of the increase rate of the number of threads.
Furthermore, when a thread leak occurs, the number of threads may continue to increase regardless of the increase rate of the number of threads. Even when the rate of increase in the number of threads is small, the thread leak detection device 7 increases the number of threads when the maximum number of updates of the number of threads is equal to or greater than the update count threshold and the number of threads is equal to or greater than the thread count threshold. It can be determined that there is a thread leak by detecting that it is continuing. Also in this respect, the thread leak determination device 7 is less likely to make an erroneous determination as to whether or not there is a thread leak regardless of the increase rate of the number of threads.

また、スレッドリーク判定部83は、対象プロセスのスレッド数の最大値更新回数が最大値更新回数閾値以上か否かに加えて、対象プロセスのスレッド数の現在値がスレッド数閾値以上か否かに基づいてスレッドリークの有無を判定する。これにより、スレッドリークが発生しておらず、対象プロセスのオープンフィル数が一定の範囲内に収まる場合に、プロセスの正常動作におけるスレッド数の漸増によりスレッドリーク有りとする誤判定を低減できる。
また、スレッドリーク判定装置7は、プロセスのスレッド数が閾値以上か否かのみでスレッドリークの有無を判定するスレッドリーク判定装置と比較すると、スレッド数閾値を小さい値に設定しても誤判定の可能性を低減できる。なぜなら、対象プロセスのスレッド数が一時的にあるいは定期的にスレッド数閾値以上となる場合でも、対象プロセスのスレッド数の最大値更新回数が最大値更新回数閾値以上か否かの判定により、スレッドリークが発生していないにもかかわらずスレッドリーク有りとする誤判定の可能性を低減し得るからである。
したがって、プロセスのスレッド数が閾値以上か否かのみでスレッドリークの有無を判定するスレッドリーク判定装置、対象プロセスのスレッド数が小さい段階で、すなわち、より早期にスレッドリークを検出できる。
Further, the thread leak determination unit 83 determines whether or not the current value of the number of threads of the target process is greater than or equal to the threshold for the number of threads in addition to whether or not the maximum number of updates of the number of threads of the target process is equal to or greater than the threshold for the maximum number of updates. Based on this, it is determined whether there is a thread leak. Thereby, when there is no thread leak and the number of open fills of the target process falls within a certain range, it is possible to reduce erroneous determination that there is a thread leak by gradually increasing the number of threads in the normal operation of the process.
Further, the thread leak determination device 7 is erroneously determined even if the thread number threshold is set to a small value, as compared with the thread leak determination device that determines whether or not there is a thread leak only by whether or not the number of threads of the process is equal to or greater than the threshold. The possibility can be reduced. Because even if the number of threads in the target process temporarily or periodically exceeds the thread number threshold, the thread leak is determined by determining whether the maximum number of updates in the target process is greater than or equal to the maximum value update count threshold. This is because it is possible to reduce the possibility of misjudgment that there is a thread leak even though no occurrence has occurred.
Therefore, a thread leak determination device that determines the presence or absence of a thread leak based only on whether or not the number of threads in the process is equal to or greater than a threshold value can detect a thread leak when the number of threads in the target process is small, that is, earlier.

また、スレッドリーク判定装置7では、スレッド数取得部81は、スレッド数の初期値にスレッド数閾値算出係数を乗じた値、すなわち、スレッド数の初期値を所定定数倍した値をスレッド数閾値とし、スレッドリーク判定部83は、このスレッド数閾値を用いてスレッドリークの有無を判定する。このように、スレッドリーク判定部83は、判定対象のプロセスの規模に応じて設定されたスレッド数閾値を用いてスレッドリークの有無を判定するので、より正確にスレッドリーク有無を判定できることが期待できる。   Further, in the thread leak determination device 7, the thread number acquisition unit 81 sets a value obtained by multiplying the initial value of the thread number by the thread number threshold calculation coefficient, that is, a value obtained by multiplying the initial value of the thread number by a predetermined constant, as the thread number threshold. The thread leak determination unit 83 determines the presence or absence of a thread leak using the thread number threshold. As described above, the thread leak determination unit 83 determines the presence / absence of a thread leak using the thread number threshold set in accordance with the scale of the process to be determined, so it can be expected that the presence / absence of the thread leak can be determined more accurately. .

なお、上述したように、メモリリーク判定装置1を、コンピュータ内に実現してもよい。同様に、ファイルリーク判定装置4やスレッドリーク判定装置7も、コンピュータ内に実現してもよい。具体的には、メモリリーク判定装置1や、ファイルリーク判定装置4や、スレッドリーク判定装置7の全部または一部の機能を実現するためのプログラムをコンピュータ読み取り可能な記録媒体に記録して、この記録媒体に記録されたプログラムをコンピュータシステムに読み込ませ、実行することにより各部の処理を行ってもよい。なお、ここでいう「コンピュータシステム」とは、OSや周辺機器等のハードウェアを含むものとする。
また、「コンピュータシステム」は、WWWシステムを利用している場合であれば、ホームページ提供環境(あるいは表示環境)も含むものとする。
また、「コンピュータ読み取り可能な記録媒体」とは、フレキシブルディスク、光磁気ディスク、ROM、CD−ROM等の可搬媒体、コンピュータシステムに内蔵されるハードディスク等の記憶装置のことをいう。さらに「コンピュータ読み取り可能な記録媒体」とは、インターネット等のネットワークや電話回線等の通信回線を介してプログラムを送信する場合の通信線のように、短時間の間、動的にプログラムを保持するもの、その場合のサーバやクライアントとなるコンピュータシステム内部の揮発性メモリのように、一定時間プログラムを保持しているものも含むものとする。また上記プログラムは、前述した機能の一部を実現するためのものであっても良く、さらに前述した機能をコンピュータシステムにすでに記録されているプログラムとの組み合わせで実現できるものであってもよい。
As described above, the memory leak determination apparatus 1 may be realized in a computer. Similarly, the file leak determination device 4 and the thread leak determination device 7 may be realized in a computer. Specifically, a program for realizing all or part of the functions of the memory leak determination device 1, the file leak determination device 4, and the thread leak determination device 7 is recorded on a computer-readable recording medium. Processing of each unit may be performed by causing a computer system to read and execute a program recorded on a recording medium. Here, the “computer system” includes an OS and hardware such as peripheral devices.
Further, the “computer system” includes a homepage providing environment (or display environment) if a WWW system is used.
The “computer-readable recording medium” refers to a storage device such as a flexible medium, a magneto-optical disk, a portable medium such as a ROM and a CD-ROM, and a hard disk incorporated in a computer system. Furthermore, the “computer-readable recording medium” dynamically holds a program for a short time like a communication line when transmitting a program via a network such as the Internet or a communication line such as a telephone line. In this case, a volatile memory in a computer system serving as a server or a client in that case, and a program that holds a program for a certain period of time are also included. The program may be a program for realizing a part of the functions described above, and may be a program capable of realizing the functions described above in combination with a program already recorded in a computer system.

以上、本発明の実施形態について図面を参照して詳述してきたが、具体的な構成はこの実施形態に限られるものではなく、この発明の要旨を逸脱しない範囲の設計変更等も含まれる。   The embodiment of the present invention has been described in detail with reference to the drawings. However, the specific configuration is not limited to this embodiment, and includes design changes and the like without departing from the gist of the present invention.

本発明は、資源解放漏れ判定装置、メモリリーク判定装置、資源解放漏れ判定方法およびプログラムに用いて好適である。   The present invention is suitable for use in a resource release leak determination device, a memory leak determination device, a resource release leak determination method, and a program.

1 メモリリーク判定装置
11 操作入力部
12 表示部
21 メモリ使用量取得部
22、52、82 最大値更新回数計数部
23 メモリリーク判定部
24 対策処理実行部
31、61、91 記憶部
311 プロセス情報記憶部
312 メモリ使用量情報記憶部
313、613、913 判定条件情報記憶部
314 処理内容情報記憶部
315 処理結果情報記憶部
4 ファイルリーク判定装置
51 オープンファイル数取得部
53 ファイルリーク判定部
612 オープンファイル数情報記憶部
7 スレッドリーク判定装置
81 スレッド数取得部
83 スレッドリーク判定部
912 スレッド数情報記憶部
DESCRIPTION OF SYMBOLS 1 Memory leak determination apparatus 11 Operation input part 12 Display part 21 Memory usage acquisition part 22, 52, 82 Maximum value update frequency count part 23 Memory leak determination part 24 Countermeasure process execution part 31, 61, 91 Storage part 311 Process information storage Unit 312 Memory usage information storage unit 313, 613, 913 Determination condition information storage unit 314 Processing content information storage unit 315 Processing result information storage unit 4 File leak determination device 51 Open file number acquisition unit 53 File leak determination unit 612 Number of open files Information storage unit 7 Thread leak determination device 81 Thread number acquisition unit 83 Thread leak determination unit 912 Thread number information storage unit

Claims (4)

プロセスがメモリを使用する際のメモリリークの有無を判定するメモリリーク判定装置であって、
前記プロセスのメモリ使用量を取得するメモリ使用量取得部と、
前記メモリ使用量取得部が取得する前記メモリ使用量の最大値更新回数を計数する最大値更新回数計数部と、
前記最大値更新回数計数部が計数する前記最大値更新回数に基づいて、前記メモリリークの有無を判定するメモリリーク判定部と、
を具備し、
前記メモリリーク判定部は、プロセス起動から一定時間経過後に前記メモリ使用量取得部が最初に取得した前記メモリ使用量であるメモリ使用量初期値を所定定数倍した値を閾値として、前記最大値更新回数が所定の回数より以上となり、かつ、前記メモリ使用量が前記閾値以上となった場合に、前記メモリリーク有りと判定する
ことを特徴とするメモリリーク判定装置。
A memory leak determination apparatus for determining whether or not a memory leak occurs when a process uses memory,
A memory usage acquisition unit for acquiring the memory usage of the process;
A maximum value update count counter for counting the maximum update count of the memory usage acquired by the memory usage acquisition unit;
A memory leak determination unit that determines the presence or absence of the memory leak based on the maximum value update number counted by the maximum value update number counting unit;
Equipped with,
The memory leak determination unit updates the maximum value using a value obtained by multiplying a memory usage initial value, which is the memory usage first acquired by the memory usage acquisition unit first after a predetermined time from a process startup, by a predetermined constant, as a threshold value. A memory leak determining apparatus , wherein the memory leak is determined to be present when the number of times exceeds a predetermined number and the memory usage amount is equal to or greater than the threshold value .
前記メモリ使用量取得部は、複数の前記プロセスのメモリ使用量の合計値を前記メモリ使用量として取得することを特徴とする請求項に記載のメモリリーク判定装置。 The memory leak determination device according to claim 1 , wherein the memory usage amount acquisition unit acquires a total value of memory usage amounts of a plurality of the processes as the memory usage amount. プロセスがメモリを使用する際のメモリリークの有無を判定するメモリリーク判定装置のメモリリーク判定方法であって、
メモリ使用量取得部が、前記プロセスのメモリ使用量を取得するメモリ使用量取得ステップと、
最大値更新回数計数部が、前記メモリ使用量取得部が取得する前記メモリ使用量の最大値更新回数を計数する最大値更新回数計数ステップと、
メモリリーク判定部が、前記最大値更新回数計数部が計数する前記最大値更新回数に基づいて、前記メモリリークの有無を判定するメモリリーク判定ステップと、
を具備し、
前記メモリリーク判定ステップでは、前記メモリリーク判定部は、プロセス起動から一定時間経過した後に前記メモリ使用量取得部が最初に取得した前記メモリ使用量であるメモリ使用量初期値を所定定数倍した値を閾値として、前記最大値更新回数が所定の回数より以上となり、かつ、前記メモリ使用量が前記閾値以上となった場合に、前記メモリリーク有りと判定する
ことを特徴とするメモリリーク判定方法。
A memory leak determination method of a memory leak determination apparatus for determining whether or not a memory leak occurs when a process uses memory ,
Memory usage acquisition unit, and memory usage acquiring the memory usage of the process,
Maximum value update count counting section, and the maximum value update count counting step for counting the maximum number of updates of the memory usage the memory usage acquisition unit acquires,
Memory leakage determination unit, based on the maximum value update number of times the maximum value updating count counting section counts, memory leakage determination step of determining whether said memory leaks,
Equipped with,
In the memory leak determination step, the memory leak determination unit is a value obtained by multiplying a predetermined constant by a memory usage initial value that is the memory usage first acquired by the memory usage acquisition unit after a predetermined time has elapsed since process startup. A memory leak determination method , wherein the memory leak is determined to be present when the maximum value update count is greater than or equal to a predetermined count and the memory usage is greater than or equal to the threshold .
プロセスがメモリを使用する際のメモリリークの有無を判定するメモリリーク判定装置としてのコンピュータに、
前記プロセスのメモリ使用量を取得するメモリ使用量取得ステップと、
前記メモリ使用量取得ステップにて取得する前記メモリ使用量の最大値更新回数を計数する最大値更新回数計数ステップと、
前記最大値更新回数計数ステップにて計数する前記最大値更新回数に基づいて、前記メモリリークの有無を判定するメモリリーク判定ステップと、
を実行させ
前記メモリリーク判定ステップでは、プロセス起動から一定時間経過した後に最初に取得した前記メモリ使用量であるメモリ使用量初期値を所定定数倍した値を閾値として、前記最大値更新回数が所定の回数より以上となり、かつ、前記メモリ使用量が前記閾値以上となった場合に、前記メモリリーク有りと判定させるためのプログラム。
In a computer as a memory leak determination device that determines the presence or absence of a memory leak when a process uses memory ,
And memory usage acquiring the memory usage of the process,
A maximum value update count counting step for counting the maximum value update count of the memory usage acquired in the memory usage acquisition step ;
A memory leak determination step for determining the presence or absence of the memory leak based on the maximum value update count counted in the maximum value update count counting step ;
Was executed,
In the memory leak determination step, the maximum value update count is more than a predetermined count, with a value obtained by multiplying a memory usage initial value, which is the memory usage initially acquired after a certain time has elapsed from the start of the process, by a predetermined constant. A program for determining that there is a memory leak when the memory usage is equal to or greater than the threshold value .
JP2010105153A 2010-04-30 2010-04-30 Memory leak determination device, memory leak determination method and program Expired - Fee Related JP5327886B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010105153A JP5327886B2 (en) 2010-04-30 2010-04-30 Memory leak determination device, memory leak determination method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010105153A JP5327886B2 (en) 2010-04-30 2010-04-30 Memory leak determination device, memory leak determination method and program

Publications (2)

Publication Number Publication Date
JP2011233075A JP2011233075A (en) 2011-11-17
JP5327886B2 true JP5327886B2 (en) 2013-10-30

Family

ID=45322304

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010105153A Expired - Fee Related JP5327886B2 (en) 2010-04-30 2010-04-30 Memory leak determination device, memory leak determination method and program

Country Status (1)

Country Link
JP (1) JP5327886B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6237131B2 (en) * 2013-11-07 2017-11-29 富士通株式会社 Computer program, information processing method and information processing apparatus
JP6352627B2 (en) * 2013-12-11 2018-07-04 Necプラットフォームズ株式会社 Computer system and operation method thereof
JP2018018122A (en) * 2016-07-25 2018-02-01 富士通株式会社 Information processing program, information processing apparatus, and information processing method
KR102536266B1 (en) * 2018-08-02 2023-05-25 삼성전자주식회사 Method for memory leak detection and electronic device thereof
KR102148736B1 (en) * 2018-08-23 2020-10-14 세메스 주식회사 A method of monitoring usage of memory and a substrate processing apparatus

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06223280A (en) * 1993-01-06 1994-08-12 Sony Corp Electronic apparatus
JP2004213122A (en) * 2002-12-27 2004-07-29 Idemitsu Kosan Co Ltd Stable operation method of control system by client/server and program therefor
JP2005250751A (en) * 2004-03-03 2005-09-15 Hitachi Ltd Memory leak monitoring method and program and device for performing the same
JP4512402B2 (en) * 2004-04-12 2010-07-28 株式会社日立製作所 Method for detecting cause of memory leak and execution program thereof
JP2008059102A (en) * 2006-08-30 2008-03-13 Fujitsu Ltd Program for monitoring computer resource

Also Published As

Publication number Publication date
JP2011233075A (en) 2011-11-17

Similar Documents

Publication Publication Date Title
JP5327886B2 (en) Memory leak determination device, memory leak determination method and program
US9645815B2 (en) Dynamically recommending changes to an association between an operating system image and an update group
JP5440273B2 (en) Snapshot management method, snapshot management device, and program
JP4060322B2 (en) Application management apparatus and storage medium storing software thereof
EP2616930B1 (en) Message queue management
US20140173327A1 (en) Correcting a failure associated with a current firmware image
US8930906B2 (en) Selectively allowing changes to a system
JP2009110156A (en) Log output device and log output program
JP2010086364A (en) Information processing device, operation state monitoring device and method
JPWO2011158322A1 (en) Management system and computer system management method
JP5014179B2 (en) OS priority changing device and OS priority changing program
US20110252256A1 (en) Methods, systems, and computer program products for managing an idle computing component
CN104077210B (en) The localization method and system of a kind of client collapse
JP5585303B2 (en) Library execution management system, library execution management method and program
US10795657B2 (en) Method of managing applications and computing device using the same
US9696780B2 (en) Information processing apparatus, system, management apparatus, and power status control method
JP2014219835A (en) Information processing device, control method therefor, and program
US8832708B2 (en) Process pool of empty application hosts to improve user perceived launch time of applications
EP3070610B1 (en) Information processing device, control method thereof, and recording medium
JP6828533B2 (en) Programs and information processing equipment
US9098356B2 (en) Hook re-entry prevention device and recording medium, in which program for executing method thereof in computer is recorded thereon
US20210279114A1 (en) Event loop diagnostics
JP2022114158A (en) Information processing device, and program
US20180276033A1 (en) Information processing apparatus, control method for information processing apparatus, and application management method
JP5768086B2 (en) Monitoring device, program, and monitoring method

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20121121

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121211

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130129

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20130625

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130718

R150 Certificate of patent or registration of utility model

Ref document number: 5327886

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees