Nothing Special   »   [go: up one dir, main page]

CN108121602B - Method for determining garbage collection trigger point, electronic equipment and storage medium - Google Patents

Method for determining garbage collection trigger point, electronic equipment and storage medium Download PDF

Info

Publication number
CN108121602B
CN108121602B CN201711344352.9A CN201711344352A CN108121602B CN 108121602 B CN108121602 B CN 108121602B CN 201711344352 A CN201711344352 A CN 201711344352A CN 108121602 B CN108121602 B CN 108121602B
Authority
CN
China
Prior art keywords
memory
memory application
application information
garbage collection
information
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.)
Active
Application number
CN201711344352.9A
Other languages
Chinese (zh)
Other versions
CN108121602A (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.)
JRD Communication Shenzhen Ltd
Original Assignee
JRD Communication Shenzhen 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 JRD Communication Shenzhen Ltd filed Critical JRD Communication Shenzhen Ltd
Priority to CN201711344352.9A priority Critical patent/CN108121602B/en
Publication of CN108121602A publication Critical patent/CN108121602A/en
Application granted granted Critical
Publication of CN108121602B publication Critical patent/CN108121602B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System (AREA)

Abstract

The application discloses a method for determining a garbage collection trigger point, electronic equipment and a storage medium, wherein the method comprises the steps of obtaining the time for triggering garbage collection; screening out first type memory application information of a preset target application program from a plurality of memory application information of the application program for memory application; matching the first type of memory application information with the time for triggering garbage collection to obtain the memory application information for triggering garbage collection; the memory application information at least comprises the time of the memory application. The method comprises the steps of screening a plurality of memory application information to obtain first-class memory application information, matching the first-class memory application information with the time of triggering garbage collection to obtain the memory application triggering garbage collection, and finding out the position of triggering garbage collection.

Description

