CN105373479A - Automatic test method and device of memory leakage and mobile terminal - Google Patents

Automatic test method and device of memory leakage and mobile terminal Download PDF

Info

Publication number
CN105373479A
CN105373479A CN201510930279.8A CN201510930279A CN105373479A CN 105373479 A CN105373479 A CN 105373479A CN 201510930279 A CN201510930279 A CN 201510930279A CN 105373479 A CN105373479 A CN 105373479A
Authority
CN
China
Prior art keywords
thread
memory
tested application
test
test case
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
CN201510930279.8A
Other languages
Chinese (zh)
Other versions
CN105373479B (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.)
Xiamen Meitu Mobile Technology Co Ltd
Original Assignee
Xiamen Meitu Mobile Technology 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 Xiamen Meitu Mobile Technology Co Ltd filed Critical Xiamen Meitu Mobile Technology Co Ltd
Priority to CN201510930279.8A priority Critical patent/CN105373479B/en
Publication of CN105373479A publication Critical patent/CN105373479A/en
Application granted granted Critical
Publication of CN105373479B publication Critical patent/CN105373479B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses an automatic test method of memory leakage, which is suitably used for being executed in a mobile terminal. The method comprises the following steps of building a first thread; executing a test case in the first thread; building a second thread; starting memory monitoring in the second thread; detecting whether the test case in the first thread is still executed or not; acquiring memory occupancy data of a tested application if the test case in the first thread is determined to be still executed; judging whether memory leakage occurs in the tested application or not according to the memory occupancy data; repeating the above steps of detection, acquisition and judgment per sampling time interval until memory leakage occurs in the tested application if no memory leakage occurring in the tested application is judged; giving out an alarm signal when memory leakage occurring in the tested application is judged; and extracting a memory information file of the tested application so as to locate the position of memory leakage of the tested application according to the memory information file. The invention discloses an automatic test device of memory leakage and the mobile terminal.

Description

