CN109656779A - Internal memory monitoring method, device, terminal and storage medium - Google Patents
Internal memory monitoring method, device, terminal and storage medium Download PDFInfo
- Publication number
- CN109656779A CN109656779A CN201811495091.5A CN201811495091A CN109656779A CN 109656779 A CN109656779 A CN 109656779A CN 201811495091 A CN201811495091 A CN 201811495091A CN 109656779 A CN109656779 A CN 109656779A
- Authority
- CN
- China
- Prior art keywords
- memory
- application program
- information
- memory information
- abnormal
- 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.)
- Pending
Links
- 230000015654 memory Effects 0.000 title claims abstract description 424
- 238000000034 method Methods 0.000 title claims abstract description 76
- 238000012544 monitoring process Methods 0.000 title claims abstract description 46
- 238000003860 storage Methods 0.000 title claims abstract description 18
- 238000013507 mapping Methods 0.000 claims abstract description 65
- 230000002159 abnormal effect Effects 0.000 claims abstract description 64
- 238000012806 monitoring device Methods 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 3
- 238000004321 preservation Methods 0.000 abstract description 5
- 230000006870 function Effects 0.000 description 47
- 101000771640 Homo sapiens WD repeat and coiled-coil-containing protein Proteins 0.000 description 12
- 102100029476 WD repeat and coiled-coil-containing protein Human genes 0.000 description 12
- 238000010586 diagram Methods 0.000 description 8
- 238000012545 processing Methods 0.000 description 8
- 230000006399 behavior Effects 0.000 description 3
- 238000013461 design Methods 0.000 description 3
- 239000011800 void material Substances 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 238000005315 distribution function Methods 0.000 description 2
- 230000012010 growth Effects 0.000 description 2
- 238000002347 injection Methods 0.000 description 2
- 239000007924 injection Substances 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 235000013399 edible fruits Nutrition 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000007717 exclusion Effects 0.000 description 1
- 230000014759 maintenance of location Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 239000000243 solution Substances 0.000 description 1
- 230000004083 survival effect Effects 0.000 description 1
- 230000033772 system development Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
- G06F11/3037—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a memory, e.g. virtual memory, cache
Landscapes
- Engineering & Computer Science (AREA)
- Computing Systems (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- Quality & Reliability (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a kind of internal memory monitoring method, device, terminal and storage mediums, it is necessary first to obtain memory information when application program operation;Then memory information is mapped in disk file;When application program memory abnormal, corresponding mapping memory information is sent, mapping memory information is for determining the application program to the abnormal position in memory.Memory information is mapped in disk file in such a way that memory maps i.e. in the present embodiment, release the memory of terminal, it can not be persistently stored to solve memory information in the prior art, and the problem of occupying the physical memory resource of terminal, allow the preservation that memory information is permanent, and it is not take up memory source, it is easy to use.
Description
Technical field
The present embodiments relate to field of communication technology more particularly to a kind of internal memory monitoring method, device, terminal and storages
Medium.
Background technique
Memory management is extremely important, efficient Memory Allocation, release and arrangement in the design of intelligent terminal system
Oneself is more and more important in the application.The intelligent terminal system development phase, there are many tools of internal memory monitoring, such as: Xcode
The systems such as Memory Graph, Insturment Allocation, VM Tracker, vmmap, leak carry tool.However,
Above-mentioned internal memory monitoring tool is only limited to developer and debugs use.
In intelligent terminal use process, often there is the memory abnormal problem as caused by some maloperations, when serious
It will lead to intelligent terminal crash, therefore, by internal memory monitoring means come auxiliary examination application program (Application, APP) fortune
Memory use state between the departure date is particularly important.Although internal memory monitoring method in the prior art can monitor region of memory
The address of survival object, size, stack information, can also export when memory uses more than given threshold and be uploaded to server.
However, the memory information recorded in existing internal memory monitoring method can not be persistently stored, APP before APP can not be saved after exiting
Memory information when operation, and occupy the physical memory resource of mobile terminal.
Summary of the invention
In view of this, the present invention provides a kind of internal memory monitoring method, device, terminal and storage medium, solves existing skill
Memory information can not be persistently stored in art, and the problem of occupy the physical memory resource of mobile terminal.
In a first aspect, the embodiment of the invention provides a kind of internal memory monitoring methods, comprising:
Obtain memory information when application program operation;
The memory information is mapped in disk file;
When the application program memory abnormal, corresponding mapping memory information is sent, the mapping memory information is for true
The fixed application program is to the abnormal position in memory.
Further, memory information when application program operation is obtained, comprising:
Memory information when application program operation is obtained by hook tool.
It is further, described that the memory information is mapped in disk file, comprising:
The memory information is mapped in disk file using EMS memory mappings method.
Specifically, the application program memory abnormal includes:
Memory information when memory information and the application program when application program launching exit is not identical.
Specifically, the application program memory abnormal further include:
When application program launching, detects that application program last time exits and exited to be abnormal.
Specifically, it includes: that system memory resource exhausts currently running application program is caused to be forced that the exception, which exits,
It exits.
Specifically, the memory information includes at least: memory address, memory size, memory storehouse and region of memory title
One of.
Second aspect, the embodiment of the invention also provides a kind of internal memory monitoring devices, comprising:
Module is obtained, for obtaining memory information when application program operation;
Mapping block, for the memory information to be mapped in disk file;
Sending module sends corresponding mapping memory information when being used for the application program memory abnormal, in the mapping
Information is deposited for determining the application program to the abnormal position in memory.
Specifically, the acquisition module, specifically for obtaining memory information when application program operation by hook tool.
Specifically, the mapping block, specifically for the memory information is mapped to disk using EMS memory mappings method
In file.
Further, the application program memory abnormal includes:
Memory information when memory information and the application program when application program launching exit is not identical.
Further, the application program memory abnormal further include:
When application program launching, detects that application program last time exits and exited to be abnormal.
Further, it includes: that system memory resource exhausts and causes currently running application program strong that the exception, which exits,
System exits.
Specifically, the memory information includes at least: memory address, memory size, memory storehouse and region of memory title
One of.
The third aspect, the embodiment of the invention also provides a kind of terminal, the terminal includes:
One or more processors;
Memory, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processing
Device realizes the internal memory monitoring method as described in first aspect.
Fourth aspect, the embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computer
Program realizes internal memory monitoring method as described in relation to the first aspect when the program is executed by processing unit.
Internal memory monitoring method, device, terminal and the storage medium provided in above-described embodiment, it is necessary first to obtain and apply journey
Memory information when sort run;Then memory information is mapped in disk file;When application program memory abnormal, transmission pair
The mapping memory information answered, mapping memory information is for determining the application program to the abnormal position in memory.That is this implementation
Memory information is mapped in disk file in such a way that memory maps in example, the memory of terminal is released, to solve
Memory information can not be persistently stored in the prior art, and the problem of occupy the physical memory resource of mobile terminal.So that memory
Information can be permanent preservation, and be not take up memory source, it is easy to use.
Detailed description of the invention
Fig. 1 is the flow chart of the internal memory monitoring method in the embodiment of the present invention one;
Fig. 2 is the flow chart of the internal memory monitoring method in the embodiment of the present invention two;
Fig. 3 is the structural schematic diagram of the memory mapping in the embodiment of the present invention two;
Fig. 4 is the schematic diagram of the memory change curve in the embodiment of the present invention two;
Fig. 5 is the structural schematic diagram of the apparatus for processing audio in the embodiment of the present invention three;
Fig. 6 is the structural schematic diagram of one of the embodiment of the present invention four terminal.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to just
Only the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Embodiment one
Fig. 1 is the flow chart of the internal memory monitoring method in the embodiment of the present invention one.The present embodiment is applicable to monitoring memory
The case where behaviour in service, internal memory monitoring method provided in this embodiment can be executed by internal memory monitoring device, internal memory monitoring dress
Setting can be realized by way of software and/or hardware.The device of set memory monitoring is integrated in the terminal, i.e. internal memory monitoring
Method is executed by terminal.Above-mentioned terminal, which refers to have to input program and data to computer or receive computer output, handles knot
The equipment of fruit function.Above-mentioned terminal includes but is not limited to laptop, smart phone, tablet computer, portable media broadcasting
The mobile terminals such as device, navigation device, wearable device, Intelligent bracelet and pedometer and number TV, desktop computer etc. are fixed
Terminal.
Specifically, as shown in Figure 1, the method for internal memory monitoring provided in an embodiment of the present invention, mainly includes the following steps:
Memory information when S110, acquisition application program operation.
It should be noted that memory is and the central processing unit (Central Processing Unit, CPU) in terminal
The bridge linked up.The operation of all programs all carries out in memory in terminal, therefore the performance of memory is to terminal
It influences very big.Memory is mainly used for temporarily storing the operational data in CPU, and exchanged with external memories such as hard disks
Data.As long as terminal is in operation, CPU will be transferred to the data for needing operation in memory and carry out operation, after the completion of operation
CPU again sends out result, and the use state of memory also determines the stable operation of computer.Further, memory information
Refer to the data information of reaction memory operating status, such as: memory information includes at least: memory address, memory size, heap
The combination of one of stack and region of memory title or at least the two.
In the present embodiment, memory information when obtaining application program operation refers to injection hook work in the application
Tool, hook tool are HOOK tool, memory information when being run by HOOK tool records application program.HOOK refers to monitoring letter
The behavior that number calls.Preferably, the process for injecting HOOK tool is Dynamic injection process, and there is no the source generations for changing application program
Code.Terminal only need to inject in the application HOOK tool can the EMS memory occupation situation to application program record, this
Sample, the source code that terminal is not necessarily to obtain application program can realize real-time record to system memory space.
It should be noted that can capture the event that process or other processes occur by HOOK tool.Of the invention real
Apply in example HOOK tool and realize writing function, for records application program in the process of running occupied terminal memory the case where.
It should be noted that only being said to the mode of memory information when obtaining application program operation in the present embodiment
It is bright, and it is non-limiting, and can according to need design, other obtain the mode of memory information.
S120, memory information is mapped in disk file.
In the present embodiment, disk file is the file of lane terminal, what the information stored in disk file was not powered off
It influences, and the capacity of disk is big, can store a large amount of information.
In the present embodiment, it before memory information is mapped in disk file, needs to obtain memory and disk file
Mapping relations.If the memory information when application program operation of HOOK tool records, reflecting for memory and disk file is obtained
Relationship is penetrated, according to mapping relations and memory information, corresponding mapping memory information is generated, by mapping memory information in disk file
In stored.Make to exit even if application exception in this way, can also reacquire when last application program is run
Internal storage state.
Further, memory information is mapped in disk file by the way of MMAP, i.e. memory and disk file
The mapping memory information that mapping relations generate is MMAP data structure.The mode of MMAP is that memory information is mapped to multiple pages
On, if the sum of the size of the not all page of the size of memory information, the space being not used in the last one page will be clear
Zero.
When S130, application program memory abnormal, corresponding mapping memory information is sent, mapping memory information is answered for determination
With program to the abnormal position in memory.
In the present embodiment, application program memory abnormal refers to application program in the process of running, and terminal memory occurs different
Normal state, illustratively, memory abnormal include: RAM leakage, committed memory size abnormal growth etc..Further, work as application
It when program starts, detects that last time application program is improper and exits, then in corresponding mapping when running last time application program
Information is deposited to be sent.Alternatively, when the internal storage state to application program detects, after detecting application program before testing
The case where there are memory growths, then the case where increasing memory, send.For the detection method of application program memory abnormal,
In the present embodiment without limitation, it can according to need the suitable memory abnormal detection mode of design.
If detecting application program memory abnormal, the mapping memory information in the corresponding period is sent.At this
In embodiment, mapping memory information can be sent to server, by server come the reason of analyzing memory abnormal, positioning occurs
The position of memory abnormal allows developer to be updated and correct application program.In addition it is also possible to which memory will be mapped
The reason of information is sent to the terminal of developer, analyzes memory abnormal by developer, the position of memory abnormal occurs for positioning.
The internal memory monitoring method provided in the present embodiment, it is necessary first to obtain memory information when application program operation;So
Memory information is mapped in disk file afterwards;When application program memory abnormal, corresponding mapping memory information is sent, is mapped
Memory information is for determining the application program to the abnormal position in memory.I.e. in the present embodiment in such a way that memory maps
Memory information is mapped in disk file, the memory of terminal is released, so that solving memory information in the prior art can not
The problem of being persistently stored, and occupying the physical memory resource of mobile terminal, allows the preservation that memory information is permanent, and not
Committed memory resource, it is easy to use.
Embodiment two
Fig. 2 is the flow chart of the internal memory monitoring method in the embodiment of the present invention two;The present embodiment has advanced optimized memory
Monitoring method, as shown in Fig. 2, the internal memory monitoring method after optimization, mainly includes the following steps:
S210, by hook tool obtain application program operation when memory information.
In the present embodiment, hook tool is HOOK tool, can capture process by HOOK tool or other processes are sent out
Raw event.HOOK tool realizes writing function in embodiments of the present invention, whole in the process of running for records application program
The memory situation at end.
In the present embodiment, deposit inside be allocated and discharge operation when, record memory information.Further, for interior
The operation deposited specifically includes that malloc function, calloc function, realloc function, free or delete function and new function
Deng.The function of memory is simply introduced below.
Malloc function, i.e. memory allocation are dynamic memory distribution functions, continuous for one piece of application
The memory block region of specified size returns to the region of memory address of distribution with void* type.If Memory Allocation success, return refer to
To the pointer of assigned memory, null pointer is otherwise returned.Only one parameter of malloc function, that is, the memory headroom to be distributed
Size.Such as: void*malloc (size_t size).The block address memory that malloc is returned all is 8 multiple, if 64
System, then for 16 multiple.
Calloc function is also dynamic memory distribution function, is for distributing n length in the dynamic area of memory
The continuous space of size, function return to the pointer for being directed toward distribution initial address;If distribution is unsuccessful, null pointer is returned.
There are two parameter, the respectively size of the number of element and each element, the products of the two parameters to seek to for calloc function
The size of the memory headroom of distribution.Such as: void*calloc (size_t n, size_t size).
Realloc function, i.e. reset allocation, dynamic memory Tuning function, realloc function are mainly used for elder generation
Judge whether current pointer there are enough continuous spaces, if so, expanding the address that mem_address is directed toward, and will
Mem_address is returned, if space is inadequate, from the beginning the size allocation space first specified according to newsize arrives legacy data
Tail copies newly assigned region of memory to, then discharges original mem_address meaning region of memory, while returning newly assigned
The first address of region of memory.Otherwise null pointer is returned.
Free or delete function is dynamic memory deallocation function, for discharge malloc function, calloc function and
The memory headroom that realloc function is distributed to pointer variable.The pointer variable has to be directed toward null pointer again after use, prevents
Wild pointer occurs, and effectively evades maloperation.
New is equivalent to a function, after memory has opened up space, returns to the first address in this space.
To above-mentioned malloc function, calloc function, realloc function, free or delete function and new function into
Row HOOK records its distribution or memory address, memory size and memory storehouse of release etc..
S220, memory information is mapped in disk file using EMS memory mappings method.
In the present embodiment, memory mapping, which refers to, is mapped to a file for a memory information, it is preferred that memory mapping
For shared drive, i.e. this page is mapped to the address space of oneself by process A and process B, when process A is accessed in the page for the first time
Data when, it generates the terminal that skips leaf, and kernel reads in this one page to memory at this time and updates page table and be allowed to be directed toward it, with
Afterwards, when process B accesses the same page and page faults occurs, in memory, kernel is only needed the page table of process B the page
Entry is directed toward time page.
Further, in the present embodiment, realize that shared drive, MMAP to pass through mapping between process using MMAP mode
The same ordinary file realizes shared drive.After ordinary file is mapped to the process address space, process can be common as accessing
Memory equally accesses to file, it is not necessary to recall read, the operation such as write.
Fig. 3 is the structural schematic diagram of the memory mapping in the embodiment of the present invention two;As shown in figure 3, in memory headroom by
Multiple virtual memory regions are constituted.Virtual memory region is a homogeneity section in the memory headroom of process, that is, is had same
The continuation address range of characteristic.As shown in figure 3, code data section, primary data section, BSS data segment, heap, stack and memory mapping,
It is all an independent virtual memory region.It and is that the address space of memory mapping services is in the rest between storehouse.
In the present embodiment, realizes that memory maps using MMAP mode, mainly there are 3 steps using MMAP mode, firstly, into
Cheng Qidong mapping process, and one is found that is, in disk space in disk file for mapping creation memory information mapping area
The idle continuous disk address met the requirements of section distributes one _ typedef struct structure for this address, then to this
Each region of a structure is initialized, and newly-built regional structure (typedef_struct) is inserted into disk areas chained list
Or in tree.Secondly, calling function MMAP, the mapping relations one by one of file physical address and process virtual address are realized,
After as mapping is assigned with new disk address region, by memory information pointer to be mapped, in memory information
Corresponding memory information descriptor is found in descriptor table, by memory information descriptor, memory that HOOK tool has obtained
Information calls MMAP function, MMAP function locating is to memory information in memory by the memory information structural body of the memory information
In virtual address, by call function establish page table, that is, realize the mapping relations between memory address and disk areas.Most
Afterwards, process initiates the access to this piece mapping space, and the copy of disk is stored in realization.That is the read or write access time of process
This section of mapping address of disk space finds this sector address not on the page by inquiring page table.Because only establishing at present
Address of cache, real memory information copy in disk not yet, therefore cause page fault.Page fault carries out a system
Column judgement after determining without illegal operation, initiates demand paging process.Then call function that lacked page is encased in disk from main memory
In.
In this in real time example, the implementation of two kinds of MMAP data structures is provided, one is Mmap tree structures, in addition
One is Mmaplist structures.Two kinds of structures are introduced below.
Illustratively, Mmap tree structure:
typedef struct{
BSMMap Splay Tree NodeIndex rootNode;//node position for nodeIndex=
nodePage*pageSize+nodeIndex*nodeSize
BSMMapSplayTreeNodeIndex freeNode;//first free block
}BSMMapSplayTree;
By above-mentioned programming it is found that the physical location of tree interior joint in memory can be carried out by index function,
Index function can return to the value in table or region.Further, the sequence × page for the page that physical location=node is located at
Size+node return value × node size.
Further, current available node is recorded in freeNode, and enabled node can be directed toward one and can be used
Node forms chain list, records data for quickly distributing available node.
Mmap list structure:
typedef struct{
BSMMap ListIndex rootNode;//node position for nodeIndex=nodePage*
pageSize+nodeIndex*nodeSize
BSMMapListIndex freeNode;//first free block
}BSMMapList;
By above-mentioned programming it is found that the physical location of list interior joint in memory can be carried out by index function,
Index function can return to the value in table or region.Further, the sequence × page for the page that physical location=node is located at
Size+node return value × node size.
Further, current available node is recorded in freeNode, and enabled node can be directed toward one and can be used
Node forms chain list, records data for quickly distributing available node.
In the present embodiment, the mapping relations of a kind of virtual memory and disk file are provided, are determined according to mapping relations
Mapping storage structure, in the present embodiment, mapping storage structure use above two MMAP data structure, can select therein
A kind of data store organisation can also be such that two kinds of data store organisations are used cooperatively.
When S230, application program memory abnormal, corresponding mapping memory information is sent, mapping memory information is answered for determination
With program to the abnormal position in memory.
In the present embodiment, memory information and application program when application program memory abnormal includes: application program launching
Memory information when exiting is not identical.
Further, when being detected using automatic test script to application program, when to the application program launching
Memory information and memory information when exiting be compared, application program memory abnormal is determined according to comparison result.Specifically,
Memory information includes at least: one of memory address, memory size, memory storehouse and region of memory title.
Specifically, the present embodiment provides a preferred embodiment, it can by the memory in memory information when application program launching
Location is compared with the memory address in memory information when exiting, if comparing application program when application program exits in memory information
There are extra memory address in memory information when starting, then illustrate that application program memory abnormal, extra memory address are interior
Leakage address is deposited, it can be according to memory overflow address calculation memory overflow size.
Specifically, the present embodiment provides another preferred embodiment, it can be by the heap of memory information when application program launching
Stack is compared with the memory storehouse in memory information when exiting, if comparing application program when application program exits in memory information
There is the memory storehouse having more when starting in Memory Allocation information, then illustrates that application program memory abnormal, more function storehouses are
Memory overflow storehouse can calculate memory overflow size according to memory overflow storehouse.
Further, if detecting application program memory abnormal, the mapping memory information in the corresponding period is carried out
It sends.Mapping memory information can be sent to server or the terminal of developer, open personnel is facilitated to find in analysis
Abnormal reason is deposited, the position of memory abnormal occurs for positioning.
In the present embodiment, a kind of position of positioning generation memory abnormal is provided, specifically, to more memory storehouses according to right
The function address size answered is ranked up, then carries out statistic of classification to the function storehouse after sequence, show that function stack memory is let out
Leak number and memory overflow size.Specifically, more memory storehouses is classified, counts the leakage of of a sort function storehouse
Number, and calculate the memory overflow size of all memory storehouses.
Further, it is also possible to which the memory size that occupies during being run according to application program determines whether there is memory abnormal.
Further, if the memory size that application program occupies during running is more than the corresponding normal range (NR) of application program, it is determined that should
There are the situations of memory abnormal for application program.
It is pre-rendered and be recorded in the change of the memory in normal course of operation specifically, for the application program currently tested
Curve is changed, obtains normal memory fluctuation reference curve.Monitor memory change curve in current operational process in real time, and with it is normal in
It deposits fluctuation reference curve to be compared, judges whether memory change curve exceeds normal memory fluctuation reference in current operational process
The fluctuation tendency range of curve, if exceeding, it is determined that memory abnormal occurs for current application program.Fig. 4 is the embodiment of the present invention two
In memory change curve schematic diagram, as seen from Figure 4, in application program operational process, memory change curve is pre-
It is fluctuated in the range of if.If memory change curve is beyond memory change curve in preset fluctuation model in current operational process
It encloses, it is determined that memory abnormal occurs for current application program.
Further, application program memory abnormal further include: when application program launching, detect application program last time
It exits and is exited to be abnormal.Specifically, abnormal exit includes: that system memory resource exhausts and causes currently running application program strong
System exits.
Specifically, when application program launching, if detecting, the application program last time memory source that logs off exhausts
Currently running application program is caused to be forced to exit, it is determined that memory abnormal occurs for application program.Last time application program is transported
Memory information between the departure date is sent to server or developer's terminal.
Further, whether can detect application program last time by the method for exclusion and exit is abnormal exit.Tool
Body, when application program launching, the withdrawing mode of application program last time is detected, if application program is not normal logic
It exits, such as: click exit button or the preset exit criteria of triggering etc..It is different for then determining that application program last time exits
Often exit.
The internal memory monitoring method provided in the present embodiment, it is necessary first to be obtained when application program is run by hook tool
Memory information;Then the memory information is mapped in disk file using EMS memory mappings method;When application program memory is different
Chang Shi sends corresponding mapping memory information, and mapping memory information is for determining the application program to the exception bits in memory
It sets.Memory information is mapped in disk file in such a way that memory maps i.e. in the present embodiment, releases the memory of terminal,
Memory information can not be persistently stored to solving in the prior art, and the physical memory resource for occupying mobile terminal is asked
Topic.Allow the preservation that memory information is permanent, and is not take up memory source, it is easy to use.
Embodiment three
Fig. 5 is the structural schematic diagram of the internal memory monitoring device in the embodiment of the present invention three, and the present embodiment is applicable to monitor
The case where memory behaviour in service, internal memory monitoring device provided in this embodiment can be realized by way of software and/or hardware.
The device of set memory monitoring is integrated in the terminal, and the specific structure of the internal memory monitoring device is as follows:
Module 410 is obtained, for obtaining memory information when application program operation.
Mapping block 420, for the memory information to be mapped in disk file;
Sending module 430 sends corresponding mapping memory information when being used for the application program memory abnormal, described to reflect
Memory information is penetrated for determining the application program to the abnormal position in memory.
The internal memory monitoring device provided in the present embodiment, it is necessary first to obtain memory information when application program operation;So
Memory information is mapped in disk file afterwards;When application program memory abnormal, corresponding mapping memory information is sent, is mapped
Memory information is for determining the application program to the abnormal position in memory.I.e. in the present embodiment in such a way that memory maps
Memory information is mapped in disk file, the memory of terminal is released, so that solving memory information in the prior art can not
The problem of being persistently stored, and occupying the physical memory resource of mobile terminal.Allow the preservation that memory information is permanent, and not
Committed memory resource, it is easy to use.
Specifically, module 410 is obtained, specifically for obtaining memory information when application program operation by hook tool.
Specifically, mapping block 420, specifically for the memory information is mapped to disk text using EMS memory mappings method
In part.
Further, the application program memory abnormal includes:
Memory information when memory information and the application program when application program launching exit is not identical.
Further, the application program memory abnormal further include:
When application program launching, detects that application program last time exits and exited to be abnormal.
Further, it includes: that system memory resource exhausts and causes currently running application program strong that the exception, which exits,
System exits.
Specifically, the memory information includes at least: memory address, memory size, memory storehouse and region of memory title
One of.
Memory prison provided by any embodiment of the invention can be performed in internal memory monitoring device provided by the embodiment of the present invention
Prosecutor method has the corresponding functional module of execution method and beneficial effect.
Example IV
Fig. 6 is the structural schematic diagram of one of the embodiment of the present invention four terminal, as shown in fig. 6, the terminal includes processing
Device 510, memory 520, input unit 530 and output device 540;The quantity of processor 510 can be one or more in terminal
It is a, in Fig. 6 by taking a processor 510 as an example;Processor 510, memory 520, input unit 530 and output device in terminal
540 can be connected by bus or other modes, in Fig. 6 for being connected by bus.
Memory 520 is used as a kind of computer readable storage medium, can be used for storing software program, journey can be performed in computer
Sequence and module, if the corresponding program instruction/module of the internal memory monitoring method in the embodiment of the present invention is (for example, internal memory monitoring fills
Acquisition module 410, mapping block 420 and sending module 430 in setting).Processor 510 is stored in memory 520 by operation
In software program, instruction and module realized above-mentioned thereby executing the various function application and data processing of terminal
Internal memory monitoring method.
Memory 520 can mainly include storing program area and storage data area, wherein storing program area can store operation system
Application program needed for system, at least one function;Storage data area, which can be stored, uses created data etc. according to terminal.This
Outside, memory 520 may include high-speed random access memory, can also include nonvolatile memory, for example, at least one
Disk memory, flush memory device or other non-volatile solid state memory parts.In some instances, memory 520 can be into one
Step includes the memory remotely located relative to processor 510, these remote memories can pass through network connection to terminal.On
The example for stating network includes but is not limited to internet, intranet, local area network, mobile radio communication and combinations thereof.
Input unit 530 can be used for receiving the number or character information of input, and generate with the user setting of terminal with
And the related key signals input of function control.Output device 540 may include that display screen etc. shows equipment.
Example IV
The present invention implements four and also provides a kind of computer readable storage medium, is stored thereon with computer program, the program
Internal memory monitoring method is realized when being executed by processing unit, this method comprises:
Obtain memory information when application program operation;
The memory information is mapped in disk file;
When the application program memory abnormal, corresponding mapping memory information is sent, the mapping memory information is for true
The fixed application program is to the abnormal position in memory.
Certainly, a kind of storage medium comprising computer executable instructions, computer provided by the embodiment of the present invention
The internal memory monitoring method operation that executable instruction is not limited to the described above, can also be performed provided by any embodiment of the invention
Relevant operation in internal memory monitoring method
By the description above with respect to embodiment, it is apparent to those skilled in the art that, the present invention
It can be realized by software and required common hardware, naturally it is also possible to which by hardware realization, but in many cases, the former is more
Good embodiment.Based on this understanding, technical solution of the present invention substantially in other words contributes to the prior art
Part can be embodied in the form of software products, which can store in computer readable storage medium
In, floppy disk, read-only memory (Read-Only Memory, ROM), random access memory (Random such as computer
Access Memory, RAM), flash memory (FLASH), hard disk or CD etc., including some instructions are with so that a computer is set
Standby (can be personal computer, server or the network equipment etc.) executes internal memory monitoring described in each embodiment of the present invention
Method.
It is worth noting that, included each unit and module are only pressed in the embodiment of above-mentioned internal memory monitoring device
It is divided, but is not limited to the above division according to function logic, as long as corresponding functions can be realized;In addition,
The specific name of each functional unit is also only for convenience of distinguishing each other, the protection scope being not intended to restrict the invention.
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that
The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation,
It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention
It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also
It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.
Claims (10)
1. a kind of internal memory monitoring method characterized by comprising
Obtain memory information when application program operation;
The memory information is mapped in disk file;
When the application program memory abnormal, corresponding mapping memory information is sent, the mapping memory information is for determining institute
Application program is stated to the abnormal position in memory.
2. internal memory monitoring method according to claim 1, which is characterized in that obtain memory letter when application program operation
Breath, comprising:
Memory information when application program operation is obtained by hook tool.
3. internal memory monitoring method according to claim 1, which is characterized in that described that the memory information is mapped to disk
In file, comprising:
The memory information is mapped in disk file using EMS memory mappings method.
4. internal memory monitoring method according to claim 1, which is characterized in that the application program memory abnormal includes:
Memory information when memory information and the application program when application program launching exit is not identical.
5. internal memory monitoring method according to claim 1, which is characterized in that the application program memory abnormal further include:
When application program launching, detects that application program last time exits and exited to be abnormal.
6. internal memory monitoring method according to claim 5, which is characterized in that it includes: Installed System Memory money that the exception, which exits,
Source, which exhausts, causes currently running application program to be forced to exit.
7. internal memory monitoring method according to claim 1, which is characterized in that the memory information includes at least: memory
One of location, memory size, memory storehouse and region of memory title.
8. a kind of internal memory monitoring device characterized by comprising
Module is obtained, for obtaining memory information when application program operation;
Mapping block, for the memory information to be mapped in disk file;
Sending module when being used for the application program memory abnormal, sends corresponding mapping memory information, the mapping memory letter
Breath is for determining the application program to the abnormal position in memory.
9. a kind of terminal, which is characterized in that the terminal includes:
One or more processors;
Memory, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real
The now internal memory monitoring method as described in any in claim 1-7.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that program dress processed
Internal memory monitoring method as claimed in claim 1 is realized when setting execution.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811495091.5A CN109656779A (en) | 2018-12-07 | 2018-12-07 | Internal memory monitoring method, device, terminal and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811495091.5A CN109656779A (en) | 2018-12-07 | 2018-12-07 | Internal memory monitoring method, device, terminal and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109656779A true CN109656779A (en) | 2019-04-19 |
Family
ID=66112991
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811495091.5A Pending CN109656779A (en) | 2018-12-07 | 2018-12-07 | Internal memory monitoring method, device, terminal and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109656779A (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110308974A (en) * | 2019-07-11 | 2019-10-08 | 联想(北京)有限公司 | A kind of data processing method, virtual machine and virtual machine architecture |
CN110633190A (en) * | 2019-09-26 | 2019-12-31 | 北京博睿宏远数据科技股份有限公司 | Application program memory monitoring method, device, equipment and storage medium |
CN110764995A (en) * | 2019-09-05 | 2020-02-07 | 北京字节跳动网络技术有限公司 | Method, device, medium and electronic equipment for detecting file access abnormity |
CN111090536A (en) * | 2019-11-19 | 2020-05-01 | 北京字节跳动网络技术有限公司 | Method, device, medium and electronic equipment for acquiring memory leakage information |
CN111984401A (en) * | 2020-07-24 | 2020-11-24 | 五八有限公司 | Memory overflow management method and device, electronic equipment and storage medium |
CN112148441A (en) * | 2020-07-28 | 2020-12-29 | 易视飞科技成都有限公司 | Embedded message queue realizing method of dynamic storage mode |
CN113010891A (en) * | 2021-02-26 | 2021-06-22 | 中科天齐(山西)软件安全技术研究院有限公司 | Application program safety detection method and device, electronic equipment and storage medium |
CN113010890A (en) * | 2021-02-26 | 2021-06-22 | 中科天齐(山西)软件安全技术研究院有限公司 | Application program safety detection method and device, electronic equipment and storage medium |
CN113110965A (en) * | 2021-03-12 | 2021-07-13 | 北京健康之家科技有限公司 | Abnormal information monitoring method and device, computer storage medium and terminal |
CN113157513A (en) * | 2021-05-10 | 2021-07-23 | 北京字节跳动网络技术有限公司 | Heap memory damage detection method and device, electronic equipment and storage medium |
CN115277236A (en) * | 2022-08-01 | 2022-11-01 | 福建天晴在线互动科技有限公司 | Method and system for carrying out request analysis on domain name |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090327373A1 (en) * | 2008-06-30 | 2009-12-31 | International Business Machines Corporation | Method for performing memory leak analysis inside a virtual machine |
CN101739311A (en) * | 2009-12-15 | 2010-06-16 | 上海爱数软件有限公司 | Method and device for carrying out safety backup on memory data |
CN102750202A (en) * | 2012-06-06 | 2012-10-24 | 宇龙计算机通信科技(深圳)有限公司 | Data protection method and device |
CN106560796A (en) * | 2015-12-31 | 2017-04-12 | 哈尔滨安天科技股份有限公司 | Early-warning method and system for internal memory stack abnormity of intranet terminal application program |
CN106610892A (en) * | 2015-10-23 | 2017-05-03 | 腾讯科技(深圳)有限公司 | Memory leak detecting method and device |
CN107943520A (en) * | 2016-10-11 | 2018-04-20 | 腾讯科技(深圳)有限公司 | Application stack information acquisition method and device, stack information analysis method and device |
-
2018
- 2018-12-07 CN CN201811495091.5A patent/CN109656779A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090327373A1 (en) * | 2008-06-30 | 2009-12-31 | International Business Machines Corporation | Method for performing memory leak analysis inside a virtual machine |
CN101739311A (en) * | 2009-12-15 | 2010-06-16 | 上海爱数软件有限公司 | Method and device for carrying out safety backup on memory data |
CN102750202A (en) * | 2012-06-06 | 2012-10-24 | 宇龙计算机通信科技(深圳)有限公司 | Data protection method and device |
CN106610892A (en) * | 2015-10-23 | 2017-05-03 | 腾讯科技(深圳)有限公司 | Memory leak detecting method and device |
CN106560796A (en) * | 2015-12-31 | 2017-04-12 | 哈尔滨安天科技股份有限公司 | Early-warning method and system for internal memory stack abnormity of intranet terminal application program |
CN107943520A (en) * | 2016-10-11 | 2018-04-20 | 腾讯科技(深圳)有限公司 | Application stack information acquisition method and device, stack information analysis method and device |
Non-Patent Citations (1)
Title |
---|
WEIXIN_33979203: ""mmap:文件映射进内存,及window上的对应方法"", 《HTTPS://BLOG.CSDN.NET/WEIXIN_33979203/ARTICLE/DETAILS/93429446》 * |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110308974A (en) * | 2019-07-11 | 2019-10-08 | 联想(北京)有限公司 | A kind of data processing method, virtual machine and virtual machine architecture |
CN110764995A (en) * | 2019-09-05 | 2020-02-07 | 北京字节跳动网络技术有限公司 | Method, device, medium and electronic equipment for detecting file access abnormity |
CN110633190A (en) * | 2019-09-26 | 2019-12-31 | 北京博睿宏远数据科技股份有限公司 | Application program memory monitoring method, device, equipment and storage medium |
CN111090536B (en) * | 2019-11-19 | 2021-11-16 | 北京字节跳动网络技术有限公司 | Method, device, medium and electronic equipment for acquiring memory leakage information |
CN111090536A (en) * | 2019-11-19 | 2020-05-01 | 北京字节跳动网络技术有限公司 | Method, device, medium and electronic equipment for acquiring memory leakage information |
CN111984401A (en) * | 2020-07-24 | 2020-11-24 | 五八有限公司 | Memory overflow management method and device, electronic equipment and storage medium |
CN112148441A (en) * | 2020-07-28 | 2020-12-29 | 易视飞科技成都有限公司 | Embedded message queue realizing method of dynamic storage mode |
CN113010891B (en) * | 2021-02-26 | 2023-02-07 | 中科天齐(山西)软件安全技术研究院有限公司 | Application program safety detection method and device, electronic equipment and storage medium |
CN113010890A (en) * | 2021-02-26 | 2021-06-22 | 中科天齐(山西)软件安全技术研究院有限公司 | Application program safety detection method and device, electronic equipment and storage medium |
CN113010891A (en) * | 2021-02-26 | 2021-06-22 | 中科天齐(山西)软件安全技术研究院有限公司 | Application program safety detection method and device, electronic equipment and storage medium |
CN113010890B (en) * | 2021-02-26 | 2023-02-07 | 中科天齐(山西)软件安全技术研究院有限公司 | Application program safety detection method and device, electronic equipment and storage medium |
CN113110965A (en) * | 2021-03-12 | 2021-07-13 | 北京健康之家科技有限公司 | Abnormal information monitoring method and device, computer storage medium and terminal |
CN113110965B (en) * | 2021-03-12 | 2024-06-28 | 北京水滴科技集团有限公司 | Monitoring method and device for abnormal information, computer storage medium and terminal |
CN113157513A (en) * | 2021-05-10 | 2021-07-23 | 北京字节跳动网络技术有限公司 | Heap memory damage detection method and device, electronic equipment and storage medium |
CN115277236A (en) * | 2022-08-01 | 2022-11-01 | 福建天晴在线互动科技有限公司 | Method and system for carrying out request analysis on domain name |
CN115277236B (en) * | 2022-08-01 | 2023-08-18 | 福建天晴在线互动科技有限公司 | Method and system for carrying out request analysis on domain name |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109656779A (en) | Internal memory monitoring method, device, terminal and storage medium | |
CN106610892B (en) | Memory leak detection method and device | |
JP5425286B2 (en) | How to track memory usage in a data processing system | |
US7603589B2 (en) | Method and system for debugging a software program | |
US6725241B1 (en) | Method and apparatus for freeing memory in a data processing system | |
US9058212B2 (en) | Combining memory pages having identical content | |
US8060706B2 (en) | Method of allocating physical memory in specified address range under Linux system platform | |
CN109150930B (en) | Configuration information loading method and device and service processing method and device | |
US8073673B2 (en) | Emulated memory management | |
US10713162B1 (en) | System and method for computer data garbage collection acceleration using peer to peer data transfers | |
CN100392606C (en) | Method for leaking memory of positioning virtual operation system | |
US20170083426A1 (en) | Memory management tools | |
US20060161913A1 (en) | Method and apparatus for marking code for data versioning | |
US7962692B2 (en) | Method and system for managing performance data | |
GB2497172A (en) | Reserving space on a storage device for new data based on predicted changes in access frequencies of storage devices | |
US9274946B2 (en) | Pre-leak detection scan to identify non-pointer data to be excluded from a leak detection scan | |
US20210157647A1 (en) | Numa system and method of migrating pages in the system | |
CN111752715A (en) | System optimization method, device, equipment and storage medium under large quantity of requests | |
US10884934B1 (en) | Prefetching data units to a cache of a storage system | |
CN112306980A (en) | Log processing method and terminal equipment | |
US10417121B1 (en) | Monitoring memory usage in computing devices | |
CN108197005B (en) | Method, medium, equipment and system for monitoring bottom layer operation performance of IOS application | |
CN112631941B (en) | Method and system for locating linux kernel slub memory leakage | |
US9760388B1 (en) | Memory monitoring tool | |
CN115543859A (en) | Wear leveling optimization method, device, equipment and medium for multi-partition SSD |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190419 |
|
RJ01 | Rejection of invention patent application after publication |