CN111552623B - Method and device for determining page memory consumption - Google Patents

Method and device for determining page memory consumption Download PDF

Info

Publication number
CN111552623B
CN111552623B CN202010365023.8A CN202010365023A CN111552623B CN 111552623 B CN111552623 B CN 111552623B CN 202010365023 A CN202010365023 A CN 202010365023A CN 111552623 B CN111552623 B CN 111552623B
Authority
CN
China
Prior art keywords
page
application program
target
target page
memory consumption
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010365023.8A
Other languages
Chinese (zh)
Other versions
CN111552623A (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.)
Hanhai Information Technology Shanghai Co Ltd
Original Assignee
Hanhai Information Technology Shanghai 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 Hanhai Information Technology Shanghai Co Ltd filed Critical Hanhai Information Technology Shanghai Co Ltd
Priority to CN202010365023.8A priority Critical patent/CN111552623B/en
Publication of CN111552623A publication Critical patent/CN111552623A/en
Application granted granted Critical
Publication of CN111552623B publication Critical patent/CN111552623B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3452Performance evaluation by statistical analysis

Abstract

The application provides a method and a device for determining page memory consumption. The method is applied to terminal equipment of an android operating system and comprises the following steps: determining a plurality of target pages to be calculated in an application program; opening each target page, and calculating the repeated opening times of each target page before the application program crashes; sequencing the target pages according to the repeated opening times of each target page; and determining the target page with the minimum repeatable opening frequency as the page with the highest memory consumption in the application program. By the method and the device, the memory consumption of the page level in the android application program can be determined.

Description