A kind of automated testing method of RAM leakage, device and mobile terminal
Technical field
The present invention relates to the applied technical field of mobile terminal, especially a kind of automated testing method, Apparatus and system of RAM leakage.
Background technology
At present, the application of installing in mobile terminal such as smart mobile phone gets more and more.Although its level of hardware is in continuous lifting, but user still often feels to occur card when operation, namely runs not smooth.Occur that a major reason of this situation is the defect of application or system, cause RAM leakage occurs.RAM leakage not only can affect the travelling speed of mobile terminal, also likely causes application crashes.
Therefore, the test carrying out RAM leakage for the application of mobile terminal, system is necessary.Traditional mode is by certainly grinding instrument at PC end monitoring internal memory situation (such as constantly reading memory occupation information in a long time), then observer's manual observation EMS memory occupation situation of change.This mode requires that mobile terminal holds wired being connected with PC, and when the growth rate of internal memory is very small, is difficult to be perceiveed; In addition, a kind of half mode departing from PC is also had to be by writing automatic test script, perform script, PC is connected after use-case terminates, extract memory information file, but judge that the accuracy of memory overflow is not high by the method, the automatic releasing memory of system can cause information in the file extracted incomplete, and software developer is still difficult to the problem place of memory leak positioning.
Therefore, a kind of automatic test scheme departing from the more accurately easier memory overflow of PC is needed.
Summary of the invention
For this reason, the invention provides a kind of automated testing method of RAM leakage, device and mobile terminal, to try hard to solve or at least alleviate at least one problem existed above.
According to an aspect of the present invention, provide a kind of automated testing method of RAM leakage, be suitable for performing in the terminal, the method comprises: create the first thread; Implementation of test cases in the first thread; Create the second thread; Internal memory monitoring is opened in the second thread; Detect test case in the first thread whether still performing; If determine, in the first thread, test case still in execution, then gathers the EMS memory occupation data of tested application; Judge whether tested application memory overflow occurs according to EMS memory occupation data; If judge not there is memory overflow in tested application, then repeat above-mentioned detection, collection and determining step every sampling time interval, till judging tested application generation memory overflow; When judging tested application generation memory overflow, give the alarm signal; And extract the memory information file of tested application, so that according to the memory leakage position of the tested application of memory information document alignment.
Alternatively, in the automated testing method of RAM leakage according to the present invention, also comprise step: before creating the first thread, receive the test script pushed.
Alternatively, in the automated testing method of RAM leakage according to the present invention, wherein in the first thread, the step of implementation of test cases comprises: carry out implementation of test cases by calling test script; And during test script end of run, send termination signal to the second thread.
Alternatively, in the automated testing method of RAM leakage according to the present invention, wherein detect test case in the first thread whether still to comprise in the step performed: detect the termination signal whether received from the first thread, if, then determine that in the first thread, test case performs end, otherwise determine that in the first thread, test case is still in execution.
Alternatively, in the automated testing method of RAM leakage according to the present invention, also comprise step: in the first thread, test case performs end if determine, then stop internal memory monitoring and stop the second thread.
Alternatively, in the automated testing method of RAM leakage according to the present invention, wherein judge that the step whether tested application memory overflow occurs comprises according to EMS memory occupation data: judge whether EMS memory occupation data are greater than maximum memory alarm value, if so, tested application generation memory overflow is then determined; Or calculate EMS memory occupation growth rate according to EMS memory occupation data, judge whether EMS memory occupation growth rate is greater than internal memory growth rate alarm value, if so, then determine tested application generation memory overflow; And if the two is no above, then determine that tested application memory overflow does not occur.
Alternatively, in the automated testing method of RAM leakage according to the present invention, wherein comprise according to the step of EMS memory occupation data calculating EMS memory occupation growth rate: by when after the EMS memory occupation data once gathered before time EMS memory occupation data of collection deduct, obtain EMS memory occupation growth rate divided by sampling time interval.
Alternatively, in the automated testing method of RAM leakage according to the present invention, wherein sampling time interval is 60 seconds, and maximum memory alarm value is 50MB, and internal memory growth rate alarm value is 10KB/s.
Alternatively, in the automated testing method of RAM leakage according to the present invention, wherein memory information file is hprof file.
According to a further aspect in the invention, provide a kind of automatic test device of RAM leakage, in the terminal resident, this device comprises: thread creation unit, is suitable for establishment first thread, is also suitable for establishment second thread; Use-case performance element, is suitable for implementation of test cases in the first thread; Monitor collecting unit, is suitable for opening internal memory monitoring in the second thread, and whether to detect in the first thread test case still in execution, if so, then gathers the EMS memory occupation data of tested application; Computing judging unit, is suitable for judging whether tested application memory overflow occurs according to EMS memory occupation data in the second thread; And leakage alarm unit, be suitable for when computing judging unit judges tested application generation memory overflow, give the alarm signal, and extract the memory information file of tested application, so that according to the memory leakage position of the tested application of memory information document alignment; Wherein, if computing judging unit judges that tested application memory overflow does not occur, if be then also suitable for test case in duplicate detection first thread every sampling time interval monitor collecting unit whether still performing the EMS memory occupation data then gathering tested application, computing judging unit is also suitable for repeating to judge whether tested application memory overflow occurs, till computing judging unit judges tested application generation memory overflow.
Alternatively, in the automatic test device of RAM leakage according to the present invention, wherein use-case performance element is also suitable for receiving the test script pushed.
Alternatively, in the automatic test device of RAM leakage according to the present invention, wherein use-case performance element is also suitable for carrying out implementation of test cases by calling test script in the first thread, when being also suitable for test script end of run, sends termination signal to the second thread.
Alternatively, in the automatic test device of RAM leakage according to the present invention, wherein monitor collecting unit is also suitable in the second thread, detect the termination signal whether received from the first thread, if, then determine that in the first thread, test case performs end, otherwise determine that in the first thread, test case is still in execution.
Alternatively, in the automatic test device of RAM leakage according to the present invention, if wherein monitor collecting unit is also suitable for determining that in the first thread, test case performs end, then stops internal memory monitoring and stop the second thread.
Alternatively, in the automatic test device of RAM leakage according to the present invention, wherein computing judging unit is also suitable for judging whether EMS memory occupation data are greater than maximum memory alarm value, if so, then determines tested application generation memory overflow; Or calculate EMS memory occupation growth rate according to EMS memory occupation data, judge whether EMS memory occupation growth rate is greater than internal memory growth rate alarm value, if so, then determine tested application generation memory overflow; And if the two is no above, then determine that tested application memory overflow does not occur.
Alternatively, in the automatic test device of RAM leakage according to the present invention, wherein computing judging unit is also suitable for, by when after the EMS memory occupation data once gathered before time EMS memory occupation data of collection deduct, obtaining EMS memory occupation growth rate divided by sampling time interval.
Alternatively, in the automatic test device of RAM leakage according to the present invention, wherein sampling time interval is 60 seconds, and maximum memory alarm value is 50MB, and internal memory growth rate alarm value is 10KB/s.
Alternatively, in the automatic test device of RAM leakage according to the present invention, wherein memory information file is hprof file.
According to a further aspect in the invention, provide a kind of mobile terminal, there is the automatic test device of RAM leakage as above.
According to the automatic test scheme of RAM leakage of the present invention, perform memory leak detecting by the mode of carrying out automatic test on mobile terminals.The EMS memory occupation data of tested application in mobile terminal are monitored in test process, and by presetting alarm border, when the EMS memory occupation data of tested application reach alarm border, give the alarm, extract memory information file, save the time of manually repeatedly checking internal memory situation, ensure accuracy and the validity of memory information file, and improve testing efficiency.
Accompanying drawing explanation
In order to realize above-mentioned and relevant object; combine description below and accompanying drawing herein to describe some illustrative aspect; these aspects indicate the various modes can putting into practice principle disclosed herein, and all aspects and equivalent aspect thereof are intended to fall in the scope of theme required for protection.Read detailed description below in conjunction with the drawings, above-mentioned and other object of the present disclosure, Characteristics and advantages will become more obvious.Throughout the disclosure, identical Reference numeral is often referred to for identical parts or element.
Fig. 1 shows the structure block diagram of the mobile terminal 100 according to an exemplary embodiment of the present invention;
Fig. 2 shows the process flow diagram of the automated testing method 200 of RAM leakage according to an embodiment of the invention; And
Fig. 3 shows the schematic diagram of the automatic test device 300 of RAM leakage according to an embodiment of the invention.
Embodiment
Below with reference to accompanying drawings exemplary embodiment of the present disclosure is described in more detail.Although show exemplary embodiment of the present disclosure in accompanying drawing, however should be appreciated that can realize the disclosure in a variety of manners and not should limit by the embodiment set forth here.On the contrary, provide these embodiments to be in order to more thoroughly the disclosure can be understood, and complete for the scope of the present disclosure can be conveyed to those skilled in the art.
Fig. 1 is mobile terminal 100 organigram according to an embodiment of the invention.With reference to Fig. 1, mobile terminal 100 comprises: memory interface 102, one or more data processor, image processor and/or CPU (central processing unit) 104, and peripheral interface 106.Memory interface 102, one or more processor 104 and/or peripheral interface 106 both can be discrete components, also can be integrated in one or more integrated circuit.In the mobile terminal 100, various element can be coupled by one or more communication bus or signal wire.Sensor, equipment and subsystem can be coupled to peripheral interface 106, to help to realize several functions.Such as, motion sensor 110, optical sensor 112 and range sensor 114 can be coupled to peripheral interface 106, to facilitate the functions such as orientation, illumination and range finding.Other sensors 116 can be connected with peripheral interface 106 equally, such as positioning system (such as GPS), temperature sensor, biometric sensor or other sensor devices, can help thus to implement relevant function.
Camera sub-system 120 and optical sensor 122 may be used for the realization of the camera function of convenient such as recording photograph and video clipping, and wherein said camera sub-system and optical sensor can be such as charge-coupled image sensor (CCD) or complementary metal oxide semiconductor (CMOS) (CMOS) optical sensor.Can help realize communication function by one or more radio communication subsystem 124, wherein radio communication subsystem can comprise radio-frequency transmitter and transmitter and/or light (such as infrared) Receiver And Transmitter.The particular design of radio communication subsystem 124 and embodiment can depend on one or more communication networks that mobile terminal 100 is supported.Such as, mobile terminal 100 can comprise the communication subsystem 124 being designed to support GSM network, GPRS network, EDGE network, Wi-Fi or WiMax network and BlueboothTM network.Audio subsystem 126 can be coupled with loudspeaker 128 and microphone 130, such as, to help the function of implementing to enable voice, speech recognition, speech reproduction, digital recording and telephony feature.
I/O subsystem 140 can comprise touch screen controller 142 and/or other input control devices 144 one or more.Touch screen controller 142 can be coupled to touch-screen 146.For example, what this touch-screen 146 and touch screen controller 142 can use any one in multiple touch-sensing technology to detect to carry out with it contact and movement or time-out, and wherein detection technology is including, but not limited to capacitive character, resistive, infrared and surface acoustic wave technique.Other input control devices 144 one or more can be coupled to other input/control devicess 148, the indication equipment of such as one or more button, rocker switch, thumb wheel, infrared port, USB port and/or stylus and so on.Described one or more button (not shown) can comprise the up/down button for control loudspeaker 128 and/or microphone 130 volume.
Memory interface 102 can be coupled with storer 150.This storer 150 can comprise high-speed random access memory and/or nonvolatile memory, such as one or more disk storage device, one or more optical storage apparatus, and/or flash memories (such as NAND, NOR).Storer 150 can store operating system 152, the operating system of such as Android, IOS or WindowsPhone and so on.This operating system 152 can comprise the instruction of the task of depending on hardware for the treatment of basic system services and execution.Storer 150 can also store application 154.When these are applied in operation, can be loaded into processor 104 from storer 150, and run on the operating system run by processor 104, and the function that the various user of the Interface realization utilizing operating system and bottom hardware to provide expects, as instant messaging, web page browsing, pictures management etc.Application can provide independent of operating system, also can be that operating system carries.
According to one embodiment of present invention, provide a kind of can the mobile terminal 100 of automatic test RAM leakage, can by arranging that the device of RAM leakage automatic test realize this function, this device is stored in application 154.
Fig. 2 shows the process flow diagram of RAM leakage automated testing method 200 according to an embodiment of the invention.The method performs in the mobile terminal 100, and the method starts from step S210.
The first thread is created in step S210, then in step S220, implementation of test cases in this first thread.Test case a specific software product is carried out to the description of test assignment, usually can comprise test target, test environment, input data, testing procedure, expected results and test script etc., and form document.Generally, the function by assessing test target designs the test case of RAM leakage.The wherein function of test target mainly index certificate, network, function that multithreading is relevant.Such as, for the RAM leakage testing example design of music application in mobile terminal, need to consider that such as local music is play, music list refreshes, Online Music broadcasting is downloaded, play the function such as music and down-load music simultaneously.
In step S230, create the second thread, then in step S240, in this second thread, open internal memory monitoring.Particularly, when user opens internal memory monitoring, mobile terminal 100 performs Shell order by backstage, obtain the internal memory monitoring data of all processes/or application, such as: the internal memory monitoring data of calendar application, perform Shell order dumpsysmeminfo|grepcom.android.calendar can directly obtain, wherein com.android.calendar is the bag name of calendar.Especially, user can arrange according to the demand of oneself application monitored frequency and/or will monitor voluntarily.
According to an embodiment of the invention, before step S210, the test script of propelling movement can be received.In the step S220 of the first thread implementation of test cases, implementation of test cases can be carried out by calling this test script, test script end of run and test case perform end, the second Thread Termination, now send termination signal to the second thread, this termination signal indicates end, second Thread Termination of test case.According to a kind of embodiment, test script obtains according to test case usually, and will follow " the separable independent operating of step " principle.
Then the second thread in step s 250, detect test case in the first thread whether still performing, wherein step S250 can comprise, detect the termination signal whether received from the first thread, if, then determine that in the first thread, test case performs end, otherwise determine that in the first thread, test case is still in execution.
According to an embodiment of the invention, if determine, in the first thread, test case performs end, then can stop internal memory monitoring, and stop the second thread.
If determine, in the first thread, test case still in execution, then gathers the EMS memory occupation data of tested application in step S260.Particularly, tested application can be selected, and gather the EMS memory occupation data of this tested application from the internal memory monitoring data that above-mentioned mobile terminal 100 obtains.
After obtaining these EMS memory occupation data, in step S270, can judge whether tested application memory overflow occurs according to these EMS memory occupation data.Particularly, according to an embodiment of the invention, can judge whether these EMS memory occupation data are greater than maximum memory alarm value, if so, then determine tested application generation memory overflow; Or calculate EMS memory occupation growth rate according to EMS memory occupation data, judge whether EMS memory occupation growth rate is greater than internal memory growth rate alarm value, if so, then determine tested application generation memory overflow.If be no both above, then determine that tested application memory overflow does not occur.Wherein by when after the EMS memory occupation data once gathered before time EMS memory occupation data of collection deduct, EMS memory occupation growth rate can be obtained divided by sampling time interval.
According to an embodiment of the invention, maximum memory alarm value can be 50MB, and internal memory growth rate alarm value can be 10KB/s.
If judge not there is memory overflow in tested application, then every sampling time interval, repeat above-mentioned steps S250, S260 and S270, till judging tested application generation memory overflow.
When judging tested application generation memory overflow, the second thread gives the alarm signal in step S280, and in step S290, extracts the memory information file of this tested application simultaneously, so that according to the memory leakage position of the tested application of this memory information document alignment.Particularly, by the PID of tested application, and kill-10PID order can be used, extract the memory information file of this application.After using this order, generally will equipment /data/misc catalogue under generate hprof file, hprof file comprises the memory usage information of this tested application, by MAT tool to open, can analyze concrete Memory Allocation situation.
Like this, can judge whether more accurately memory overflow occurs by EMS memory occupation data and internal memory growth rate, and can notify that tester pays close attention to the very first time when there is memory overflow, need not connect PC can obtain the file preserving complete memory information simultaneously, the concrete position that RAM leakage occurs can be located more accurately by this file tester, avoid because of internal memory be released after the memory information that causes complete, be difficult to the situation of locating.
Fig. 3 shows the schematic diagram of the automatic test device 300 of RAM leakage according to an embodiment of the invention.This device resides on mobile terminal 100, and comprises: thread creation unit 310, use-case performance element 320, monitor collecting unit 330, computing judging unit 340 and leakage alarm unit 350.
Thread creation unit 310 is suitable for establishment first thread.Use-case performance element 320 is connected with thread creation unit 310, and is suitable for implementation of test cases in the first thread.According to an embodiment of the invention, use-case performance element 320 is also suitable for before establishment first thread, receive the test script pushed, and implementation of test cases is carried out by calling this test script in the first thread, also be suitable for when test script end of run, send termination signal to the second thread.
Thread creation unit 310 is also suitable for establishment second thread.Monitor collecting unit 330 is connected with thread creation unit 310 equally, and is suitable for opening internal memory monitoring in the second thread, is obtained the internal memory monitoring data of all processes/or application by internal memory monitoring.
Whether monitor collecting unit 330 is also suitable for test case in detection first thread and is still performing.By detecting the termination signal whether received from the first thread in the second thread, monitor collecting unit 330 can judge that whether test case is still in execution, if monitor collecting unit 330 receives the termination signal from the first thread, then determine that in the first thread, test case performs end, otherwise determine that in the first thread, test case is still in execution.
According to an embodiment of the invention, if determine, in the first thread, test case performs end, and monitor collecting unit 330 can stop internal memory monitoring and stop the second thread.
If determine, in the first thread, test case performs end, and monitor collecting unit 330 can gather the EMS memory occupation data of tested application from the internal memory monitoring data of above-mentioned acquisition.According to these EMS memory occupation data, the computing judging unit 340 be connected with monitor collecting unit 330 can judge whether tested application memory overflow occurs in the second thread.
If computing judging unit 340 judges that tested application memory overflow does not occur, if whether then test case still the EMS memory occupation data then gathering tested application can be being performed in duplicate detection first thread every sampling time interval monitor collecting unit 330, computing judging unit 340 can repeat to judge whether this tested application memory overflow occurs, till computing judging unit 340 judges tested application generation memory overflow.
According to an embodiment of the invention, computing judging unit 340 can judge whether EMS memory occupation data are greater than maximum memory alarm value, if so, then determines tested application generation memory overflow; Or calculate EMS memory occupation growth rate according to EMS memory occupation data, judge whether EMS memory occupation growth rate is greater than internal memory growth rate alarm value, if so, then determine tested application generation memory overflow; If be no both above, then computing judging unit 340 determines that tested application memory overflow does not occur.Wherein, by when after the EMS memory occupation data once gathered before time EMS memory occupation data of collection deduct, EMS memory occupation growth rate can be obtained divided by sampling time interval.Sampling time interval is generally 60s-300s, and maximum memory alarm value is generally 40MB-100MB, and internal memory growth rate alarm value is generally 5KB/s-15KB/s.
And when computing judging unit 340 judges tested application generation memory overflow, the leakage alarm unit 350 be connected with computing judging unit 340 is suitable for the signal that gives the alarm, and extract the memory information file of tested application, such as hprof file, so that according to the memory leakage position of the tested application of this memory information document alignment.
Be to be understood that, in order to simplify the disclosure and to help to understand in each inventive aspect one or more, in the description above to exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or the description to it sometimes.But, the method for the disclosure should be construed to the following intention of reflection: namely the present invention for required protection requires than the feature more multiple features clearly recorded in each claim.Or rather, as claims below reflect, all features of disclosed single embodiment before inventive aspect is to be less than.Therefore, the claims following embodiment are incorporated to this embodiment thus clearly, and wherein each claim itself is as independent embodiment of the present invention.
Those skilled in the art are to be understood that the module of the equipment in example disclosed herein or unit or assembly can be arranged in equipment as depicted in this embodiment, or alternatively can be positioned in one or more equipment different from the equipment in this example.Module in aforementioned exemplary can be combined as a module or can be divided into multiple submodule in addition.
Those skilled in the art are appreciated that and adaptively can change the module in the equipment in embodiment and they are arranged in one or more equipment different from this embodiment.Module in embodiment or unit or assembly can be combined into a module or unit or assembly, and multiple submodule or subelement or sub-component can be put them in addition.Except at least some in such feature and/or process or unit be mutually repel except, any combination can be adopted to combine all processes of all features disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) and so disclosed any method or equipment or unit.Unless expressly stated otherwise, each feature disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) can by providing identical, alternative features that is equivalent or similar object replaces.
The present invention also comprises: A5, method as described in A4, also comprise step: in the first thread, test case performs end if determine, then stop internal memory monitoring and stop described second thread.A6, method according to any one of A1-5, wherein saidly judge that the step whether tested application memory overflow occurs comprises according to EMS memory occupation data: judge whether described EMS memory occupation data are greater than maximum memory alarm value, if so, tested application generation memory overflow is then determined; Or calculate EMS memory occupation growth rate according to described EMS memory occupation data, judge whether described EMS memory occupation growth rate is greater than internal memory growth rate alarm value, if so, then determine tested application generation memory overflow; And if the two is no above, then determine that tested application memory overflow does not occur.A7, method as described in A6, the wherein said step according to described EMS memory occupation data calculating EMS memory occupation growth rate comprises: by when after the EMS memory occupation data once gathered before time EMS memory occupation data of collection deduct, obtain described EMS memory occupation growth rate divided by described sampling time interval.A8, method according to any one of A1-7, wherein said sampling time interval is 60 seconds, and described maximum memory alarm value is 50MB, and described internal memory growth rate alarm value is 10KB/s.A9, method according to any one of A1-8, wherein said memory information file is hprof file.
B15, device according to any one of B10-14, wherein computing judging unit is also suitable for judging whether described EMS memory occupation data are greater than maximum memory alarm value, if so, then determines tested application generation memory overflow; Or calculate EMS memory occupation growth rate according to described EMS memory occupation data, judge whether described EMS memory occupation growth rate is greater than internal memory growth rate alarm value, if so, then determine tested application generation memory overflow; And if the two is no above, then determine that tested application memory overflow does not occur.B16, device as described in B15, wherein computing judging unit is also suitable for, by when after the EMS memory occupation data once gathered before the EMS memory occupation data time to gather deduct, obtaining described EMS memory occupation growth rate divided by described sampling time interval.B17, device according to any one of B10-16, wherein said sampling time interval is 60 seconds, and described maximum memory alarm value is 50MB, and described internal memory growth rate alarm value is 10KB/s.B18, device according to any one of B10-17, wherein said memory information file is hprof file.
In addition, those skilled in the art can understand, although embodiments more described herein to comprise in other embodiment some included feature instead of further feature, the combination of the feature of different embodiment means and to be within scope of the present invention and to form different embodiments.Such as, in the following claims, the one of any of embodiment required for protection can use with arbitrary array mode.
In addition, some in described embodiment are described as at this can by the processor of computer system or the method implemented by other device performing described function or the combination of method element.Therefore, there is the device of processor formation for implementing the method or method element of the necessary instruction for implementing described method or method element.In addition, the element described herein of device embodiment is the example as lower device: this device is for implementing the function performed by the element of the object in order to implement this invention.
As used in this, unless specifically stated so, use ordinal number " first ", " second ", " the 3rd " etc. to describe plain objects and only represent the different instances relating to similar object, and be not intended to imply the object be described like this must have the time upper, spatially, sequence aspect or in any other manner to definite sequence.
Although the embodiment according to limited quantity describes the present invention, benefit from description above, those skilled in the art understand, in the scope of the present invention described thus, it is contemplated that other embodiment.In addition, it should be noted that the language used in this instructions is mainly in order to object that is readable and instruction is selected, instead of select to explain or limiting theme of the present invention.Therefore, when not departing from the scope and spirit of appended claims, many modifications and changes are all apparent for those skilled in the art.For scope of the present invention, be illustrative to disclosing of doing of the present invention, and nonrestrictive, and scope of the present invention is defined by the appended claims.

