Patent ID: 8479162

Claim:
A method for locating a memory leak in a program by a computer device, the method comprising the steps of: dynamically analyzing the program by the computer device to determine a memory leak characteristic, wherein dynamically analyzing the program comprising: obtaining a plurality of candidate memory leak characteristics, sorting the obtained plurality of memory leak characteristics in terms of memory leak amount, selecting, as the determined memory leak characteristic, a candidate memory leak characteristic having a maximum memory leak amount when the maximum memory leak amount exceeds a predetermined threshold, and selecting, as a plurality of the determined memory leak characteristics, the candidate memory leak characteristics whose leak amounts in total exceed the predetermined threshold when the maximum memory leak amount does not exceed the predetermined threshold; examining each instruction and filtering out items which do not match the determined memory leak characteristic of the program by the computer device in order to determine a static analysis range containing certain suspicious parts that can cause a memory leak; and statically analyzing the suspicious parts of the determined static analysis range of the program by the computer device to locate the memory leak in the program; pausing the step of statically analyzing if an item that matches the memory leak characteristics is located; reflecting the located memory leak to the source code of the program; repairing the source code of the program to get a repaired program; dynamically analyzing the repaired program; and statically analyzing the repaired program to determine if a memory leak amount of the repaired program is less than a predetermined threshold.