The invention discloses a method for positioning
memory leak, which relates to the field of
computer science and technology, and comprises the following steps of: initializing a memory use monitoring module, setting an initial memory use rate threshold, and defining a threshold adjustment parameter; the CPU
utilization rate and the memory use condition are monitored in real time, historical data are recorded, and a memory use trend model is established. When the CPU
utilization rate exceeds the set threshold value, reducing the first preset threshold value, adjusting the second preset threshold value according to the memory use trend, and comprehensively adjusting the memory
utilization rate threshold value. And when the memory utilization rate exceeds a first preset threshold value, starting
memory leak detection, recording memory allocation and release information by using a
hash table, and searching the unreleased memory. And analyzing logs and behavior records of the
system before and after
memory leak, constructing a causal relationship model, adjusting a memory utilization rate threshold value, and generating a report containing memory leak position and reason analysis thereof. According to the method, the
predictability and the accuracy of
memory management are better improved, and the self-adaptive capability of the
system is enhanced.