Method and device for determining page memory consumption
Technical Field
The application relates to the technical field of Internet, in particular to a method and a device for determining page memory consumption.
Background
In terminal devices of Android (Android) operating systems, how to calculate the memory consumption of pages (activities) has been a challenge. The Google (Google) company, which is a provider of the Android operating system, does not design a computing mechanism for memory consumption at the page level. Therefore, a solution for determining page memory consumption in an android operating system is needed.
Disclosure of Invention
In view of the above, the present application provides a method and apparatus for determining page memory consumption, and an electronic device. The method and the device are used for solving the problem that the android operating system cannot determine the memory consumption of the page level.
Specifically, the application is realized by the following technical scheme:
in a first aspect, a method for determining page memory consumption is provided, and the method is applied to terminal equipment of an android operating system, and includes:
determining a plurality of target pages to be calculated in an application program;
opening each target page, and calculating the repeated opening times of each target page before the application program crashes;
sequencing the target pages according to the repeatable opening times of each target page so as to determine the memory consumption of the target pages; the more the number of times of repeatable opening, the smaller the page memory consumption, and the fewer the number of times of repeatable opening, the more the page memory consumption.
Optionally, the opening each target page, and calculating the number of times that each target page can be repeatedly opened before the application program crashes, specifically includes the following processing for each target page:
initializing the count value of the target page to 0;
opening a target page, simulating operation behaviors of a user in the opened target page, and detecting whether an application program corresponding to the target page triggers breakdown caused by memory overflow or not;
if not, adding one to the count, and re-executing the previous step;
if so, a count value is output, and the count value is determined as the number of times the target page can be repeatedly opened.
Optionally, the simulating the operation behavior of the user includes: and simulating the user to slide up, down, left and right in the target page.
Optionally, the method further comprises:
when the memory occupied by the application program is monitored to exceed a threshold value, acquiring the number of times of repeated opening corresponding to the opened page of the application program;
and determining the opened page with the smallest repeatable opening frequency as the opened page with the largest memory consumption in the application program.
Optionally, the method further comprises:
and sequentially closing the opened pages with the most memory consumption in the application program until the memory occupied by the application program does not exceed a threshold value.
In a second aspect, a device for determining page memory consumption is provided, and the device is applied to a terminal device of an android operating system, and includes:
the determining unit is used for determining a plurality of target pages to be calculated in the application program;
the computing unit is used for opening each target page and computing the number of times that each target page can be repeatedly opened before the application program crashes;
the ordering unit is used for ordering the target pages according to the repeatable opening times of each target page so as to determine the memory consumption of the target pages; the more the number of times of repeatable opening, the smaller the page memory consumption, and the fewer the number of times of repeatable opening, the more the page memory consumption.
Optionally, the computing unit includes:
an initializing subunit, initializing the count value of the target page to be 0;
the simulation operation subunit opens a target page, simulates operation behaviors of a user in the opened target page, and detects whether an application program corresponding to the target page triggers breakdown caused by memory overflow or not;
a circulation subunit, if not, adding one to the count, and re-executing the previous step;
and the output subunit outputs a count value, and determines the count value as the number of times that the target page can be repeatedly opened.
Optionally, the simulating the operation behavior of the user includes: and simulating the user to slide up, down, left and right in the target page.
Optionally, the apparatus further includes:
the monitoring subunit is used for acquiring the number of times of repeated opening corresponding to the opened page of the application program when the fact that the memory occupied by the application program exceeds a threshold value is monitored;
and the determining subunit determines the opened page with the smallest repeatable opening frequency as the opened page with the largest memory consumption in the application program.
Optionally, the apparatus further includes:
and closing the sub-units, namely sequentially closing the opened pages with the most consumed memory in the application program until the memory occupied by the application program does not exceed a threshold value.
In a third aspect, an electronic device is provided, comprising:
a processor;
a memory for storing processor-executable instructions;
the processor is configured to determine the page memory consumption method of any of the above.
The embodiment of the application provides a scheme for determining page memory consumption, and aims to determine page-level memory consumption conditions in an android application program. Specifically, the number of times that each target page in the application program can be repeatedly opened before the application program crashes is calculated; the more the number of times of repeatable opening is, the smaller the page memory consumption is, and the fewer the number of times of repeatable opening is, the more the page memory consumption is; the memory consumption of each target page can be measured laterally.
Drawings
FIG. 1 is a flow chart illustrating a method of determining page memory consumption in accordance with an exemplary embodiment of the present application;
FIG. 2 is a flow chart illustrating the calculation of the number of times each target page can be repeatedly opened before the application crashes, in accordance with an exemplary embodiment of the present application;
FIG. 3 is a hardware configuration diagram of an apparatus for determining page memory consumption according to an exemplary embodiment of the present application;
fig. 4 is a block diagram illustrating an apparatus for determining page memory consumption according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The manner described in the following exemplary embodiments does not represent all manners consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
As mentioned above, the android operating system provided by google corporation has no mechanism for memory consumption at the page level. This results in an inability to locate which page or pages open when the application is too high in memory. Furthermore, pages with high memory consumption cannot be closed or optimized in a targeted manner to alleviate the risk of application program crashes.
To this end, the present application provides a flowchart of a method for determining page memory consumption, which is shown in an exemplary embodiment of fig. 1, and the method may be applied to a terminal device of an android operating system, and the method may specifically include the following steps:
step 110: and determining a plurality of target pages to be calculated in the application program.
Wherein, the target pages can be part or all of pages in the application program.
Step 120: and opening each target page, and calculating the number of times that each target page can be repeatedly opened before the application program crashes.
After determining a number of target pages to be calculated, the following steps need to be performed for each target page based on the process flow shown in fig. 2:
step A1: initializing the count value of the target page to 0;
step A2: opening a target page, simulating operation behaviors of a user in the opened target page, and detecting whether an application program corresponding to the target page triggers breakdown caused by memory overflow or not;
step A3: if not, adding one to the count, and re-executing the previous step A2;
step A4: if so, a count value is output, and the count value is determined as the number of times the target page can be repeatedly opened.
Wherein the simulating the operation behavior of the user comprises: and simulating the user to slide up, down, left and right in the target page.
Step 130: sequencing the target pages according to the repeatable opening times of each target page so as to determine the memory consumption of the target pages; the more the number of times of repeatable opening, the smaller the page memory consumption, and the fewer the number of times of repeatable opening, the more the page memory consumption.
In the above embodiment, the number of times that each target page in the application program can be repeatedly opened before the application program crashes is calculated; the more the number of times of repeatable opening is, the smaller the page memory consumption is, and the fewer the number of times of repeatable opening is, the more the page memory consumption is; the memory consumption of each target page can be measured sideways by an index of the number of repeatable openings. In addition, the target pages are ordered according to the sequence of the number of times each target page can be repeatedly opened. The sorting can be from big to small, or from small to big, and can be flexibly configured according to requirements. In a word, the target pages with high memory consumption can be sequentially positioned according to the sequencing result.
Further, when it is monitored that the memory occupied by the application program exceeds a threshold, the number of times of repeatable opening corresponding to the opened page of the application program can be obtained.
And then, determining the opened page with the smallest repeatable opening frequency as the opened page with the largest memory consumption in the application program.
And sequentially closing the opened pages with the most consumed memory in the application program (after closing the opened pages with the most consumed memory at present each time, the closed pages are not opened pages any more, so that the opened pages with the most consumed memory are automatically changed into the opened pages with the most consumed memory for a plurality of times) until the memory occupied by the application program does not exceed a threshold value.
Through the above embodiment, when the application program occupies too high memory, the terminal device can quickly locate the opened page (i.e., the opened page with the smallest number of times of being opened repeatedly) that causes the application program to occupy too high memory. And closing the opened page with the most memory consumption in the application program, so as to quickly relieve the risk of memory overflow and breakdown of the application program.
The application also provides an embodiment of the device for determining page memory consumption, corresponding to the embodiment of the method for determining page memory consumption.
The embodiment of the device for determining page memory consumption can be applied to a server. The apparatus embodiments may be implemented by software, or may be implemented by hardware or a combination of hardware and software. Taking software implementation as an example, the device in a logic sense is formed by reading corresponding computer program instructions in a nonvolatile memory into a memory by a processor where the device is located. In terms of hardware, as shown in fig. 3, a hardware structure diagram of the device for determining page memory consumption according to the present application is shown, and in addition to the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 3, in the embodiment, other hardware may be included according to the actual function of determining page memory consumption, which is not described herein.
Referring to fig. 4, in a software embodiment, the device for determining page memory consumption corresponds to the embodiment of fig. 1, and is applied to a terminal device of an android operating system, where the device for determining page memory consumption may specifically include:
the determining unit is used for determining a plurality of target pages to be calculated in the application program;
the computing unit is used for opening each target page and computing the number of times that each target page can be repeatedly opened before the application program crashes;
the ordering unit is used for ordering the target pages according to the repeatable opening times of each target page so as to determine the memory consumption of the target pages; the more the number of times of repeatable opening, the smaller the page memory consumption, and the fewer the number of times of repeatable opening, the more the page memory consumption.
Optionally, the computing unit includes:
an initializing subunit, initializing the count value of the target page to be 0;
the simulation operation subunit opens a target page, simulates operation behaviors of a user in the opened target page, and detects whether an application program corresponding to the target page triggers breakdown caused by memory overflow or not;
a circulation subunit, if not, adding one to the count, and re-executing the previous step;
and the output subunit outputs a count value, and determines the count value as the number of times that the target page can be repeatedly opened.
Optionally, the simulating the operation behavior of the user includes: and simulating the user to slide up, down, left and right in the target page.
Optionally, the apparatus further includes:
the monitoring subunit is used for acquiring the number of times of repeated opening corresponding to the opened page of the application program when the fact that the memory occupied by the application program exceeds a threshold value is monitored;
and the determining subunit determines the opened page with the smallest repeatable opening frequency as the opened page with the largest memory consumption in the application program.
Optionally, the apparatus further includes:
and closing the sub-units, namely sequentially closing the opened pages with the most consumed memory in the application program until the memory occupied by the application program does not exceed a threshold value.
The implementation process of the functions and roles of each unit in the above device is specifically shown in the implementation process of the corresponding steps in the above method, and will not be described herein again.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present application. Those of ordinary skill in the art will understand and implement the present application without undue burden.
Fig. 4 above describes the internal functional modules and structural schematic of the apparatus for determining page memory consumption, and the substantial execution body thereof may be an electronic device, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to determine the page memory consumption of any of the preceding methods.
In the above embodiment of the electronic device, it should be understood that the processor may be a central processing unit (english: central Processing Unit, abbreviated as CPU), or may be other general purpose processors, digital signal processors (english: digital Signal Processor, abbreviated as DSP), application specific integrated circuits (english: application Specific Integrated Circuit, abbreviated as ASIC), or the like. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc., and the aforementioned memory may be a read-only memory (ROM), a random access memory (random access memory, RAM), a flash memory, a hard disk, or a solid state disk. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in the processor for execution.
The embodiments of the present application are described in a progressive manner, and the same and similar parts of the embodiments are all referred to each other, and each embodiment is mainly described in the differences from the other embodiments. In particular, for the electronic device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments in part.
The foregoing description of the preferred embodiments of the application is not intended to be limiting, but rather to enable any modification, equivalent replacement, improvement or the like to be made within the spirit and principles of the application.