Claims (10)

1. an automated testing method for RAM leakage, be suitable for performing in the terminal, the method comprises:
Create the first thread;
Implementation of test cases in the first thread;
Create the second thread;
Internal memory monitoring is opened in the second thread;
Whether detect test case described in described first thread still in execution;
If determine, in described first thread, test case still in execution, then gathers the EMS memory occupation data of tested application;
Judge whether described tested application memory overflow occurs according to described EMS memory occupation data;
If judge not there is memory overflow in tested application, then repeat above-mentioned detection, collection and determining step every sampling time interval, till judging tested application generation memory overflow;
When judging tested application generation memory overflow, give the alarm signal; And
Extract the memory information file of described tested application, so that the memory leakage position of tested application according to described memory information document alignment.
2. the method for claim 1, also comprises step:
Before creating the first thread, receive the test script pushed.
3. method as claimed in claim 2, the step of wherein said implementation of test cases in the first thread comprises:
Described test case is performed by calling described test script; And
During described test script end of run, send termination signal to described second thread.
4. method as claimed in claim 3, in wherein said detection first thread, whether test case still comprises in the step performed:
Detect the termination signal whether received from described first thread, if so, then determine that in the first thread, test case performs end, otherwise determine that in the first thread, test case is still in execution.
5. a RAM leakage automatic test device, in the terminal resident, and described device comprises:
Thread creation unit, is suitable for establishment first thread, is also suitable for establishment second thread;
Use-case performance element, is suitable for implementation of test cases in the first thread;
Monitor collecting unit, is suitable for opening internal memory monitoring in the second thread, and whether to detect in described first thread test case still in execution, if so, then gathers the EMS memory occupation data of tested application;
Computing judging unit, is suitable for judging whether described tested application memory overflow occurs according to described EMS memory occupation data in the second thread; And
Leakage alarm unit, be suitable for when described computing judging unit judges tested application generation memory overflow, give the alarm signal, and extract the memory information file of described tested application, so that the memory leakage position of tested application according to described memory information document alignment;
Wherein, if computing judging unit judges that tested application memory overflow does not occur, if be then also suitable for test case in duplicate detection first thread every monitor collecting unit described in sampling time interval whether still performing the EMS memory occupation data then gathering tested application, described computing judging unit is also suitable for repeating to judge whether described tested application memory overflow occurs, till computing judging unit judges tested application generation memory overflow.
6., as right wants the device as described in 5, wherein said use-case performance element is also suitable for receiving the test script pushed.
7. device as claimed in claim 6, wherein said use-case performance element is also suitable for performing described test case by calling described test script in the first thread, when being also suitable for described test script end of run, sends termination signal to described second thread.
8. device as claimed in claim 7, wherein monitor collecting unit is also suitable in the second thread, detect the termination signal whether received from described first thread, if so, then determine that in the first thread, test case performs end, otherwise determine that in the first thread, test case is still in execution.
9. device as claimed in claim 8, if wherein monitor collecting unit is also suitable for determining that in the first thread, test case performs end, then stops internal memory monitoring and stops described second thread.
10. a mobile terminal, comprises the RAM leakage automatic test device according to any one of claim 5-9.
CN201510930279.8A 2015-12-14 2015-12-14 A kind of automated testing method of RAM leakage, device and mobile terminal Active CN105373479B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510930279.8A CN105373479B (en) 2015-12-14 2015-12-14 A kind of automated testing method of RAM leakage, device and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510930279.8A CN105373479B (en) 2015-12-14 2015-12-14 A kind of automated testing method of RAM leakage, device and mobile terminal

