Search

CN-122019352-A - Memory leakage processing method and related device

CN122019352ACN 122019352 ACN122019352 ACN 122019352ACN-122019352-A

Abstract

The application discloses a memory leakage processing method and a related device, which relate to the technical field of data processing, and are used for carrying out semantic analysis on a memory leakage reference chain to obtain leakage type diagnosis information and converting the leakage type diagnosis information into a formatted diagnosis report, wherein the formatted diagnosis report comprises a first report for a large language model, the large language model is called based on a prompt word to output repair information which is used for repairing a target code, the prompt word is obtained based on the diagnosis report and the target code, and the memory leakage reference chain is converted into a diagnosis report which is favorable for understanding of the large language model, so that the repair information can be obtained based on the large language model, the degree of dependence of repair on manpower is reduced, and the memory leakage processing mode is improved.

Inventors

  • DUAN MENGYAO

Assignees

  • 北京搜狐互联网信息服务有限公司

Dates

Publication Date
20260512
Application Date
20260413

Claims (10)

  1. 1. A method for handling memory leaks, comprising: acquiring a reference chain of memory leakage caused by target codes; Carrying out semantic analysis on the reference chain of the memory leakage to obtain leakage type diagnosis information; converting the leak type diagnostic information into a formatted diagnostic report, the formatted diagnostic report comprising a first report for a large language model; And calling the large language model based on a prompt word to output repair information, wherein the repair information is used for repairing the target code, and the prompt word is acquired based on the diagnosis report and the target code.
  2. 2. The method for processing memory leak according to claim 1, further comprising, after the calling the large language model to output repair information based on the hint word: and accessing a repair branch into the target code under the condition that the confidence coefficient of the large language model is larger than a first threshold value, wherein the repair branch is acquired based on the repair information.
  3. 3. The method for processing memory leak according to claim 2, further comprising, after the calling the large language model to output repair information based on the hint word: and sending a notification, wherein the notification is used for reminding to audit the repair branch.
  4. 4. A method of handling memory leaks according to any one of claims 1 to 3, characterized in that the converting the leak type diagnostic information into a formatted diagnostic report comprises: and adding an explanation in the leakage type diagnosis information based on a predefined semantic description template library, wherein the explanation is used for extracting prompt words of the large language model.
  5. 5. A method of handling memory leaks according to any one of claims 1 to 3, wherein the formatted diagnostic report further comprises: a second report for manual reading.
  6. 6. A method for handling a memory leak as defined in any one of claims 1-3, The prompt includes leak type diagnostic information from each suspicious object of the diagnostic report and corresponding code segments, the location information of which in the object code is obtained based on the diagnostic report.
  7. 7. A memory leak processing apparatus is characterized by comprising a module for implementing the memory leak processing method according to any one of claims 1 to 6.
  8. 8. A computer program product comprising computer readable instructions which, when run on an electronic device, cause the electronic device to implement a method of handling memory leaks according to any one of claims 1 to 6.
  9. 9. An electronic device comprising at least one processor and a memory coupled to the processor, wherein: the memory is used for storing a computer program; The processor is configured to execute the computer program to enable the electronic device to implement the method for handling memory leaks according to any one of claims 1 to 6.
  10. 10. A computer storage medium carrying one or more computer programs which, when executed by an electronic device, enable the electronic device to implement a method of handling memory leaks according to any one of claims 1 to 6.

Description

Memory leakage processing method and related device Technical Field The present application relates to the field of data processing technologies, and in particular, to a method and an apparatus for processing memory leakage. Background The memory leakage refers to the phenomenon that in the process of running a program, memory objects which are released by a garbage collection (Garbage Collection, GC) mechanism cannot be recovered due to the fact that a sustained reference chain which is accidentally established is associated with a GC Root node (Root), and as the running time of the program is prolonged or the operation times are increased, the memory which is not occupied is accumulated continuously, and finally, the problems of excessively high memory occupation, blocking, memory overflow and the like of an application are caused. At present, some tools can detect memory leakage, but the repair of the memory leakage also needs to rely on manpower, so that the processing mode of the memory leakage has room for improvement. Disclosure of Invention In view of the above, the present application provides a method and related apparatus for processing memory leakage, so as to achieve the purpose of improving the processing mode of memory leakage. The specific scheme is as follows: the first aspect of the present application provides a method for processing memory leakage, including: acquiring a reference chain of memory leakage caused by target codes; Carrying out semantic analysis on the reference chain of the memory leakage to obtain leakage type diagnosis information; converting the leak type diagnostic information into a formatted diagnostic report, the formatted diagnostic report comprising a first report for a large language model; And calling the large language model based on a prompt word to output repair information, wherein the repair information is used for repairing the target code, and the prompt word is acquired based on the diagnosis report and the target code. In one possible implementation, after the invoking of the large language model to output repair information based on the hint word, the method further includes: and accessing a repair branch into the target code under the condition that the confidence coefficient of the large language model is larger than a first threshold value, wherein the repair branch is acquired based on the repair information. In one possible implementation, after the invoking of the large language model to output repair information based on the hint word, the method further includes: and sending a notification, wherein the notification is used for reminding to audit the repair branch. In one possible implementation, the formatted diagnostic report further comprises: a second report for manual reading. In one possible implementation, the hint words include leakage type diagnostic information from each suspicious object of the diagnostic report and corresponding code segments, the location information of which in the object code is obtained based on the diagnostic report. The second aspect of the present application provides a device for processing memory leakage, which includes a module for implementing the method of the first aspect or any implementation manner of the first aspect. A third aspect of the application provides a computer program product comprising computer readable instructions which, when run on an electronic device, cause the electronic device to implement the method of the first aspect or any implementation of the first aspect. A fourth aspect of the application provides an electronic device comprising at least one processor and a memory coupled to the processor, wherein: the memory is used for storing a computer program; The processor is configured to execute the computer program to enable the electronic device to implement the method of the first aspect or any implementation manner of the first aspect. A fifth aspect of the present application provides a computer storage medium carrying one or more computer programs which, when executed by an electronic device, enable the electronic device to implement the method of the first aspect or any implementation manner of the first aspect. By means of the technical scheme, the memory leakage processing method and the related device provided by the application are used for carrying out semantic analysis on the reference chain of the memory leakage to obtain leakage type diagnosis information and converting the leakage type diagnosis information into the formatted diagnosis report, wherein the formatted diagnosis report comprises the first report for the large language model, the large language model is called based on the prompt word to output the repair information, the repair information is used for repairing the target code, the prompt word is obtained based on the diagnosis report and the target code, and the reference chain of the memory leakage is converted into the diagnosis report which is favorabl