Claims (4)

1. The method for determining page memory consumption is characterized by being applied to terminal equipment of an android operating system, and comprises the following steps:
determining a plurality of target pages to be calculated in an application program;
opening each target page, and calculating the repeated opening times of each target page before the application program crashes;
sequencing the target pages according to the repeatable opening times of each target page so as to determine the memory consumption of the target pages; the more the number of times of repeatable opening, the smaller the page memory consumption, the fewer the number of times of repeatable opening, and the more the page memory consumption;
opening each target page, and calculating the repeated opening times of each target page before the application program crashes, wherein the steps comprise the following steps of:
initializing the count value of the target page to 0;
opening a target page, simulating operation behaviors of a user in the opened target page, and detecting whether an application program corresponding to the target page triggers breakdown caused by memory overflow or not;
if not, adding one to the count, and re-executing the previous step;
if yes, outputting a count value, and determining the count value as the number of times that the target page can be repeatedly opened;
the simulating the operation behavior of the user comprises the following steps: and simulating the user to slide up, down, left and right in the target page.
2. The method according to claim 1, wherein the method further comprises:
when the memory occupied by the application program is monitored to exceed a threshold value, acquiring the number of times of repeated opening corresponding to the opened page of the application program;
and determining the opened page with the smallest repeatable opening frequency as the opened page with the largest memory consumption in the application program.
3. The method according to claim 2, wherein the method further comprises:
and sequentially closing the opened pages with the most memory consumption in the application program until the memory occupied by the application program does not exceed a threshold value.
4. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
the processor being configured to the method of any of the preceding claims 1-3.
CN202010365023.8A 2020-04-30 2020-04-30 Method and device for determining page memory consumption Active CN111552623B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010365023.8A CN111552623B (en) 2020-04-30 2020-04-30 Method and device for determining page memory consumption

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010365023.8A CN111552623B (en) 2020-04-30 2020-04-30 Method and device for determining page memory consumption