Method for determining garbage collection trigger point, electronic equipment and storage medium
Technical Field
The application relates to the technical field of computers, in particular to a method for determining a garbage collection trigger point, electronic equipment and a storage medium.
Background
The application using a large amount of memory may cause system garbage collection, but a specific code line corresponding to memory leakage cannot be directly analyzed, so that the analysis of the memory leakage can only search and separate invalid or unfocused memory allocations one by one through a tool carried by an integrated development environment, and finally, a memory application which may be problematic is screened out.
Disclosure of Invention
The problem that this application mainly solved provides a method, electronic equipment and storage medium of confirming rubbish collection trigger point, can find the concrete position that triggers rubbish collection, helps the analysis memory to leak the problem.
In order to solve the technical problem, the technical scheme adopted by the application is to provide a method for determining a garbage collection trigger point, wherein the method comprises the steps of obtaining the time for triggering garbage collection; screening out first type memory application information of a preset target application program from a plurality of memory application information of the application program for memory application; matching the first type of memory application information with the time for triggering garbage collection to obtain the memory application information for triggering garbage collection; the memory application information at least comprises the time of the memory application.
In order to solve the above technical problem, another technical solution adopted by the present application is to provide an electronic device, which includes a memory and a processor connected to each other, wherein the memory is used for storing a computer program, and the computer program is used for implementing the above method when being executed by the processor.
In order to solve the above technical problem, another technical solution adopted by the present application is to provide a storage medium for storing a computer program, wherein the computer program is used for implementing the above method when being executed by a processor.
Through the scheme, the beneficial effects of the application are that: firstly, screening a plurality of memory application information to obtain first type of memory application information, and then matching the first type of memory application information with the time for triggering garbage collection to obtain a memory application for triggering garbage collection; through two operations of screening and matching, the program code position triggering garbage collection is quickly found without searching a plurality of memory application information one by one.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts. Wherein:
FIG. 1 is a schematic flow chart diagram illustrating a first embodiment of a method for determining trigger points for garbage collection provided herein;
FIG. 2 is a schematic flow chart diagram illustrating a second embodiment of a method for determining trigger points for garbage collection provided herein;
FIG. 3 is a schematic flow chart diagram illustrating a third embodiment of a method for determining trigger points for garbage collection provided herein;
FIG. 4 is a schematic flow chart diagram illustrating a fourth embodiment of a method for determining trigger points for garbage collection provided herein;
FIG. 5 is a schematic flow chart diagram illustrating a fifth embodiment of a method for determining trigger points for garbage collection provided herein;
FIG. 6 is a schematic flow chart diagram illustrating a sixth embodiment of a method for determining trigger points for garbage collection provided herein;
FIG. 7 is a schematic structural diagram of an embodiment of an electronic device provided in the present application;
FIG. 8 is a schematic structural diagram of another embodiment of an electronic device provided herein;
fig. 9 is a schematic structural diagram of an embodiment of a storage medium provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
Referring to fig. 1, fig. 1 is a schematic flowchart of a first embodiment of a method for determining a trigger point of garbage collection provided in the present application, where the method includes:
step 11: the time to trigger garbage collection is obtained.
Garbage Collection (GC) means that objects that are no longer needed by the program are "garbage", which will be discarded and recycled; garbage collection can effectively prevent memory leakage and effectively use idle memory.
Memory leaks are wasted resources because programs fail to release memory that is no longer used due to incorrect design. Garbage collection automatically cleans up the memory occupied by objects that lose references, but memory leaks will occur if some objects are always referenced due to programming errors.
Java is an object-oriented language, and has the characteristics of simplicity, object-oriented property, distribution, robustness, safety, platform independence and portability, multithreading, dynamics and the like. Although JAVA has a perfect garbage collection mechanism, the garbage collection mechanism cannot avoid memory leaks.
When the memory amount applied by an application program exceeds a certain range, a garbage collection mechanism can be triggered, at the moment, the system sends a message to inform that garbage collection is triggered, the time is recorded, and several messages triggering garbage collection can be received at the same time. Wherein the time may be a time at which the system is operating.
Step 12: the method comprises the steps of screening out first-class memory application information of a preset target application program from a plurality of memory application information of memory application of the application program.
The memory application information at least comprises the time of the memory application; optionally, the memory application information may further include location information of a program code that triggers garbage collection.
Optionally, the preset target application program may be an application program selected by receiving a user instruction in advance, and the preset target application program is selected from a plurality of application programs, specifically, the application program may have a high memory occupancy rate, a high usage rate, or an application program running frequently in the background. For example: chat application programs such as QQ and WeChat, audio or video playing application programs and game application programs; these programs, if not used in the foreground, may be considered to be applications that can be garbage collected.
Optionally, the preset target application program may also be an application program whose memory application amount is greater than a set memory application amount threshold.
For example, assuming that the preset target application is an application that applies for a memory amount greater than a set memory application amount threshold, taking the set memory application amount threshold as 100MB as an example, when the memory requested by an application is greater than 100MB, the application will be screened, and the memory information of the application belongs to the first type of memory request information.
Step 13: and matching the first type of memory application information with the time for triggering garbage collection to obtain the memory application information for triggering garbage collection.
In step 12, all the memory information is first screened, and after the first type of memory application information is screened from all the memory information, the screened first type of memory application information is screened for the second time. Since the time for triggering garbage collection is obtained in step 11 and the memory application information includes the time for memory application, the time information in the first type of memory application information can be matched with the time for triggering garbage collection, so as to obtain the memory application information for triggering garbage collection. The memory application information comprises the position information of the program code triggering the garbage collection; therefore, after the memory application information is found, the position information of the program code triggering the garbage collection can be found.
It can be understood that the location information of the program code triggering garbage collection may be pre-stored in the memory application information; or after the memory information triggering the garbage collection is found, the position information of the program code triggering the garbage collection can be found.
For example, the first-type memory application information includes 3 pieces of information A, B and C, the time corresponding to the information a is 3s, the time corresponding to the information B is 3.1s, the time corresponding to the information C is 3.5s, and the time for triggering garbage collection is 3.1s, then the information B is information for triggering garbage collection, and the information B includes location information for triggering garbage collection.
It can be understood that when the first type of memory application information only contains information of one application program, the first type of memory information may not be matched with the time for triggering garbage collection. For example, the first type of memory application information only includes information a, and the information a is the memory application information triggering garbage collection, and no matching operation is required.
Different from the prior art, the method for determining a trigger point of garbage collection provided by this embodiment first obtains a time for triggering garbage collection; secondly, screening out first type memory application information of a preset target application program from a plurality of memory application information of the application program for memory application; finally, matching the first type of memory application information with the time for triggering garbage collection to obtain the memory application information for triggering garbage collection; the memory application information at least comprises the time of the memory application. Firstly, screening a plurality of memory application information to obtain first type of memory application information, and then matching the first type of memory application information with the time for triggering garbage collection to obtain a memory application for triggering garbage collection; through two operations of screening and matching, the program code position triggering garbage collection is quickly found without searching a plurality of memory application information one by one.
Referring to fig. 2, fig. 2 is a schematic flowchart of a second embodiment of the method for determining a trigger point of garbage collection provided in the present application, where the method includes:
step 21: the time to trigger garbage collection is obtained.
Step 22: the method comprises the steps of screening out first-class memory application information of a preset target application program from a plurality of memory application information of memory application of the application program.
Step 21 and step 22 may specifically refer to step 11 and step 12, which are not described herein again.
Step 23: and screening out second-class memory application information with the application frequency larger than a set frequency threshold from the first-class memory application information.
It can be understood that one application program can make memory applications many times, and the application program making memory applications frequently also has a high possibility of causing garbage collection triggering; therefore, in this step, the memory application information corresponding to the application program with a high application frequency needs to be screened out.
After the first type of memory application information is screened out from the memory information of all the application programs, the frequency of occurrence of each corresponding application program in the first memory application information is counted, and the information with the application frequency greater than a set frequency threshold value in the first memory application information is screened out to be the second type of memory application information.
For example, the first type of memory application information includes 3 pieces of information A, B and C, the time corresponding to the information a is 3s, the time corresponding to the information B is 3.1s, the time corresponding to the information C is 3s, the time bit for triggering garbage collection is 3s, the application program corresponding to the information a applies for 100 times of memory within 5 seconds, the application program corresponding to the information B applies for 84 times of memory within 5 seconds, the application program corresponding to the information C applies for 96 times of memory within 5 seconds, and the frequency threshold is set to 20 times/second, then the second type of memory application information is the information a.
Step 24: and matching the second type of memory application information with the time for triggering garbage collection to obtain the memory application information for triggering garbage collection.
Similar to the first embodiment, in this step, the time information in the second type of memory application information is matched with the time for triggering garbage collection, so as to obtain the memory application information for triggering garbage collection.
Different from the prior art, in the method for determining a trigger point for garbage collection provided in this embodiment, first type of memory application information is screened from memory application information of an application program, second type of memory application information is screened from the first type of memory application information by using a memory application frequency in the first type of memory application information, and then the second type of memory application information is matched with a time for triggering garbage collection. Through twice screening, the range of searching the memory application triggering garbage collection is narrowed, and the memory application position meeting the requirement is quickly found.
Referring to fig. 3, fig. 3 is a schematic flowchart of a third embodiment of the method for determining a trigger point of garbage collection provided in the present application, where the method includes:
step 31: the time to trigger garbage collection is obtained.
Step 32: the method comprises the steps of screening out first-class memory application information of a preset target application program from a plurality of memory application information of memory application of the application program.
Step 31 and step 32 may specifically refer to step 11 and step 12, which are not described herein again.
Step 33: and acquiring the memory application times of different application programs in the first type of memory application information.
An application program may apply for memory multiple times during running, and such an application program applying for memory multiple times in a set time may cause garbage collection due to accumulation of applied memory. For example, for a loop program, the number of loops required is 1000, and when the loop statement is executed each time, 200KB of memory is applied, and when the loop statement is executed up to 500 times, garbage collection is caused because the memory is insufficient. Therefore, in this step, the memory application times of different application programs in the first type of memory application information need to be counted.
Step 34: and screening out second type memory application information of which the application times are greater than a set time threshold value within a set time threshold value.
After the memory application times of different application programs in the first type of memory application information are obtained, the times of occurrence of each information in a set time threshold are calculated, the memory application information of which the application times in the set time threshold are larger than the set time threshold is screened, and the screened memory application information is the second type of memory application information.
Step 35: and matching the second type of memory application information with the time for triggering garbage collection to obtain the memory application information for triggering garbage collection.
Step 35 may refer to step 24, which is not described herein again.
Different from the prior art, in the method for determining a trigger point for garbage collection provided in this embodiment, first type of memory application information is screened from memory application information of an application program, then second type of memory application information with the application times larger than a set time threshold is screened by obtaining the memory application times of different application programs in the first type of memory application information, and information corresponding to an application program that frequently applies for a memory is found. Through twice screening, the memory application times are used as screening indexes, the range of the memory application triggering garbage collection is narrowed, and therefore the memory application position triggering garbage collection is found.
Referring to fig. 4, fig. 4 is a schematic flowchart of a fourth embodiment of the method for determining a trigger point of garbage collection provided in the present application, where the method includes:
step 41: the time to trigger garbage collection is obtained.
Step 42: screening out first-class memory application information with the memory application amount larger than a set memory application amount threshold value from a plurality of memory application information of memory application performed by an application program.
Step 41 and step 42 may refer to step 11 and step 12, which are not described herein again.
Step 43: and sequencing the plurality of memory application information in the first type of memory application information from large to small according to the application amount.
For example, the first-type memory application information includes 3 pieces of information A, B and C, the memory application amount of the information a is 50M, the memory application amount of the information B is 20M, and the memory application amount of the information C is 60M, and then each piece of information in the sorted first-type memory application information is information C, information a, and information B in sequence.
Step 44: and sequentially recording the memory application times of different application programs in the first type of memory application information according to the sequence of the application amount from large to small.
Step 45: screening out the memory application information of which the application times are greater than a set time threshold value in a set time period.
For example, the first type of memory application information includes 3 pieces of information A, B and C, and each information and memory application amount in the first type of memory application are shown in the following table:
information categories A B C
Memory application amount 40M 10M 20M
The number of times of applying the memory by the information A is 2, the number of times of applying the memory by the information B is 5, and the number of times of applying the memory by the information C is 3. After step 44, the arrangement of the different application information in the first type of memory application information is shown in the following table:
information categories Memory application amount Number of applications
A 40M 2
C 20M 3
B 10M 5
If the threshold of the set times is 2 times, after step 45 is executed, the second type of memory application information is information B and information C.
Step 46: and matching the second type of memory application information with the time for triggering garbage collection to obtain the memory application information for triggering garbage collection.
Step 46 may refer to step 24, which is not described herein again.
Different from the prior art, in the embodiment, the first type of memory application information is screened from the memory applications of the application program, the information in the first type of memory application information is sorted from large to small according to the size of the application amount, the number of times of applying the memory by the application program corresponding to the information in the first type of memory application information is counted, the memory application information with the application number exceeding a preset value is screened out to form second type of memory application information, and then the time in the second type of memory application information is matched with the time for triggering garbage collection, so that the memory application information triggering garbage collection is found.
Referring to fig. 5, fig. 5 is a schematic flowchart of a fifth embodiment of the method for determining a trigger point of garbage collection provided in the present application, where the method includes:
step 51: the time to trigger garbage collection is obtained.
Step 51 may refer to step 11, which is not described herein again.
Step 52: and acquiring a plurality of memory application information from the virtual machine of the android system.
In order to search for a memory application triggering garbage collection, a plurality of memory application information are acquired from a virtual machine of an android system.
Step 53: the method comprises the steps of screening out first-class memory application information of a preset target application program from a plurality of memory application information of memory application of the application program.
Step 54: and matching the first type of memory application information with the time for triggering garbage collection to obtain the memory application information for triggering garbage collection.
Step 53 and step 54 may specifically refer to step 12 and step 13, which are not described herein again.
Different from the prior art, in the embodiment, the plurality of memory application information are acquired from the virtual machine of the android system, the acquired memory application information is screened, the range of the memory application information which may trigger garbage collection is narrowed, and then the time of the memory application information with the narrowed range is matched with the time of triggering the garbage collection, so that the position of the code which triggers the garbage collection is found.
Referring to fig. 6, fig. 6 is a schematic flowchart of a sixth embodiment of the method for determining a trigger point of garbage collection provided in the present application, where the method includes:
step 61: the time to trigger garbage collection is obtained.
Step 61 may refer to step 11, which is not described herein again.
Step 62: the libdvm dynamic library is loaded.
libdvm is a linked library of the system that needs to be loaded when running a program to make the program run normally.
And step 63: and obtaining DvmGlobals global variables from the libdvm dynamic library.
The DvmGlobals global variable is a global structure, an instance of the structure is derived in the libdvm, and the variable can be obtained by loading a libdvm dynamic library.
Step 64: and acquiring allocRecords variables from the DvmGlobals global variables to obtain a plurality of memory application information for the application program to apply for the memory.
The allocRecords variable records detailed information of all memory allocation, and all memory application information can be searched by traversing the variable, so that the memory information triggering garbage collection is analyzed.
Step 65: the method comprises the steps of screening out first-class memory application information of a preset target application program from a plurality of memory application information of memory application of the application program.
And step 66: and matching the first type of memory application information with the time for triggering garbage collection to obtain the memory application information for triggering garbage collection.
Step 65 and step 66 may specifically refer to step 12 and step 13, which are not described herein again.
Different from the prior art, in the embodiment, dvmgglobals global variables are obtained by loading a libdvm dynamic library of a system, allochrecords variables are obtained from the dvmgglobals global variables, and a plurality of memory application information for the application program to perform memory application is obtained; after the memory application information is obtained, the memory application information is screened, and then the time in the screened information is matched with the time for triggering garbage collection, so that the position of the program code for triggering garbage collection is found, invalid or unconcerned memory application information does not need to be searched and separated one by one, and the method is high in efficiency and convenient.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an embodiment of an electronic device provided in the present application. The electronic device 70 comprises a memory 71 and a processor 72 connected to each other, the memory 71 being adapted to store a computer program which, when executed by the processor 72, is adapted to carry out the method of the above-mentioned embodiments. It is understood that the electronic device 70 in this embodiment is similar to the method provided in the above embodiments, and the principle and steps are the same, and are not described here again.
Referring to fig. 8, fig. 8 is a schematic structural diagram of another embodiment of the electronic device provided in the present application. The electronic device includes:
and an obtaining module 81, configured to obtain a time for triggering garbage collection.
When a certain application program causes garbage collection, the acquisition module 81 records the time for triggering the garbage collection; wherein the time may be a time that the system is running.
The screening module 82 is configured to screen out first-type memory application information of a preset target application program from a plurality of memory application information for memory application of the application program.
The memory application information at least comprises the time of the memory application; optionally, the memory application information may further include location information of a program code that triggers garbage collection.
The preset target application program may be an application program which is selected by receiving a user instruction in advance or an application program of which the applied memory amount is greater than a set memory application amount threshold.
And the matching module 83 is configured to match the first type of memory application information with the time for triggering garbage collection, so as to obtain the memory application information for triggering garbage collection.
The screening module 82 performs a first screening on all the memory information, and after the first type of memory application information is screened from all the memory information, performs a second screening on the screened first type of memory application information, that is, performs a second screening by using the matching module.
Since the obtaining module 81 obtains the time for triggering garbage collection and the memory application information includes the time for memory application, the time information in the first type of memory application information can be matched with the time for triggering garbage collection, so as to obtain the memory application information for triggering garbage collection. Since the memory application information includes the location information of the program code triggering garbage collection, the location information of the program code triggering garbage collection can be found after the memory application information is found.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an embodiment of a storage medium provided in the present application. The storage medium 90 is used to store a computer program 91, the computer program 91 being executed by a processor to implement the method provided in the above-described embodiments. It is understood that the computer program 91 stored in the storage medium 90 of the present embodiment is used to execute a method similar to the method provided in the foregoing embodiments, and the principle and steps thereof are the same, and are not described herein again.
The storage medium 90 includes: various media capable of storing program codes, such as a server, a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of modules or units is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The above embodiments are merely examples, and not intended to limit the scope of the present application, and all modifications, equivalents, and flow charts using the contents of the specification and drawings of the present application, or those directly or indirectly applied to other related arts, are included in the scope of the present application.

