CN109828859A - Mobile terminal memory analysis method, apparatus, storage medium and electronic equipment - Google Patents

Mobile terminal memory analysis method, apparatus, storage medium and electronic equipment Download PDF

Info

Publication number
CN109828859A
CN109828859A CN201910063223.5A CN201910063223A CN109828859A CN 109828859 A CN109828859 A CN 109828859A CN 201910063223 A CN201910063223 A CN 201910063223A CN 109828859 A CN109828859 A CN 109828859A
Authority
CN
China
Prior art keywords
internal storage
memory
storage data
analyzed
analysis
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.)
Granted
Application number
CN201910063223.5A
Other languages
Chinese (zh)
Other versions
CN109828859B (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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201910063223.5A priority Critical patent/CN109828859B/en
Publication of CN109828859A publication Critical patent/CN109828859A/en
Application granted granted Critical
Publication of CN109828859B publication Critical patent/CN109828859B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the present invention is to belong to field of computer technology about a kind of mobile terminal memory analysis method and device, this method comprises: obtaining the running internal storage data of program, and judges whether the data volume of the internal storage data reaches preset threshold;If the data volume of the internal storage data reaches the preset threshold, the internal storage data is filtered, and memory file to be analyzed is generated according to filtered internal storage data;The memory file to be analyzed is analyzed, and memory analysis report is generated according to the analysis result of the memory file to be analyzed;The memory analysis is sent to report to predetermined server.This method solve the higher problems of fussy degree for needing memory analysis caused by reappearing memory problem in the prior art, reduce the fussy degree of memory analysis while also improving the speed of memory analysis.

Description

Mobile terminal memory analysis method, apparatus, storage medium and electronic equipment
Technical field
The present embodiments relate to field of computer technology, in particular to a kind of mobile terminal memory analysis method, Mobile terminal memory analysis device, computer readable storage medium and electronic equipment.
Background technique
During live streaming, live streaming client always encounters many memory overflow problems in outer net;It overflows to solve memory It goes wrong, can analyze and solve by way of checking user journal and re-starting the operation of user.But mostly In number situation, the operation by re-starting user can not reappear memory overflow problem;Also, it is only obtained since memory overflows The mistake of one last application internal memory operation, but often this operation is only applied in the memory nearly overflowed just, therefore Developer can not accurately know that occupying the object of most of memory is what on earth.Accordingly, it is desirable to provide one can including When depositing spilling generation, the method for carrying out memory problem is accurately analyzed.
May include the following two kinds in existing memory analysis method: one is, the HPROF Viewer of AS, Can be with the utilization rate of real time inspection memory in the environment of Debug, what single object is using peak using memory, corresponding What storehouse is;One is, MAT, it can analyze out and occupy maximum class in current Dump current memory and what object is;Into One step, the core logic of above two method is all the Hprof file analyzing memory dump and coming out.
But above two method has following defects that the HPROF VIEWER or MAT of either AS, is all needle To there is exploitation environment or to there is developer to use in case, that is to say, that analyze memory information, developer The operation that user at that time must be reappeared could obtain memory information at that time, but environment where user is very multiple on many lines Miscellaneous, many identical operations not will lead to memory problem;That is same operation, developer are difficult to reappear memory Problem, therefore increase the fussy degree of memory analysis.
Accordingly, it is desirable to provide a kind of new mobile terminal memory analysis method and device.
It should be noted that the information in the invention of above-mentioned background technology part is only used for reinforcing the reason to background of the invention Solution, therefore may include the information not constituted to the prior art known to persons of ordinary skill in the art.
Summary of the invention
The purpose of the present invention is to provide a kind of mobile terminal memory analysis method, mobile terminal memory analysis device, meters Calculation machine readable storage medium storing program for executing and electronic equipment, and then the limitation and defect due to the relevant technologies is overcome at least to a certain extent Caused by memory analysis the higher problem of fussy degree.
According to one aspect of the disclosure, a kind of mobile terminal memory analysis method is provided, comprising:
The running internal storage data of program is obtained, and judges whether the data volume of the internal storage data reaches preset threshold;
If the data volume of the internal storage data reaches the preset threshold, the internal storage data is filtered, and Memory file to be analyzed is generated according to filtered internal storage data;
The memory file to be analyzed is analyzed, and according in the generation of the analysis result of the memory file to be analyzed Deposit analysis report;
The memory analysis is sent to report to predetermined server.
In a kind of exemplary embodiment of the disclosure, obtaining the running memory information of program includes:
It is spaced the first preset time, obtains the running internal storage data of program using Runtime function.
In a kind of exemplary embodiment of the disclosure, judge whether the data volume of the internal storage data reaches preset threshold Include:
Calculate the data volume of the internal storage data;
Judge whether the data volume of the internal storage data reaches preset threshold;Wherein, the preset threshold is according to equipment end End is that total amount of ram of described program operation distribution is determined;
If the data volume of the internal storage data reaches the preset threshold, the data of the internal storage data are judged again Whether amount reaches preset threshold.
In a kind of exemplary embodiment of the disclosure, the internal storage data is filtered, and according to filtered interior Deposit data generates memory file to be analyzed
The internal storage data is filtered by Dump operation;
According to the size of data object in filtered internal storage data, filtered internal storage data is ranked up and is arranged Internal storage data after sequence;
Memory file to be analyzed is generated according to the internal storage data after sequence;
Wherein, the memory file to be analyzed is Hprof file.
In a kind of exemplary embodiment of the disclosure, carrying out analysis to the memory file to be analyzed includes:
Search the module and bitmap of the interactive component, interactive component revealed in the memory file to be analyzed;
The leakage reason of module and bitmap to the interactive component, interactive component is analyzed.
In a kind of exemplary embodiment of the disclosure, memory is generated according to the analysis result of the memory file to be analyzed Analysis report includes:
Memory analysis report is generated according to the leakage reason of the interactive component, the module of interactive component and bitmap;
Wherein, the memory analysis report includes that the interactive component, the module of interactive component and bitmap are occupied One of memory size, image preview and reference stack are a variety of.
In a kind of exemplary embodiment of the disclosure, whether reach default threshold in the data volume for judging the internal storage data After value, the mobile terminal memory analysis method further include:
If the data volume of the internal storage data is not up to the preset threshold, it is spaced the second preset time, is obtained again The running internal storage data of program fetch, until the data volume summation of each internal storage data obtained reaches the preset threshold and is Only.
According to one aspect of the disclosure, a kind of mobile terminal memory analysis device is provided, comprising:
Judgment module, for obtaining the running internal storage data of program, and judge the internal storage data data volume whether Reach preset threshold;
Filtering module, if the data volume for the internal storage data reaches the preset threshold, to the memory number Memory file to be analyzed is generated according to being filtered, and according to filtered internal storage data;
Analysis module, for analyzing the memory file to be analyzed, and according to the memory file to be analyzed It analyzes result and generates memory analysis report;
Analysis report sending module is reported for sending the memory analysis to predetermined server.
According to one aspect of the disclosure, a kind of computer readable storage medium is provided, computer program is stored thereon with, The computer program realizes mobile terminal memory analysis method described in above-mentioned any one when being executed by processor.
According to one aspect of the disclosure, a kind of electronic equipment is provided, comprising:
Processor;And
Memory, for storing the executable instruction of the processor;
Wherein, the processor is configured to execute shifting described in above-mentioned any one via the executable instruction is executed Dynamic terminal memory analysis method.
A kind of mobile terminal memory analysis method and device of the embodiment of the present disclosure, by judging that the data volume of internal storage data is It is no to reach preset threshold;And when the data volume for judging internal storage data reaches preset threshold, internal storage data is filtered, and root Memory file to be analyzed is generated according to filtered internal storage data;Finally memory file to be analyzed is analyzed, and according to wait divide The analysis result for analysing memory file generates memory analysis report;On the one hand, by reaching pre- in the data volume for judging internal storage data If when threshold value, being filtered to internal storage data, and memory file to be analyzed is generated according to filtered internal storage data;It treats again point Analysis report is analyzed and generated to analysis memory file, is solved and is needed memory caused by reappearing memory problem point in the prior art The higher problem of the fussy degree of analysis reduces the fussy degree of memory analysis while also improving the speed of memory analysis;It is another Aspect generates memory file to be analyzed by being filtered to internal storage data, and according to filtered internal storage data, reduce to The amount of redundant data in memory file is analyzed, and then improves analysis speed while also improving the accuracy rate of analysis result;Again On the one hand, by judging whether the data volume of internal storage data reaches preset threshold, and in the data volume for judging internal storage data When reaching preset threshold, internal storage data is filtered, is avoided due to the very few caused analysis result accuracy rate of internal storage data Lower problem further improves the accuracy rate of analysis result.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not It can the limitation present invention.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows and meets implementation of the invention Example, and be used to explain the principle of the present invention together with specification.It should be evident that the accompanying drawings in the following description is only the present invention Some embodiments for those of ordinary skill in the art without creative efforts, can also basis These attached drawings obtain other attached drawings.
Fig. 1 schematically shows a kind of flow chart of mobile terminal memory analysis method.
Fig. 2 schematically shows the method flow whether a kind of data volume for judging the internal storage data reaches preset threshold Figure.
Fig. 3 schematically show it is a kind of the internal storage data is filtered, and according to filtered internal storage data generate to Analyze the method flow diagram of memory file.
Fig. 4 schematically shows a kind of method flow diagram analyzed memory file to be analyzed.
Fig. 5 schematically shows a kind of device block diagram of mobile terminal memory analysis.
Fig. 6 schematically shows a kind of electronic equipment exemplary diagram for realizing above-mentioned mobile terminal memory analysis method.
Fig. 7 schematically shows a kind of computer-readable storage medium for realizing above-mentioned mobile terminal memory analysis method Matter.
Specific embodiment
Example embodiment is described more fully with reference to the drawings.However, example embodiment can be with a variety of shapes Formula is implemented, and is not understood as limited to example set forth herein;On the contrary, thesing embodiments are provided so that the present invention will more Fully and completely, and by the design of example embodiment comprehensively it is communicated to those skilled in the art.Described feature, knot Structure or characteristic can be incorporated in any suitable manner in one or more embodiments.In the following description, it provides perhaps More details fully understand embodiments of the present invention to provide.It will be appreciated, however, by one skilled in the art that can It is omitted with practicing technical solution of the present invention one or more in the specific detail, or others side can be used Method, constituent element, device, step etc..In other cases, be not shown in detail or describe known solution to avoid a presumptuous guest usurps the role of the host and So that each aspect of the present invention thickens.
In addition, attached drawing is only schematic illustrations of the invention, it is not necessarily drawn to scale.Identical attached drawing mark in figure Note indicates same or similar part, thus will omit repetition thereof.Some block diagrams shown in the drawings are function Energy entity, not necessarily must be corresponding with physically or logically independent entity.These function can be realized using software form Energy entity, or these functional entitys are realized in one or more hardware modules or integrated circuit, or at heterogeneous networks and/or place These functional entitys are realized in reason device device and/or microcontroller device.
A kind of mobile terminal memory analysis method is provided firstly in this example embodiment, this method can be run on can Mobile terminal, the movable termination for example can be mobile phone, tablet computer and PC etc., can also run and other equipment end End, such as can be all-in-one machine etc.;Certainly, those skilled in the art can also run the present invention in other platforms according to demand Method, particular determination is not done to this in the present exemplary embodiment.Refering to what is shown in Fig. 1, the mobile terminal memory analysis method can To include the following steps:
Step S110. obtains the running internal storage data of program, and judges whether the data volume of the internal storage data reaches Preset threshold.
If the data volume of the step S120. internal storage data reaches the preset threshold, to the internal storage data into Row filtering, and memory file to be analyzed is generated according to filtered internal storage data.
Step S130. analyzes the memory file to be analyzed, and according to the analysis of the memory file to be analyzed As a result memory analysis report is generated.
Step S140. sends the memory analysis and reports to predetermined server.
In above-mentioned mobile terminal memory analysis method, on the one hand, by reaching default in the data volume for judging internal storage data When threshold value, internal storage data is filtered, and memory file to be analyzed is generated according to filtered internal storage data;Again to be analyzed Analysis report is analyzed and generated to memory file, is solved and is needed memory analysis caused by reappearing memory problem in the prior art The higher problem of fussy degree, reduce the fussy degree of memory analysis while also improving the speed of memory analysis;Another party Face generates memory file to be analyzed by being filtered to internal storage data, and according to filtered internal storage data, reduces wait divide The amount of redundant data in memory file is analysed, and then improves analysis speed while also improving the accuracy rate of analysis result;Further Aspect is reached by judging whether the data volume of internal storage data reaches preset threshold, and in the data volume for judging internal storage data When to preset threshold, internal storage data is filtered, avoid due to internal storage data it is very few caused by analysis result accuracy rate compared with Low problem further improves the accuracy rate of analysis result.
In the following, by conjunction with attached drawing to each step in mobile terminal memory analysis method above-mentioned in this example embodiment into The detailed explanation of row and explanation.
In step s 110, obtain the running internal storage data of program, and judge the internal storage data data volume whether Reach preset threshold.
In this example embodiment, firstly, obtaining the running internal storage data of program;Wherein, it obtains in program operation Internal storage data may include: interval the first preset time, utilize Runtime function, obtain the running internal storage data of program. Specifically:
Firstly, configuration Runtime function;Wherein, Runtime function, that is, function when operation, are one by a series of Function and data structure composition, the dynamic shared library with common interface;It therefore, can be in Runtime function (first preset time of interval) of getRuntime () interface timing obtains the running internal storage data of program.Further, when After getting the internal storage data, then judge whether the data volume of the internal storage data reaches preset threshold.
In the step s 120, if the data volume of the internal storage data reaches the preset threshold, to the memory number Memory file to be analyzed is generated according to being filtered, and according to filtered internal storage data.
It, can be by repeatedly when the data volume for judging internal storage data reaches preset threshold in this example embodiment Public static void dumpHprofData () function is called, internal storage data is filtered, will not needed also basic The byte data that can not be analyzed is deleted, and then generates memory file to be analyzed further according to filtered internal storage data.By using This method allows the data volume of memory file to be analyzed to be less than the data volume of internal storage data from far away, and then can be promoted The speed of analysis.
In step s 130, the memory file to be analyzed is analyzed, and according to the memory file to be analyzed It analyzes result and generates memory analysis report.
In this example embodiment, it is possible, firstly, to be divided by Hprof analysis tool to analysis memory file Analysis;Wherein, Hprof analysis tool involved in the disclosure can be the Hprof analysis tool of customization.Due to existing opening Hprof analysis tool is all based on the manufacture of PC system, and is unsuitable as the use of app third party's SDK kit, first is that using Memory is excessively high, integrated directly to app second is that the third party's jar packet used is excessive, will cause app volume and increases larger, is easy pair Terminal causes to bear.The Hprof analysis tool being related in the disclosure has abandoned the biggish data packet of original memory, has been changed to The lesser jar packet of memory suitable for terminal device;Meanwhile will also read file Hprof and be changed to streaming reading, reduction was analyzed Journey uses committed memory;Secondly, the analysis result further according to the memory file to be analyzed generates memory analysis report.Wherein, Generating memory analysis report according to the analysis result of memory file to be analyzed may include: according to the interactive component, interaction group The module of part and the leakage reason of bitmap generate memory analysis report.Specifically:
It can be by the module of the interactive component (Activity) for including in mobile terminal memory analysis result, interactive component (Fragment) and the leakage reason of bitmap (Bitmap) it, inserts in Html and generates detailed memory analysis report;Wherein, should It may include that interactive component, the module of interactive component and the occupied memory size of bitmap, image are pre- in memory analysis report Look at and quote stack etc..
In step S140, sends the memory analysis and report to predetermined server.
In this example embodiment, after obtaining the report of above-mentioned memory analysis, memory analysis report is sent to pre- If server, allow the predetermined server according to the analysis report to interactive component, the interactive component in mobile terminal Module and the leakage reason of bitmap carry out loophole reparation, so that subsequent the above problem no longer occur.Further, this is default Server can be server, Cloud Server or the server cluster etc. of device end.
Fig. 2 schematically shows the method flow whether a kind of data volume for judging the internal storage data reaches preset threshold Figure.Refering to what is shown in Fig. 2, judging whether the data volume of the internal storage data reaches preset threshold may include step S210- step S230.Wherein:
In step S210, the data volume of the internal storage data is calculated.
In step S220, judge whether the data volume of the internal storage data reaches preset threshold;Wherein, the default threshold Value is determined according to total amount of ram that device end is described program operation distribution.
In step S230, if the data volume of the internal storage data reaches the preset threshold, again described in judgement Whether the data volume of internal storage data reaches preset threshold.
In the following, will step S210- step S230 be explained and be illustrated.Firstly, calculating the total data of internal storage data Amount;Then, judge whether the data volume of the internal storage data reaches preset threshold;Wherein, which can be according to equipment end End is that the memory amount of described program operation distribution is determined;For example, when device end is described program operation distribution When memory amount is 512M, then the preset threshold can be arranged are as follows: 512M*0.8=409M;It may be set to be other numbers Value, there is no special restriction on this for this example.It should be added that, which will affect if excessive herein , there is the case where Caton in the operation of program;If preset threshold is too small, the number of final memory file to be analyzed can be made It is very few according to measuring, cause to analyze the lower problem of result accuracy rate.Finally, reaching preset threshold in the data volume for judging internal storage data Afterwards, it can judge whether the data volume of internal storage data reaches preset threshold again;Only memory number is being judged twice or repeatedly According to data volume reach preset threshold after, internal storage data could be filtered.By using this method, avoid due to interior Deposit data is unstable, caused data volume fluctuation and then the problem to cause data volume very few.
Further, in order to which the data volume of internal storage data can be made to reach preset threshold, the internal storage data analysis side If method can also include: that the data volume of the internal storage data is not up to the preset threshold, it is spaced the second preset time, then The running internal storage data of secondary acquisition program, until the data volume summation of the internal storage data of each acquisition reaches the preset threshold Until.For example:
For example, if the data volume of internal storage data is not up to preset threshold (such as the data volume of internal storage data is 300M), The second preset time, which can be then spaced, (such as can be 3min or 5min etc., can also be spaced other times section, this example There is no special restriction on this), the running internal storage data of program is obtained again, the internal storage data for then obtaining front and back twice Data volume merges operation, until total amount of data reaches preset threshold.Herein it should be added that, when memory number According to data volume be more than preset threshold when, can according to the size or internal storage data of internal storage data generate time sequencing, will The internal storage data is divided into two parts and is handled;Further, if the data volume of internal storage data is more or less than default threshold When the amount of value is no more than a certain particular value, preset threshold can be reached according to the data volume and be calculated;For example, when less than default When the data volume of threshold value is less than 10% or is less than 5% more than the data volume of preset threshold, it can be reached according to the data volume It is calculated to preset threshold.In addition it is also possible to which other codomain sections are arranged, there is no special restriction on this for this example.
Fig. 3 schematically show it is a kind of the internal storage data is filtered, and according to filtered internal storage data generate to Analyze the method flow diagram of memory file.Refering to what is shown in Fig. 3, being filtered to the internal storage data, and according to filtered interior It may include step S310- step S330 that deposit data, which generates memory file to be analyzed,.Wherein:
In step s310, the internal storage data is filtered by Dump operation.
In this example embodiment, firstly, customization Dump operation;Wherein, it is obtained due to defaulting the Dump method used File be just to have bigger file if memory threshold values is relatively high with the same size of memory, be unfavorable for storing in this way And analysis;Therefore, the dump of bottom Android by nativehook, can be called to realize the Dump operation of customization;Then, it utilizes Dump operation is filtered internal storage data, and removal occupies the useless byte data file of percent 80% sizes so as to point The storage analysis of analysis memory file becomes easy and quickly very much.
In step s 320, according to the size of data object in filtered internal storage data, to filtered internal storage data It is ranked up the internal storage data after being sorted.
In this example embodiment, according to the size of data object each in filtered internal storage data, after the filtering Internal storage data be ranked up, and the internal storage data after successively being sorted;Wherein it is possible to according to the suitable of positive sequence (from big to small) Sequence is ranked up, and can also be ranked up in the way of inverted order (from small to large), there is no special restriction on this for this example.
In step S330, memory file to be analyzed is generated according to the internal storage data after sequence;Wherein, described to be analyzed interior Depositing file is Hprof file.
In this example embodiment, the memory to be analyzed of Hprof format can be generated according to the internal storage data after sequence File.
Fig. 4 schematically shows a kind of method flow diagram analyzed the memory file to be analyzed.With reference to Fig. 4 institute Show, carrying out analysis to the memory file to be analyzed may include step S410- step S420.Wherein:
In step S410, search the module of the interactive component, interactive component revealed in the memory file to be analyzed with And bitmap;
In the step s 420, the module to the interactive component, interactive component and the leakage reason of bitmap are analyzed.
In the following, will step S410 and step S420 be explained and be illustrated.Firstly, from the memory text to be analyzed The interactive component of leakage, the module of interactive component and bitmap are searched in part;Wherein, due to the memory in memory file to be analyzed It is ranked up, therefore can successively searched in sequence according to size of data when data;Secondly, when the interaction for finding leakage It, can letting out to the interactive component of leakage, the module of interactive component and bitmap after component, the module of interactive component and bitmap Dew reason is analyzed, and generates memory analysis report according to the leakage reason that analysis obtains;The memory analysis is reported again and is sent out It send to server, so that server is reported according to the memory analysis to the interactive component of leakage, the module of interactive component and position Figure is handled.In this way, occurring to automatically begin in analysis when EMS memory occupation is excessively high in device end Information is deposited, and is sent to server in a manner of a summary report;When server receives the summary report, exploit person Member can directly take at that time that user is at that time in memory there is no need to reappear the operation of user at that time, memory distributed intelligence, and Call stack is provided, developer is facilitated to rapidly find out problem code.
The disclosure additionally provides a kind of mobile terminal memory analysis device.Refering to what is shown in Fig. 5, the mobile terminal memory analysis Device may include judgment module 510, filtering module 520, analysis module 530 and analysis report sending module 540.Wherein:
Judgment module 510 can be used for obtaining the running internal storage data of program, and judge the data of the internal storage data Whether amount reaches preset threshold.
If the data volume that filtering module 520 can be used for the internal storage data reaches the preset threshold, to described Internal storage data is filtered, and generates memory file to be analyzed according to filtered internal storage data.
Analysis module 530 can be used for analyzing the memory file to be analyzed, and according to the memory to be analyzed The analysis result of file generates memory analysis report.
Analysis report sending module 540, which can be used for sending the memory analysis, to be reported to predetermined server.
In a kind of illustrative embodiments of the disclosure, obtaining the running memory information of program includes:
It is spaced the first preset time, obtains the running internal storage data of program using Runtime function.
In a kind of illustrative embodiments of the disclosure, judge whether the data volume of the internal storage data reaches default threshold Value includes:
Calculate the data volume of the internal storage data;
Judge whether the data volume of the internal storage data reaches preset threshold;Wherein, the preset threshold is according to equipment end End is that total amount of ram of described program operation distribution is determined;
If the data volume of the internal storage data reaches the preset threshold, the data of the internal storage data are judged again Whether amount reaches preset threshold.
In a kind of illustrative embodiments of the disclosure, the internal storage data is filtered, and according to filtered Internal storage data generates memory file to be analyzed
The internal storage data is filtered by Dump operation;
According to the size of data object in filtered internal storage data, filtered internal storage data is ranked up and is arranged Internal storage data after sequence;
Memory file to be analyzed is generated according to the internal storage data after sequence;Wherein, the memory file to be analyzed is Hprof File.
In a kind of illustrative embodiments of the disclosure, carrying out analysis to the memory file to be analyzed includes:
Search the module and bitmap of the interactive component, interactive component revealed in the memory file to be analyzed;
The leakage reason of module and bitmap to the interactive component, interactive component is analyzed.
In a kind of illustrative embodiments of the disclosure, according in the generation of the analysis result of the memory file to be analyzed Depositing analysis report includes:
Memory analysis report is generated according to the leakage reason of the interactive component, the module of interactive component and bitmap;
Wherein, the memory analysis report includes that the interactive component, the module of interactive component and bitmap are occupied One of memory size, image preview and reference stack are a variety of.
In a kind of illustrative embodiments of the disclosure, the mobile terminal memory analysis device further include:
Module is obtained, if the data volume for the internal storage data is not up to the preset threshold, interval second is pre- If the time, the running internal storage data of program is obtained again, until the data volume summation of the internal storage data of each acquisition reaches institute Until stating preset threshold.
The detail of each module is in corresponding mobile terminal memory point in above-mentioned mobile terminal memory analysis device It is described in detail in analysis method, therefore details are not described herein again.
It should be noted that although being referred to several modules or list for acting the equipment executed in the above detailed description Member, but this division is not enforceable.In fact, embodiment according to the present invention, it is above-described two or more Module or the feature and function of unit can embody in a module or unit.Conversely, an above-described mould The feature and function of block or unit can be to be embodied by multiple modules or unit with further division.
In addition, although describing each step of method in the present invention in the accompanying drawings with particular order, this does not really want These steps must be executed in this particular order by asking or implying, or having to carry out step shown in whole could realize Desired result.Additional or alternative, it is convenient to omit multiple steps are merged into a step and executed by certain steps, and/ Or a step is decomposed into execution of multiple steps etc..
Through the above description of the embodiments, those skilled in the art is it can be readily appreciated that example described herein is implemented Mode can also be realized by software realization in such a way that software is in conjunction with necessary hardware.Therefore, according to the present invention The technical solution of embodiment can be embodied in the form of software products, which can store non-volatile at one Property storage medium (can be CD-ROM, USB flash disk, mobile hard disk etc.) in or network on, including some instructions are so that a calculating Equipment (can be personal computer, server, mobile terminal or network equipment etc.) executes embodiment according to the present invention Method.
In an exemplary embodiment of the present invention, a kind of electronic equipment that can be realized the above method is additionally provided.
Person of ordinary skill in the field it is understood that various aspects of the invention can be implemented as system, method or Program product.Therefore, various aspects of the invention can be embodied in the following forms, it may be assumed that complete hardware embodiment, complete The embodiment combined in terms of full Software Implementation (including firmware, microcode etc.) or hardware and software, can unite here Referred to as circuit, " module " or " system ".
The electronic equipment 600 of this embodiment according to the present invention is described referring to Fig. 6.The electronics that Fig. 6 is shown Equipment 600 is only an example, should not function to the embodiment of the present invention and use scope bring any restrictions.
As shown in fig. 6, electronic equipment 600 is showed in the form of universal computing device.The component of electronic equipment 600 can wrap It includes but is not limited to: at least one above-mentioned processing unit 610, at least one above-mentioned storage unit 620, the different system components of connection The bus 630 of (including storage unit 620 and processing unit 610).
Wherein, the storage unit is stored with program code, and said program code can be held by the processing unit 610 Row, so that various according to the present invention described in the execution of the processing unit 610 above-mentioned " illustrative methods " part of this specification The step of illustrative embodiments.For example, the processing unit 610 can execute step S110 as shown in fig. 1: obtaining journey Internal storage data in sort run, and judge whether the data volume of the internal storage data reaches preset threshold;Step S120: if institute The data volume for stating internal storage data reaches the preset threshold, then is filtered to the internal storage data, and according to filtered interior Deposit data generates memory file to be analyzed;Step S130. analyzes the memory file to be analyzed, and according to described wait divide The analysis result for analysing memory file generates memory analysis report;Step S140: it sends the memory analysis and reports to preset service Device.
Storage unit 620 may include the readable medium of volatile memory cell form, such as Random Access Storage Unit (RAM) 6201 and/or cache memory unit 6202, it can further include read-only memory unit (ROM) 6203.
Storage unit 620 can also include program/utility with one group of (at least one) program module 6205 6204, such program module 6205 includes but is not limited to: operating system, one or more application program, other program moulds It may include the realization of network environment in block and program data, each of these examples or certain combination.
Bus 630 can be to indicate one of a few class bus structures or a variety of, including storage unit bus or storage Cell controller, peripheral bus, graphics acceleration port, processing unit use any bus structures in a variety of bus structures Local bus.
Electronic equipment 600 can also be with one or more external equipments 700 (such as keyboard, sensing equipment, bluetooth equipment Deng) communication, can also be enabled a user to one or more equipment interact with the electronic equipment 600 communicate, and/or with make Any equipment (such as the router, modulation /demodulation that the electronic equipment 600 can be communicated with one or more of the other calculating equipment Device etc.) communication.This communication can be carried out by input/output (I/O) interface 650.Also, electronic equipment 600 can be with By network adapter 660 and one or more network (such as local area network (LAN), wide area network (WAN) and/or public network, Such as internet) communication.As shown, network adapter 660 is communicated by bus 630 with other modules of electronic equipment 600. It should be understood that although not shown in the drawings, other hardware and/or software module can not used in conjunction with electronic equipment 600, including but not Be limited to: microcode, device driver, redundant processing unit, external disk drive array, RAID system, tape drive and Data backup storage system etc..
Through the above description of the embodiments, those skilled in the art is it can be readily appreciated that example described herein is implemented Mode can also be realized by software realization in such a way that software is in conjunction with necessary hardware.Therefore, according to the present invention The technical solution of embodiment can be embodied in the form of software products, which can store non-volatile at one Property storage medium (can be CD-ROM, USB flash disk, mobile hard disk etc.) in or network on, including some instructions are so that a calculating Equipment (can be personal computer, server, terminal installation or network equipment etc.) executes embodiment according to the present invention Method.
In an exemplary embodiment of the present invention, a kind of computer readable storage medium is additionally provided, energy is stored thereon with Enough realize the program product of this specification above method.In some possible embodiments, various aspects of the invention may be used also In the form of being embodied as a kind of program product comprising program code, when described program product is run on the terminal device, institute Program code is stated for executing the terminal device described in above-mentioned " illustrative methods " part of this specification according to this hair The step of bright various illustrative embodiments.
Refering to what is shown in Fig. 7, describing the program product for realizing the above method of embodiment according to the present invention 710, can using portable compact disc read only memory (CD-ROM) and including program code, and can in terminal device, Such as it is run on PC.However, program product of the invention is without being limited thereto, in this document, readable storage medium storing program for executing can be with To be any include or the tangible medium of storage program, the program can be commanded execution system, device or device use or It is in connection.
Described program product can be using any combination of one or more readable mediums.Readable medium can be readable letter Number medium or readable storage medium storing program for executing.Readable storage medium storing program for executing for example can be but be not limited to electricity, magnetic, optical, electromagnetic, infrared ray or System, device or the device of semiconductor, or any above combination.The more specific example of readable storage medium storing program for executing is (non exhaustive List) include: electrical connection with one or more conducting wires, portable disc, hard disk, random access memory (RAM), read-only Memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read only memory (CD-ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, In carry readable program code.The data-signal of this propagation can take various forms, including but not limited to electromagnetic signal, Optical signal or above-mentioned any appropriate combination.Readable signal medium can also be any readable Jie other than readable storage medium storing program for executing Matter, the readable medium can send, propagate or transmit for by instruction execution system, device or device use or and its The program of combined use.
The program code for including on readable medium can transmit with any suitable medium, including but not limited to wirelessly, have Line, optical cable, RF etc. or above-mentioned any appropriate combination.
The program for executing operation of the present invention can be write with any combination of one or more programming languages Code, described program design language include object oriented program language-Java, C++ etc., further include conventional Procedural programming language-such as " C " language or similar programming language.Program code can be fully in user It calculates and executes in equipment, partly executes on a user device, being executed as an independent software package, partially in user's calculating Upper side point is executed on a remote computing or is executed in remote computing device or server completely.It is being related to far Journey calculates in the situation of equipment, and remote computing device can pass through the network of any kind, including local area network (LAN) or wide area network (WAN), it is connected to user calculating equipment, or, it may be connected to external computing device (such as utilize ISP To be connected by internet).
In addition, above-mentioned attached drawing is only the schematic theory of processing included by method according to an exemplary embodiment of the present invention It is bright, rather than limit purpose.It can be readily appreciated that the time that above-mentioned processing shown in the drawings did not indicated or limited these processing is suitable Sequence.In addition, be also easy to understand, these processing, which can be, for example either synchronously or asynchronously to be executed in multiple modules.
Those skilled in the art will readily occur to of the invention its after considering specification and the invention invented here of practice His embodiment.This application is intended to cover any variations, uses, or adaptations of the invention, these modifications, purposes or Adaptive change follow general principle of the invention and the common knowledge in the art do not invented including the present invention or Conventional techniques.The description and examples are only to be considered as illustrative, and true scope and spirit of the invention are by claim It points out.

Claims (10)

1. a kind of mobile terminal memory analysis method characterized by comprising
The running internal storage data of program is obtained, and judges whether the data volume of the internal storage data reaches preset threshold;
If the data volume of the internal storage data reaches the preset threshold, the internal storage data is filtered, and according to Filtered internal storage data generates memory file to be analyzed;
The memory file to be analyzed is analyzed, and memory point is generated according to the analysis result of the memory file to be analyzed Analysis report;
The memory analysis is sent to report to predetermined server.
2. mobile terminal memory analysis method according to claim 1, which is characterized in that obtain the running memory of program Information includes:
It is spaced the first preset time, obtains the running internal storage data of program using Runtime function.
3. mobile terminal memory analysis method according to claim 1, which is characterized in that judge the number of the internal storage data Include: according to whether amount reaches preset threshold
Calculate the data volume of the internal storage data;
Judge whether the data volume of the internal storage data reaches preset threshold;Wherein, the preset threshold is according to device end Total amount of ram of described program operation distribution is determined;
If the data volume of the internal storage data reaches the preset threshold, judge that the data volume of the internal storage data is again It is no to reach preset threshold.
4. mobile terminal memory analysis method according to claim 1, which is characterized in that carried out to the internal storage data Filter, and memory file to be analyzed is generated according to filtered internal storage data and includes:
The internal storage data is filtered by Dump operation;
According to the size of data object in filtered internal storage data, filtered internal storage data is ranked up after obtaining sequence Internal storage data;
Memory file to be analyzed is generated according to the internal storage data after sequence;Wherein, the memory file to be analyzed is Hprof text Part.
5. mobile terminal memory analysis method according to claim 1, which is characterized in that the memory file to be analyzed Carrying out analysis includes:
Search the module and bitmap of the interactive component, interactive component revealed in the memory file to be analyzed;
The leakage reason of module and bitmap to the interactive component, interactive component is analyzed.
6. according to mobile terminal memory analysis method described in the claim 5, which is characterized in that according to described to be analyzed interior The analysis result for depositing file generates memory analysis report and includes:
Memory analysis report is generated according to the leakage reason of the interactive component, the module of interactive component and bitmap;
Wherein, the memory analysis report includes the interactive component, the module of interactive component and the occupied memory of bitmap One of size, image preview and reference stack are a variety of.
7. mobile terminal memory analysis method according to claim 1, which is characterized in that judging the internal storage data After whether data volume reaches preset threshold, the mobile terminal memory analysis method further include:
If the data volume of the internal storage data is not up to the preset threshold, it is spaced the second preset time, obtains journey again Internal storage data in sort run, until the data volume summation for the internal storage data that each time obtains reaches the preset threshold.
8. a kind of mobile terminal memory analysis device characterized by comprising
Judgment module for obtaining the running internal storage data of program, and judges whether the data volume of the internal storage data reaches Preset threshold;
Filtering module, if the data volume for the internal storage data reaches the preset threshold, to the internal storage data into Row filtering, and memory file to be analyzed is generated according to filtered internal storage data;
Analysis module, for analyzing the memory file to be analyzed, and according to the analysis of the memory file to be analyzed As a result memory analysis report is generated;
Analysis report sending module is reported for sending the memory analysis to predetermined server.
9. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program quilt Claim 1-7 described in any item mobile terminal memory analysis methods are realized when processor executes.
10. a kind of electronic equipment characterized by comprising
Processor;And
Memory, for storing the executable instruction of the processor;
Wherein, the processor is configured to require 1-7 described in any item via executing the executable instruction and carry out perform claim Mobile terminal memory analysis method.
CN201910063223.5A 2019-01-23 2019-01-23 Mobile terminal memory analysis method and device, storage medium and electronic equipment Active CN109828859B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910063223.5A CN109828859B (en) 2019-01-23 2019-01-23 Mobile terminal memory analysis method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910063223.5A CN109828859B (en) 2019-01-23 2019-01-23 Mobile terminal memory analysis method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN109828859A true CN109828859A (en) 2019-05-31
CN109828859B CN109828859B (en) 2023-03-07

Family

ID=66861903

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910063223.5A Active CN109828859B (en) 2019-01-23 2019-01-23 Mobile terminal memory analysis method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN109828859B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110457179A (en) * 2019-07-29 2019-11-15 Oppo广东移动通信有限公司 System detecting method, internal memory monitoring method, device, medium and electronic equipment
CN111694673A (en) * 2020-06-17 2020-09-22 北京字节跳动网络技术有限公司 Memory processing method and device, electronic equipment and computer readable storage medium
CN113094178A (en) * 2021-04-23 2021-07-09 北京字节跳动网络技术有限公司 Memory image file generation method and device, electronic equipment and storage medium
CN113468128A (en) * 2021-07-21 2021-10-01 上海浦东发展银行股份有限公司 Data processing method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20150002300A (en) * 2013-06-28 2015-01-07 부산대학교 산학협력단 Apparatus and Method for Detecting Memory Leak using Heap Analysis
CN106886476A (en) * 2017-02-08 2017-06-23 腾讯科技(深圳)有限公司 A kind of memory analysis method of client, apparatus and system
CN107632929A (en) * 2017-08-21 2018-01-26 北京京东尚科信息技术有限公司 A kind of method and apparatus for detecting memory overflow
CN107957941A (en) * 2016-10-17 2018-04-24 腾讯科技(深圳)有限公司 Mobile terminal memory overflow treating method and apparatus
CN109165202A (en) * 2018-07-04 2019-01-08 华南理工大学 A kind of preprocess method of multi-source heterogeneous big data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20150002300A (en) * 2013-06-28 2015-01-07 부산대학교 산학협력단 Apparatus and Method for Detecting Memory Leak using Heap Analysis
CN107957941A (en) * 2016-10-17 2018-04-24 腾讯科技(深圳)有限公司 Mobile terminal memory overflow treating method and apparatus
CN106886476A (en) * 2017-02-08 2017-06-23 腾讯科技(深圳)有限公司 A kind of memory analysis method of client, apparatus and system
CN107632929A (en) * 2017-08-21 2018-01-26 北京京东尚科信息技术有限公司 A kind of method and apparatus for detecting memory overflow
CN109165202A (en) * 2018-07-04 2019-01-08 华南理工大学 A kind of preprocess method of multi-source heterogeneous big data

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
网友: "《内存泄漏检测工具-LeakCanary》", 《HTTP://WWW.360DOC.COM/CONTENT/15/0926/00/2793098_501569968.SHTML》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110457179A (en) * 2019-07-29 2019-11-15 Oppo广东移动通信有限公司 System detecting method, internal memory monitoring method, device, medium and electronic equipment
CN111694673A (en) * 2020-06-17 2020-09-22 北京字节跳动网络技术有限公司 Memory processing method and device, electronic equipment and computer readable storage medium
CN111694673B (en) * 2020-06-17 2023-05-16 抖音视界有限公司 Memory processing method, memory processing device, electronic equipment and computer readable storage medium
CN113094178A (en) * 2021-04-23 2021-07-09 北京字节跳动网络技术有限公司 Memory image file generation method and device, electronic equipment and storage medium
CN113468128A (en) * 2021-07-21 2021-10-01 上海浦东发展银行股份有限公司 Data processing method and device, electronic equipment and storage medium
CN113468128B (en) * 2021-07-21 2023-02-17 上海浦东发展银行股份有限公司 Data processing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN109828859B (en) 2023-03-07

Similar Documents

Publication Publication Date Title
CN109828859A (en) Mobile terminal memory analysis method, apparatus, storage medium and electronic equipment
CN111178380B (en) Data classification method and device and electronic equipment
US10606734B2 (en) Intelligent device selection for mobile application testing
US11694090B2 (en) Debugging deep neural networks
US11651233B2 (en) Candidate visualization techniques for use with genetic algorithms
US10976904B2 (en) Graphical chatbot interface facilitating user-chatbot interaction
CN109255072A (en) Information recalls method and device, computer storage medium, electronic equipment
CN108763091A (en) Method, apparatus and system for regression test
US10423409B2 (en) Weighting static analysis alerts
US10628465B2 (en) Generating a ranked list of best fitting place names
CN109460003A (en) Vehicle trouble predicts modeling method and system
US20220391672A1 (en) Multi-task deployment method and electronic device
CN111738316B (en) Zero sample learning image classification method and device and electronic equipment
US11144437B2 (en) Pre-populating continuous delivery test cases
CN115878394A (en) Memory test method and device, electronic equipment and storage medium
US20200211536A1 (en) Visually exploring and prioritizing discordant conversations with conversational bots
US11755954B2 (en) Scheduled federated learning for enhanced search
CN114564374A (en) Operator performance evaluation method and device, electronic equipment and storage medium
US10073938B2 (en) Integrated circuit design verification
CN109977925B (en) Expression determination method and device and electronic equipment
CN114880422B (en) Interest point information processing method based on robot process automation and related device
CN111666201A (en) Regression testing method, device, medium and electronic equipment
US10607233B2 (en) Automated review validator
CN113094415B (en) Data extraction method, data extraction device, computer readable medium and electronic equipment
CN111079185B (en) Database information processing method and device, storage medium and electronic equipment

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