Publications (2)

Publication Number Publication Date
CN111552623A CN111552623A (en) 2020-08-18
CN111552623B true CN111552623B (en) 2023-10-27

Family

ID=72006274

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010365023.8A Active CN111552623B (en) 2020-04-30 2020-04-30 Method and device for determining page memory consumption

Country Status (1)

Country Link
CN (1) CN111552623B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105740122A (en) * 2016-01-26 2016-07-06 广东欧珀移动通信有限公司 Method and system for monitoring mobile phone memory leak
CN106681926A (en) * 2017-01-05 2017-05-17 网易(杭州)网络有限公司 Method and device for testing webpage performances
CN109240912A (en) * 2018-08-14 2019-01-18 平安普惠企业管理有限公司 A kind of performance estimating method and terminal of the web application based on big data analysis
CN109542689A (en) * 2018-11-30 2019-03-29 努比亚技术有限公司 Applied program processing method, terminal and computer readable storage medium
CN109726069A (en) * 2018-05-07 2019-05-07 平安普惠企业管理有限公司 H5 page EMS memory occupation monitoring method, device, equipment and readable storage medium storing program for executing
CN110569182A (en) * 2019-09-19 2019-12-13 北京博睿宏远数据科技股份有限公司 collapse rate calculation method and device, computer equipment and storage medium
CN110851294A (en) * 2019-10-10 2020-02-28 上海上湖信息技术有限公司 Method and device for remedying program operation breakdown
CN110990258A (en) * 2019-10-29 2020-04-10 贝壳技术有限公司 Android system-based APP testing method and device, readable storage medium and processor
CN111026648A (en) * 2019-11-21 2020-04-17 汉海信息技术(上海)有限公司 Application program page testing method and device, electronic equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101022882B1 (en) * 2009-06-12 2011-03-16 주식회사 하이닉스반도체 Operating method of nonvolatile memory device
CN105759938B (en) * 2016-02-18 2019-02-19 西安三星电子研究有限公司 The power-economizing method and equipment of mobile terminal

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105740122A (en) * 2016-01-26 2016-07-06 广东欧珀移动通信有限公司 Method and system for monitoring mobile phone memory leak
CN106681926A (en) * 2017-01-05 2017-05-17 网易(杭州)网络有限公司 Method and device for testing webpage performances
CN109726069A (en) * 2018-05-07 2019-05-07 平安普惠企业管理有限公司 H5 page EMS memory occupation monitoring method, device, equipment and readable storage medium storing program for executing
CN109240912A (en) * 2018-08-14 2019-01-18 平安普惠企业管理有限公司 A kind of performance estimating method and terminal of the web application based on big data analysis
CN109542689A (en) * 2018-11-30 2019-03-29 努比亚技术有限公司 Applied program processing method, terminal and computer readable storage medium
CN110569182A (en) * 2019-09-19 2019-12-13 北京博睿宏远数据科技股份有限公司 collapse rate calculation method and device, computer equipment and storage medium
CN110851294A (en) * 2019-10-10 2020-02-28 上海上湖信息技术有限公司 Method and device for remedying program operation breakdown
CN110990258A (en) * 2019-10-29 2020-04-10 贝壳技术有限公司 Android system-based APP testing method and device, readable storage medium and processor
CN111026648A (en) * 2019-11-21 2020-04-17 汉海信息技术(上海)有限公司 Application program page testing method and device, electronic equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Martin Maas 等.Learning-based Memory Allocation for C++ Server Workloads.《ASPLOS '20: Proceedings of the Twenty-Fifth International Conference on Architectural Support for Programming Languages and Operating Systems》.2020,第2020年卷第541–556页. *
曾文韬.Android APP自动化专项测试工具的设计与实现.《中国优秀硕士学位论文全文数据库信息科技辑》.2019,第2019年卷(第9期),第I138-428页. *