Claims (9)

1. A method of determining a trigger point for garbage collection, comprising:
acquiring the time for triggering garbage collection;
screening out first type memory application information of a preset target application program from a plurality of memory application information of the application program for memory application;
matching the first type of memory application information with the time for triggering garbage collection to obtain memory application information for triggering garbage collection;
finding the program code triggering garbage collection according to the position information of the program code triggering garbage collection contained in the memory application information triggering garbage collection;
the memory application information at least comprises the time of the memory application and the position information of the program code triggering the garbage collection.
2. The method of claim 1,
after the step of screening out the first type of memory application information of the preset target application program from the plurality of memory application information of the memory application of the application program, the method further includes:
screening out second type memory application information with the application frequency larger than a set frequency threshold from the first type memory application information;
the step of matching the first type of memory application information with the time for triggering garbage collection to obtain the memory application information for triggering garbage collection specifically comprises:
and matching the second type of memory application information with the time for triggering garbage collection to obtain the memory application information for triggering garbage collection.
3. The method of claim 2,
the step of screening out the second type of memory application information with the application frequency greater than the set frequency threshold from the first type of memory application information comprises the following steps:
acquiring the memory application times of different application programs in the first type of memory application information;
and screening out second type memory application information of which the application times are greater than a set time threshold value within a set time threshold value.
4. The method of claim 3,
the step of obtaining the memory application times of different application programs in the first type of memory application information includes:
sequencing a plurality of memory application information in the first type of memory application information from large to small according to the application amount;
and sequentially recording the memory application times of different application programs in the first type of memory application information according to the sequence of the application amount from large to small.
5. The method of claim 1,
the target application program is an application program with the memory application amount larger than a set memory application amount threshold value.
6. The method of claim 1,
before the step of screening out the first type of memory application information of the preset target application program from the plurality of memory application information of the memory application of the application program, the method further includes:
and acquiring a plurality of memory application information from the virtual machine of the android system.
7. The method of claim 6,
the step of obtaining a plurality of memory application information from the virtual machine of the android system includes:
loading a libdvm dynamic library;
obtaining DvmGlobals global variable from the libdvm dynamic library;
and acquiring allocRecords variables from the DvmGlobals global variables to obtain a plurality of memory application information of the memory application of the application program.
8. An electronic device, comprising a memory and a processor connected to each other, the memory being adapted to store a computer program which, when executed by the processor, is adapted to carry out the method of any of claims 1-7.
9. A storage medium for storing a computer program which, when executed by a processor, is adapted to carry out the method of any one of claims 1 to 7.
CN201711344352.9A 2017-12-14 2017-12-14 Method for determining garbage collection trigger point, electronic equipment and storage medium Active CN108121602B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711344352.9A CN108121602B (en) 2017-12-14 2017-12-14 Method for determining garbage collection trigger point, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711344352.9A CN108121602B (en) 2017-12-14 2017-12-14 Method for determining garbage collection trigger point, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108121602A CN108121602A (en) 2018-06-05
CN108121602B true CN108121602B (en) 2022-05-06