Publications (2)

Publication Number Publication Date
CN105373479A true CN105373479A (en) 2016-03-02
CN105373479B CN105373479B (en) 2019-03-15

Family

ID=55375697

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510930279.8A Active CN105373479B (en) 2015-12-14 2015-12-14 A kind of automated testing method of RAM leakage, device and mobile terminal

Country Status (1)

Country Link
CN (1) CN105373479B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095689A (en) * 2016-06-24 2016-11-09 北京奇虎科技有限公司 The detection method of a kind of application memory leakage and device
CN106227650A (en) * 2016-07-08 2016-12-14 北京奇虎科技有限公司 A kind of method and apparatus of the memory overflow detecting application
CN106354627A (en) * 2016-07-21 2017-01-25 努比亚技术有限公司 Method and system for detecting memory leakage of application program
CN106383743A (en) * 2016-09-27 2017-02-08 腾讯科技(深圳)有限公司 Business processing method and system
CN106528430A (en) * 2016-12-01 2017-03-22 北京金山安全软件有限公司 Application program detection method and device and electronic equipment
CN106844159A (en) * 2017-02-03 2017-06-13 广东欧珀移动通信有限公司 A kind of information acquisition method, device and intelligent terminal
CN107346266A (en) * 2017-06-09 2017-11-14 烽火通信科技股份有限公司 Memory Allocation information tracking method and device based on vxworks operating system
CN107391359A (en) * 2016-05-17 2017-11-24 腾讯科技(深圳)有限公司 A kind of service test method and device
CN107957941A (en) * 2016-10-17 2018-04-24 腾讯科技(深圳)有限公司 Mobile terminal memory overflow treating method and apparatus
CN108241560A (en) * 2016-12-26 2018-07-03 北京金山安全软件有限公司 Memory test method and device and electronic equipment
CN108377292A (en) * 2018-01-30 2018-08-07 努比亚技术有限公司 Solve method, terminal, server and the computer storage media of RAM leakage
CN109933517A (en) * 2017-12-19 2019-06-25 成都鼎桥通信技术有限公司 Test method, device and equipment based on android system
CN111984541A (en) * 2020-08-31 2020-11-24 北京达佳互联信息技术有限公司 Memory leak detection method and device and terminal

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090112491A (en) * 2008-04-24 2009-10-28 주식회사 파수닷컴 Memory Leak Detecting Apparatus and Method thereof
CN103778056A (en) * 2012-10-23 2014-05-07 腾讯科技(深圳)有限公司 Wireless application stability testing method and system
CN104182320A (en) * 2013-05-23 2014-12-03 联想(北京)有限公司 Method and device for monitoring leakage of memory
CN104991847A (en) * 2015-07-03 2015-10-21 厦门美图移动科技有限公司 Memory leakage automatic testing method and apparatus and mobile terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090112491A (en) * 2008-04-24 2009-10-28 주식회사 파수닷컴 Memory Leak Detecting Apparatus and Method thereof
CN103778056A (en) * 2012-10-23 2014-05-07 腾讯科技(深圳)有限公司 Wireless application stability testing method and system
CN104182320A (en) * 2013-05-23 2014-12-03 联想(北京)有限公司 Method and device for monitoring leakage of memory
CN104991847A (en) * 2015-07-03 2015-10-21 厦门美图移动科技有限公司 Memory leakage automatic testing method and apparatus and mobile terminal

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107391359B (en) * 2016-05-17 2020-11-27 腾讯科技(深圳)有限公司 Service testing method and device
CN107391359A (en) * 2016-05-17 2017-11-24 腾讯科技(深圳)有限公司 A kind of service test method and device
CN106095689A (en) * 2016-06-24 2016-11-09 北京奇虎科技有限公司 The detection method of a kind of application memory leakage and device
CN106227650A (en) * 2016-07-08 2016-12-14 北京奇虎科技有限公司 A kind of method and apparatus of the memory overflow detecting application
CN106354627A (en) * 2016-07-21 2017-01-25 努比亚技术有限公司 Method and system for detecting memory leakage of application program
CN106383743A (en) * 2016-09-27 2017-02-08 腾讯科技(深圳)有限公司 Business processing method and system
CN107957941A (en) * 2016-10-17 2018-04-24 腾讯科技(深圳)有限公司 Mobile terminal memory overflow treating method and apparatus
CN107957941B (en) * 2016-10-17 2021-03-16 腾讯科技(深圳)有限公司 Method and device for processing memory leakage of mobile terminal
CN106528430A (en) * 2016-12-01 2017-03-22 北京金山安全软件有限公司 Application program detection method and device and electronic equipment
CN106528430B (en) * 2016-12-01 2019-03-26 北京金山安全软件有限公司 Application program detection method and device and electronic equipment
CN108241560A (en) * 2016-12-26 2018-07-03 北京金山安全软件有限公司 Memory test method and device and electronic equipment
CN108241560B (en) * 2016-12-26 2021-07-23 北京金山安全软件有限公司 Memory test method and device and electronic equipment
CN106844159A (en) * 2017-02-03 2017-06-13 广东欧珀移动通信有限公司 A kind of information acquisition method, device and intelligent terminal
CN107346266A (en) * 2017-06-09 2017-11-14 烽火通信科技股份有限公司 Memory Allocation information tracking method and device based on vxworks operating system
CN109933517A (en) * 2017-12-19 2019-06-25 成都鼎桥通信技术有限公司 Test method, device and equipment based on android system
CN108377292A (en) * 2018-01-30 2018-08-07 努比亚技术有限公司 Solve method, terminal, server and the computer storage media of RAM leakage
CN111984541A (en) * 2020-08-31 2020-11-24 北京达佳互联信息技术有限公司 Memory leak detection method and device and terminal