Also Published As

Publication number Publication date
CN111552623A (en) 2020-08-18

Similar Documents

Publication Publication Date Title
CN103282891B (en) For using neural network to carry out the system and method for effective buffer memory
EP1835426A1 (en) Estimating software power consumption
US10243967B2 (en) Method, apparatus and system for detecting fraudulant software promotion
CN110619210A (en) Simulator detection method and system
CN109240912B (en) Webpage application performance evaluation method and terminal based on big data analysis
CN111241389A (en) Sensitive word filtering method and device based on matrix, electronic equipment and storage medium
CN110188862B (en) Searching method, device and system for model hyper-parameters for data processing
CN106033574B (en) Method and device for identifying cheating behaviors
CN110633211A (en) Multi-interface testing method, device, server and medium
Barboza et al. Automatic microprocessor performance bug detection
CN109634822B (en) Function time consumption statistical method and device, storage medium and terminal equipment
CN111552623B (en) Method and device for determining page memory consumption
CN113946983A (en) Method and device for evaluating weak links of product reliability and computer equipment
US7353477B2 (en) Method of identifying paths with delays dominated by a particular factor
CN110198299B (en) Intrusion detection method and device
CN116166967A (en) Data processing method, equipment and storage medium based on meta learning and residual error network
CN111858108A (en) Hard disk fault prediction method and device, electronic equipment and storage medium
CN110704614A (en) Information processing method and device for predicting user group type in application
CN111898626B (en) Model determination method and device and electronic equipment
CN114998707A (en) Attack method and device for evaluating robustness of target detection model
CN115203556A (en) Score prediction model training method and device, electronic equipment and storage medium
CN113569953A (en) Training method and device of classification model and electronic equipment
CN113221119A (en) Embedded processor branch prediction vulnerability detection method, computer device and medium
CN113905400B (en) Network optimization processing method and device, electronic equipment and storage medium
US7650579B2 (en) Model correspondence method and device

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