Family

ID=62230043

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711344352.9A Active CN108121602B (en) 2017-12-14 2017-12-14 Method for determining garbage collection trigger point, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108121602B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110083450A (en) * 2019-04-09 2019-08-02 Oppo广东移动通信有限公司 Method for recovering internal storage, device, electronic equipment and storage medium
CN116361200B (en) * 2022-09-30 2023-11-14 荣耀终端有限公司 Memory garbage recycling method and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101814049A (en) * 2010-03-23 2010-08-25 北京大学 Memory leak detection method
CN105260313A (en) * 2015-10-27 2016-01-20 上海斐讯数据通信技术有限公司 Memory leak checking system and method
CN106610892A (en) * 2015-10-23 2017-05-03 腾讯科技(深圳)有限公司 Memory leak detecting method and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8229979B2 (en) * 2006-04-28 2012-07-24 Sap Ag Method and system for inspecting memory leaks
EP1990724A1 (en) * 2007-05-09 2008-11-12 Telefonaktiebolaget LM Ericsson (publ) Method for locating resource leaks during software development
US9418005B2 (en) * 2008-07-15 2016-08-16 International Business Machines Corporation Managing garbage collection in a data processing system
CN102023896A (en) * 2010-12-20 2011-04-20 复旦大学 Dispatcher of Java virtual machine-based concurrent garbage collector
CN106933733B (en) * 2015-12-30 2020-03-10 华为技术有限公司 Method and device for determining memory leak position
US10289347B2 (en) * 2016-04-26 2019-05-14 Servicenow, Inc. Detection and remediation of memory leaks

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101814049A (en) * 2010-03-23 2010-08-25 北京大学 Memory leak detection method
CN106610892A (en) * 2015-10-23 2017-05-03 腾讯科技(深圳)有限公司 Memory leak detecting method and device
CN105260313A (en) * 2015-10-27 2016-01-20 上海斐讯数据通信技术有限公司 Memory leak checking system and method

