Memory monitoring method and device based on threads, equipment and storage medium
By monitoring the memory loading status of the target thread in real time and increasing the false value, the problem that the existing technology cannot effectively monitor the memory of a single thread is solved, and intuitive monitoring and optimization of the thread memory status is achieved, avoiding performance degradation and waste of manpower caused by memory problems.
Patent Information
- Application Number
- CN202411676941.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-14
AI Technical Summary
The existing technology cannot effectively monitor and manage the memory status of a single thread, resulting in memory problems of a single thread when the system is sufficient, affecting performance.
By monitoring the loading of the target thread's page in memory in real time, and adding the refault value when the page is refaulted, it can intuitively represent the memory status of the target thread.
It realizes intuitive monitoring of the memory status of a single thread, provides data support memory optimization, avoids IO problems caused by memory problems, and reduces developer misjudgment and labor waste.
Smart Images

Figure CN119621468A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of memory management technology, and in particular to a thread-based memory monitoring method, apparatus, device and storage medium. Background Art
[0002] On Android devices, memory resources are very important in computer architecture. There are a large number of tasks that require applying for and using memory. The ability to manage memory often determines the overall performance of the device. On low-end devices, memory issues are often more prominent and urgent.
[0003] Currently, the memory management of Android devices is regulated by the underlying Linux and Android memory management solutions. The relevant memory management solutions are usually tuned for the overall system memory.
[0004] In the related technology, it is impossible to monitor the memory status of a certain thread. When the system memory meets the standard, there may be a memory problem of a single thread, resulting in a poor performance experience. And this performance problem often manifests as an IO problem, which increases the cost of communication and problem location analysis for developers who do not understand the underlying processes of Linux. Summary of the invention
[0005] In order to solve the above technical problems, the present application provides a thread-based memory monitoring method, device, equipment and storage medium, which can intuitively monitor the memory status of a single thread, provide data support for memory optimization personnel, and avoid IO problems caused by memory problems and waste of manpower due to misjudgment of developers.
[0006] In a first aspect, the present application provides a thread-based memory monitoring method, the method comprising: real-time monitoring of the loading status of a target thread's page in memory; when the page loading status includes a page re-cache error refault, increasing the refault value by a set value, wherein the refault value is used to indicate the memory status of the target thread.
[0007] In a second aspect, the present application provides a thread-based memory monitoring device, which includes: a memory monitoring module for monitoring the loading status of the target thread's page in the memory in real time; a refault value statistics module for increasing the refault value by a set value when the page loading status includes a page refault, wherein the refault value is used to indicate the memory status of the target thread.
[0008] In a third aspect, the present application provides an electronic device, which includes a thread-based memory monitoring device, and the device includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by one or more processors, the one or more processors implement the thread-based memory monitoring method as described in the first aspect above.
[0009] In a fourth aspect, the present application provides a storage medium, which may be a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the thread-based memory monitoring method in the first aspect described above is implemented.
[0010] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the thread-based memory monitoring method as described in any one of the above-mentioned first aspects is implemented.
[0011] Compared with the prior art, the technical solution provided by the embodiments of the present application has the following advantages:
[0012] The embodiment of the present application provides a thread-based memory monitoring method, device, equipment and storage medium, the method comprising: real-time monitoring of the target thread's page loading status in memory; when the page loading status includes page refault, increasing the refault value by a set value, wherein the refault value is used to indicate the memory status of the target thread. By counting the refault value according to the page loading status in memory, and using the refault value to characterize the thread's memory status, the memory status of a single thread can be intuitively seen, data support can be provided for memory optimization personnel, and IO problems caused by memory problems can be avoided due to the developer's misjudgment and waste of manpower. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0014] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0015] Figure 1 A flowchart of a thread-based memory monitoring method provided in an embodiment of the present application;
[0016] Figure 2A schematic diagram of a flow chart of an optimized thread-based memory monitoring method provided in an embodiment of the present application;
[0017] Figure 3 A schematic diagram of the structure of a thread-based memory monitoring device provided in an embodiment of the present application;
[0018] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0019] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0020] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only part of the embodiments of the present application, rather than all of the embodiments.
[0021] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0022] It should be noted that the concepts such as "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0023] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0024] The thread-based memory monitoring method provided by the present application is described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0025] Figure 1 This is a flowchart of a thread-based memory monitoring method in an embodiment of the present application. This embodiment can be applied to monitoring the memory of a single thread. The method can be executed by a thread-based memory monitoring device. The thread-based memory monitoring device can be implemented in software and / or hardware. The thread-based memory monitoring device can be configured in an electronic device.
[0026] like Figure 1 As shown, the thread-based memory monitoring method provided in the embodiment of the present application mainly includes steps S101-S102.
[0027] S101. Monitor the loading status of the target thread's page in the memory in real time.
[0028] A thread is the smallest unit that an operating system can schedule operations on. A thread is usually contained in a process and is the actual operating unit in the process. A process can contain multiple threads, and multiple threads belonging to the same process can share the resources of the process. Each thread has its own program counter, register state, and stack space. In other words, each thread can execute code independently. The target thread can be understood as the thread that needs to detect the memory status. Optionally, the target thread includes the main thread of the foreground application.
[0029] An application (app) is a software program designed to achieve a specific function or solve a specific problem. Applications can include desktop applications, mobile applications, web applications, etc. Users interact with applications to complete various tasks, such as word processing, image editing, gaming, etc. The foreground application can be understood as the application that is currently interacting directly with the user. In an operating system, the foreground application is usually the application that the user can currently see and operate. For example, in the Android operating system, the application window in the foreground will be displayed above all other windows and can receive user input. The main thread of an application usually refers to the first thread created when the application is started, also known as the UI thread (User Interface Thread). The main thread is responsible for handling user interface related operations, including drawing the interface, responding to user events (such as clicking buttons, dragging elements, etc.), and performing other lightweight tasks.
[0030] The main thread is very important for maintaining the responsiveness of the application. If the main thread's memory is jittery, it may cause the application to respond more slowly and performance to degrade. Since the main thread is responsible for handling user interface updates and event responses, if the main thread is blocked by the garbage collector (GC), it may cause the interface to freeze and the user experience to be greatly reduced.
[0031] In an embodiment of the present application, the memory status of the main thread of the foreground application is monitored to intuitively view the memory status of the main thread of the foreground application, so that when problems occur in the memory status of the main thread, the staff can deal with the memory problems in a timely manner to avoid slow application response speed and interface freezes caused by memory problems.
[0032] Memory, also known as main memory, is the storage space that the central processing unit (CPU) can directly address. In order to speed up the reading and writing speed, the process (application) in the electronic device usually needs to use the memory to complete data processing during the startup process. For example, during the startup process, the process (application) will obtain the corresponding memory from the linked list of memory pages in the memory so that it can be used during the startup process or after startup.
[0033] The above-mentioned pages refer to memory pages that can be stored in the memory. The linked list of memory pages stored in the memory is usually a linked list constructed based on the least recently used (Least Recently Used, LRU) algorithm. The memory pages stored in the memory may be file pages, anonymous pages, or non-recyclable pages. In addition, file pages and anonymous pages can be divided into active and inactive. The page in this embodiment can be any kind of memory page stored in the memory.
[0034] The loading of pages in memory usually refers to how the operating system handles the interaction between file data and physical memory. When a process accesses a file, the operating system maps part or all of the file's contents into memory for quick access. The loading of pages in memory mainly includes: page cache, memory-mapped files, page faults, read-ahead, dirty pages, memory pressure, re-cache errors, refaults, etc.
[0035] Real-time monitoring of the target thread's page loading in memory mainly includes: In the Android operating system, you can use vmstat, top, ps, free, pmap and other commands to view the target thread's page usage in memory and the memory mapping information of each thread. Alternatively, you can also analyze the target thread's log file to obtain the target thread's page loading in memory.
[0036] S102. When the page loading status includes a page refault, increase the refault value by a set value, wherein the refault value is used to indicate the memory status of the target thread.
[0037] When the target thread's memory space is tight, the operating system needs to temporarily move some pages out of the memory to make room for other data. When the target thread accesses this page again, it finds that the page is no longer in the physical memory, so it needs to be loaded back into the memory from somewhere else. This process is called refault.
[0038] Among them, refault is divided into two main cases: soft page fault interrupt and hard page fault interrupt. When the target thread tries to access a logical address, and the page corresponding to this address is not in the current physical memory, but still exists in the memory management system (such as the swap area or file cache), but is not mapped to the current virtual address space, a soft page fault interrupt will be generated. In this case, the operating system does not need to read data from the disk, but only needs to update the page table. This type of page fault interrupt is processed faster. If the page is not only not in the physical memory, but also not in the memory management system (that is, the data must be read from the disk), then a hard page fault interrupt is generated. A hard page fault interrupt requires an I / O operation to load data from the disk, which is much slower than a soft page fault interrupt.
[0039] The refault value refers to the number of refaults that have occurred in the target thread from the start time to the current time. Optionally, set the value to 1. That is, when a refault occurs in the memory of the target thread, the refault value is increased by 1.
[0040] Refault can help identify pages that are frequently swapped in and out. The refault value can indicate the number of times a page is swapped in and out within the target thread. The larger the refault value, the greater the number of times a page is swapped in and out within the target thread, that is, the target thread is frequently performing page swapping operations. A high frequency of refaults usually indicates that the operating system is experiencing high memory pressure, that is, the available physical memory within the operating system is insufficient to meet the operating requirements of the target thread, causing the operating system to frequently swap pages out of memory to disk and load them back when needed. In addition, each time a refault occurs, an I / O operation is required to load data from disk, which is a relatively time-consuming process. Therefore, a high frequency of refaults can significantly reduce the overall performance of applications and systems.
[0041] Furthermore, when the refault value reaches the set threshold, a prompt message is generated to remind the staff that the operating system memory pressure is high and measures need to be taken to optimize memory management, adjust the page replacement strategy or improve the design of the application to reduce unnecessary page swaps and improve system performance. For example, the physical memory capacity can be increased, the code logic can be optimized to reduce memory usage, or a more effective cache strategy can be adopted.
[0042] In one possible implementation, when the loading status of a page is a page refault, the refault value is increased by a set value, including: when a new page is loaded into the memory, determining whether the new page belongs to a deleted page; if the new page belongs to a deleted page, determining that the loading status of the page is a page refault, and increasing the refault value by a set value.
[0043] Deleted pages can be pages that have been moved from physical memory to other storage locations, such as swap areas or file caches, disks, etc.
[0044] Ways to detect new pages loaded into memory include: using the inotify subsystem in the Android operating system to detect whether a new page is loaded into memory. The inotify subsystem can track file system activities, including file loading. By monitoring changes in the file system, you can know when a file is loaded into memory. Specifically, by writing a script and using the inotify interface to implement it, when the page status changes, the script will be triggered and detect that a page is loaded into memory.
[0045] When a page is deleted from memory, the page ID of the page can be recorded. When a new page is loaded from disk to memory, it is checked whether the page ID of the new page has been recorded before. If it has been recorded, it indicates that the new page belongs to a deleted page. When it is determined that the new page belongs to a deleted page, the refault value is increased by 1.
[0046] In the embodiment of the present application, when the newly loaded page is a deleted page, the refault value is increased by 1, so that the refault value is more accurate and the monitoring of the memory status is more precise.
[0047] The embodiment of the present application provides a thread-based memory monitoring method, which includes: real-time monitoring of the target thread's page loading status in memory; when the page loading status includes page refault, increasing the refault value by a set value, wherein the refault value is used to indicate the memory status of the target thread. By counting the refault value according to the page loading status in memory, and using the refault value to characterize the thread's memory status, the memory status of a single thread can be intuitively seen, data support can be provided for memory optimization personnel, and IO problems caused by memory problems can be avoided due to the developer's misjudgment and waste of manpower.
[0048] Based on the above embodiments, the embodiments of the present application optimize the thread-based memory monitoring method, such as Figure 2 As shown, the optimized thread-based memory monitoring method mainly includes the following steps S201-S207.
[0049] S201. Monitor the loading status of the target thread's page in the memory in real time.
[0050] S201 provided in this embodiment is the same as the execution process of S101 in the above embodiment. For details, please refer to the description in the above embodiment, and this embodiment will not be further limited.
[0051] S202: When a page deletion event is detected, a page descriptor of the page is obtained.
[0052] Among them, a page descriptor usually refers to a data structure used to describe the information of a page in a virtual memory system in a computer operating system. The page descriptor can include the following information: whether the page currently exists in physical memory. If not in physical memory, the location of the page on disk. The access rights of the page, such as read-only, writable, etc. Whether the page has been modified, if modified, it may need to be written back to disk when swapped out. Whether the page has been referenced. Whether the page belongs to a specific memory area or segment. The protection bit controls the access rights to the page to prevent unauthorized access.
[0053] The above-mentioned deletion event may include a "page-out" event. A script is pre-written to construct a hook function or a listener. The hook function or the listener is used to capture the "page-out" event. After capturing the "page-out" event, the page corresponding to the "page-out" event is recorded as a deleted page. At the same time, the page descriptor of the deleted page is recorded. Furthermore, when there are multiple target threads, the thread number to which the page belongs needs to be recorded.
[0054] S203: Treat the page as a deleted page, and record the page descriptor of the deleted page in a deletion record table.
[0055] The deleted page obtained by capturing the "page-out" event and the page descriptor of the page are recorded in the deletion record table.
[0056] The deletion record table records at least one deleted page and the page descriptor of the page. The deletion record table may be in the form of a hash table or other data structures, which will not be specifically limited in the embodiments of the present application.
[0057] Furthermore, the deleted pages in the multiple target threads and the page descriptors of the pages are recorded in the hash table.
[0058] In this embodiment, the descriptor of the deleted page is recorded by detecting the deletion event, so as to more clearly and accurately determine the deleted page.
[0059] S204: When a new page is loaded into the memory, a page descriptor of the new page is obtained.
[0060] Detect whether a new page is loaded into the memory, and when a new page is loaded into the page, obtain the page descriptor of the new page.
[0061] S205 . If the deletion record table includes the page descriptor of the new page, it is determined that the new page belongs to a deleted page, and S206 is executed.
[0062] If the deletion record table does not include the page descriptor of the new page, it is determined that the new page does not belong to the deleted page.
[0063] A query is performed in the delete record table based on the page descriptor of the new page. If the page descriptor of the new page is recorded in the delete record table, it indicates that the new page has been loaded in the physical memory and has been deleted from the physical memory for some reason. Therefore, the page is a deleted page.
[0064] If the page descriptor of the new page is not recorded in the deletion record table, it means that the new page has not been loaded in the physical memory, so the page does not belong to the deleted pages.
[0065] S206: Increase the refault value by a set value.
[0066] If the page descriptor of the page is included in the deletion record table, the refault value is increased by 1.
[0067] S207: Delete the page descriptor of the new page in the deletion record table.
[0068] If the deletion record table includes the page descriptor of the new page, it is determined that the new page belongs to a deleted page, the page is loaded into the physical memory, and the page descriptor of the page in the deletion record table is deleted.
[0069] In this embodiment, the page descriptors in the deletion record table are deleted to avoid long-term storage of the page descriptors in the deletion record table, which may lead to refault value errors due to misjudgment of deleted pages, thereby improving the accuracy of memory monitoring.
[0070] Furthermore, when the target thread ends, the refault value corresponding to the target thread is set to 0, and the page descriptor recorded in the record table is deleted to release memory space.
[0071] The embodiment of the present application provides a thread-based memory monitoring method, which mainly includes: real-time monitoring of the loading status of the target thread's page in the memory, when a deletion event of a deleted page is detected, obtaining the page descriptor of the deleted page, adding the deleted page descriptor as the page descriptor of the deleted page to the deletion record table, when the page is loaded into the memory, obtaining the page descriptor of the page, if the page descriptor of the page is included in the deletion record table, it is determined that the page belongs to a deleted page, the refault value is increased by a set value, and the page descriptor of the page in the deletion record table is deleted, wherein the refault value is used to indicate the memory status of the target thread. By recording the page descriptor of the deleted page, when a new page is loaded into the page, it is determined whether the refault value increases based on the page descriptor of the page, the memory status of a single thread can be intuitively seen, data support can be provided for memory optimization personnel, and IO problems caused by memory problems can be avoided due to the misjudgment of developers, resulting in manpower waste.
[0072] Figure 3 is a structural diagram of a thread-based memory monitoring device in an embodiment of the present application, such as Figure 3 As shown, the thread-based memory monitoring device 30 provided in the embodiment of the present application mainly includes: a memory monitoring module 31 and a refault value statistics module 32.
[0073] The memory monitoring module 31 is used to monitor the loading status of the target thread's page in the memory in real time; the refault value statistics module 32 is used to increase the refault value by a set value when the page loading status includes page refault, wherein the refault value is used to indicate the memory status of the target thread.
[0074] The embodiment of the present application provides a thread-based memory monitoring device, which is used to execute the following process: real-time monitoring of the target thread's page loading status in memory; when the page loading status includes page refault, increasing the refault value by a set value, wherein the refault value is used to indicate the memory status of the target thread. By counting the refault value according to the page loading status in memory, and using the refault value to characterize the thread's memory status, the memory status of a single thread can be intuitively seen, data support can be provided for memory optimization personnel, and IO problems caused by memory problems can be avoided due to the developer's misjudgment and waste of manpower.
[0075] In a possible implementation, the refault value statistics module 32 is specifically used to determine whether a new page is a deleted page when the new page is loaded into the memory; if the new page is a deleted page, it is determined that the page loading status is a page refault, and the refault value is increased by a set value.
[0076] In one possible implementation, the refault value statistics module 32 is specifically used to obtain a page descriptor of a new page when a new page is loaded into the memory; query in a deletion record table based on the page descriptor of the new page, and record the page descriptor of the deleted page in the deletion record table; if the page descriptor of the new page is included in the deletion record table, it is determined that the new page belongs to a deleted page; if the page descriptor of the new page is not included in the deletion record table, it is determined that the new page does not belong to a deleted page.
[0077] In a possible implementation, the method further includes: a deleting module, configured to delete the page descriptor of the page in the deletion record table after determining that the page is a deleted page.
[0078] In a possible implementation, the method further includes: a recording module, which is used to obtain a page descriptor of a page when a page deletion event is detected; treat the page as a deleted page, and record the page descriptor of the deleted page in a deletion record table.
[0079] In one possible implementation, the target thread includes a main thread of a foreground application.
[0080] The thread-based memory monitoring device provided in the embodiment of the present application can execute the thread-based memory monitoring method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0081] Figure 4 is a schematic diagram of the structure of an electronic device provided by this embodiment. The electronic device may include a thread-based memory monitoring device, such as Figure 4 As shown, the electronic device 400 includes a processor 410, a memory 420, an input device 430, and an output device 440; the number of the processor 410 in the electronic device can be one or more. Figure 4 A processor 410 is taken as an example; the processor 410, the memory 420, the input device 430 and the output device 440 in the electronic device can be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.
[0082] The memory 420, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the thread-based memory monitoring method in the embodiment of the present invention. The processor 410 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 420, that is, the thread-based memory monitoring method provided in the embodiment of the present invention is implemented.
[0083] The memory 420 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 420 may further include a memory remotely arranged relative to the processor 410, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0084] The input device 430 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device, and may include a keyboard, a mouse, etc. The output device 440 may include a display device such as a display screen.
[0085] This embodiment also provides a storage medium containing computer executable instructions, and when the computer executable instructions are executed by a computer processor, they are used to implement the thread-based memory monitoring method provided by the embodiment of the present invention.
[0086] Of course, the computer executable instructions of a storage medium containing computer executable instructions provided by an embodiment of the present invention are not limited to the operations of the method described above, and can also execute related operations in the thread-based memory monitoring method provided by any embodiment of the present invention.
[0087] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0088] It is worth noting that in the above-mentioned embodiment of the thread-based memory monitoring device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0089] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0090] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A thread-based memory monitoring method, characterized in that: The method comprises: Monitor the target thread's page loading in memory in real time; When the loading condition of the page includes a page re-cache error refault, the refault value is increased by a set value, wherein the refault value is used to indicate the memory condition of the target thread.
2. The method according to claim 1, characterized in that When the loading condition of the page is that the page caches a refault error again, the refault value is increased by a set value, including: When a new page is loaded into the memory, determining whether the new page belongs to a deleted page; If the new page is a deleted page, it is determined that the loading status of the new page is a page refault, and the refault value is increased by a set value.
3. The method according to claim 2, characterized in that When the new page is loaded into the memory, determining whether the new page is a deleted page includes: When the new page is loaded into the memory, obtaining a page descriptor of the new page; Based on the page descriptor of the new page, query in a deletion record table, wherein the deletion record table records the page descriptor of the deleted page; If the deletion record table includes the page descriptor of the new page, determining that the new page belongs to a deleted page; If the deletion record table does not include the page descriptor of the new page, it is determined that the new page does not belong to a deleted page.
4. The method according to claim 3, characterized in that After determining that the new page belongs to a deleted page, the method further includes: The page descriptor of the new page in the deletion record table is deleted.
5. The method according to claim 3, characterized in that: Also includes: When a page deletion event is detected, obtaining a page descriptor of the page; The page is regarded as a deleted page, and a page descriptor of the deleted page is recorded in the deletion record table.
6. The method according to any one of claims 1 to 5, characterized in that The target thread includes the main thread of the foreground application.
7. A thread-based memory monitoring device, characterized in that: The device comprises: The memory monitoring module is used to monitor the loading status of the target thread's pages in memory in real time; The refault value statistics module is used to increase the refault value by a set value when the loading status of the page includes a page cache error refault again, wherein the refault value is used to indicate the memory status of the target thread.
8. An electronic device, characterized in that: The device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the thread-based memory monitoring method as described in any one of claims 1-6.
9. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the thread-based memory monitoring method as described in any one of claims 1 to 6 is implemented.