Also Published As

Publication number Publication date
CN105373479B (en) 2019-03-15

Similar Documents

Publication Publication Date Title
CN105373479A (en) Automatic test method and device of memory leakage and mobile terminal
CN106934376B (en) A kind of image-recognizing method, device and mobile terminal
CN104991847B (en) A kind of RAM leakage automated detection method, device and mobile terminal
CN105205494B (en) Similar pictures recognition methods and device
CN107329750A (en) The recognition methods of advertisement page, jump method and mobile terminal in application program
CN109062809A (en) Method for generating test case, device and electronic equipment on a kind of line
CN108874268B (en) User behavior data acquisition method and device
CN105868105A (en) Application traversal testing method and device, and mobile terminal
CN105975391B (en) One kind restarting test method, equipment and mobile terminal
CN105512033B (en) A kind of automated testing method of mobile terminal, device and mobile terminal
CN106126424B (en) A kind of visual automated testing method of script, device and mobile terminal
WO2018103402A1 (en) Wireless fidelity (wifi) scan method and related product
TWI490498B (en) Method, system, and non-transitory computer-readable medium for determining device body location and switching transmitting power level
CN106357480B (en) Method and device for monitoring network performance of application and mobile terminal
WO2018121582A1 (en) Script generation method and device
CN106258009A (en) A kind of gather the method for fingerprint, fingerprint capturer and terminal
CN108509348B (en) System aging test method and mobile terminal
CN110366100A (en) Localization method, positioning device, readable storage medium storing program for executing and the terminal device of terminal
CN106484614A (en) A kind of method of verification picture processing effect, device and mobile terminal
KR102340251B1 (en) Method for managing data and an electronic device thereof
CN104077050A (en) Terminal operating method
CN109062648B (en) Information processing method and device, mobile terminal and storage medium
CN106294123B (en) The matched method, device and mobile terminal in path in a kind of test of traversal
CN110188659B (en) Health detection method and related product
CN105898053B (en) A kind of communications records processing equipment, method and mobile terminal

Legal Events

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