Also Published As

Publication number Publication date
CN108121602A (en) 2018-06-05

Similar Documents

Publication Publication Date Title
KR101357397B1 (en) Method for tracking memory usages of a data processing system
CN112346829B (en) Method and equipment for task scheduling
CN108664390B (en) Memory leak detection method and equipment
CN108845934B (en) Memory leakage source positioning method and device, storage medium and electronic device
CN111064712B (en) Game resource packaging method and system
US10909029B2 (en) Managing memory in a computer system
KR20120026046A (en) Application efficiency engine
CN109656779A (en) Internal memory monitoring method, device, terminal and storage medium
CN110908865A (en) Memory leakage monitoring method and device and electronic equipment
CN103914355A (en) Method and device for positioning memory repeated release
CN108121602B (en) Method for determining garbage collection trigger point, electronic equipment and storage medium
CN104572448A (en) Method and device for realizing use condition of thread stack
CN100392606C (en) Method for leaking memory of positioning virtual operation system
CN109033365B (en) Data processing method and related equipment
US20180225147A1 (en) Resource allocation method and apparatus
CN105243003A (en) Memory allocation monitoring method and apparatus
CN114428705A (en) Network data monitoring method, device, equipment and storage medium
US9870400B2 (en) Managed runtime cache analysis
CN112631941B (en) Method and system for locating linux kernel slub memory leakage
CN112612537A (en) Configuration data caching method, device, equipment and storage medium
CN109165305B (en) Characteristic value storage and retrieval method and device
CN107122247B (en) Method and device for detecting static occupied picture
US9460002B1 (en) Memory allocation
CN113806176B (en) Data object identification method and device based on configuration management
CN105243011A (en) Memory leak positioning method and apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant