Patent ID: 8775769

Claim:
A partition-based method for a computer having at least one processor for diagnosing a memory leak in a Java system, comprising the at least one processor executing steps of: at application start-up, obtaining a partition plan comprising a profile defining partition owners and partition sizes and dividing a heap memory of a Java virtual machine into a plurality of partitions based on the partition plan, wherein each partition has at least one partition owner; during application execution, monitoring the status of each partition to determine whether there is a partition in which memory space is exhausted; and if there is a partition in which the memory space is exhausted, determining that a memory leak may occur in the partition and analyzing the partition to obtain leaked objects and objects related to the leaked objects and analyzing source code of an application according to obtained leaked objects and objects related to the leaked objects to acquire the code segments related to the memory leak, wherein analyzing the source code of an application comprises: according to the obtained leak objects and the objects related to the leaked objects, tracking variables which reference the objects in the source code to identify potential leaking references; extracting reference patterns of the identified potential leaking references to obtain a leaking reference which is determined as the source of memory leak; and tracking a visit command of the leaking reference which is determined as the source of memory leak to determine a correct position where a release statement for releasing the leaking reference is added.