Memory management method and device, computer equipment, storage medium and program product

By determining the memory release strategy based on the number of pages in the applet, unnecessary memory is released when the system is insufficient, the problem of not being able to open a new page in the applet is solved, ensuring the stability and user experience of the system.

CN119440780APending Publication Date: 2025-02-14BEIJING DIDI INFINITY TECH & DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310944814.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-28
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In mini programs, as the page stack increases, insufficient system memory leads to the inability to open a new page, affecting user operations.

Method used

By getting the number of pages in the open state, the target memory release policy is determined based on the number of pages, and the memory is released from the open state pages according to the policy to open a new page.

Benefits of technology

It effectively solves the problem that new pages cannot be opened when the number of pages exceeds the upper limit of the threshold, ensuring that the applet can run normally and users can continue to operate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440780A_ABST
    Figure CN119440780A_ABST
Patent Text Reader

Abstract

The invention relates to a memory management method and device, computer equipment, a storage medium and a program product. The method comprises the steps of obtaining the number of pages in an open state; determining a target memory release strategy according to the page number, and releasing the memory from the page in the open state according to the target memory release strategy; and opening a new page based on the released memory. By using the memory management method provided by the invention, pages exceeding a preset number can be opened, and continuous operation of a user is not influenced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a memory management method, apparatus, computer equipment, storage medium and program product. Background Art

[0002] With the development of computer technology, more and more mini-programs have emerged. When using mini-programs, users will open too many page stacks under complex processing procedures. Each page stack represents an Internet page. The opened pages have been occupying memory, which will cause the mini-program system to have insufficient memory. When the system memory exceeds the upper threshold, the system will forcibly clear the memory of each page stack, making each page stack unusable.

[0003] In traditional technology, when designing a mini-program, technicians force users to open a maximum of a preset number of pages. When the preset number is exceeded, new pages cannot be opened.

[0004] However, in traditional technologies, pages exceeding a preset number still cannot be opened, which affects the user's continued operation. Summary of the invention

[0005] Based on this, it is necessary to provide a memory management method, apparatus, computer equipment, storage medium and program product capable of opening more than a preset number of pages in response to the above technical problems.

[0006] In a first aspect, the present application provides a memory management method, the method comprising:

[0007] Get the number of pages that are open;

[0008] Determine a target memory release strategy according to the number of pages, and release memory from the pages in an open state according to the target memory release strategy;

[0009] Open new pages based on freed memory.

[0010] In one embodiment, determining a target memory release strategy according to the number of pages includes:

[0011] The target memory release strategy is determined based on the number of pages and a preset number threshold.

[0012] In one embodiment, determining a target memory release strategy according to the number of pages and a preset number threshold includes:

[0013] If the number of pages reaches a preset first number threshold, determining the target memory release strategy to be the first memory release strategy;

[0014] If the number of pages reaches a preset second number threshold, determining that the target memory release policy is a second memory release policy;

[0015] If the number of pages reaches a preset third number threshold, determining that the target memory release strategy is a third memory release strategy;

[0016] Among them, the first quantity threshold is smaller than the second quantity threshold, and the second quantity threshold is smaller than the third quantity threshold; the memory released by the third memory release policy is larger than the memory released by the second memory release policy, and the memory released by the second memory release policy is larger than the memory released by the first memory release policy.

[0017] In one of the embodiments, the first memory release strategy includes: releasing the first memory corresponding to at least one page in the open state; the first memory includes at least one of the virtual tree, component tree and component data in the view engine memory of at least one page.

[0018] In one of the embodiments, the second memory release strategy includes: releasing the second memory corresponding to at least one page in the open state; the second memory includes all data in the view engine memory corresponding to the at least one page.

[0019] In one of the embodiments, the third memory release strategy includes: releasing the third memory corresponding to at least one page in the open state; the third memory includes data in the view engine memory and data in the logic engine memory corresponding to the at least one page.

[0020] In one embodiment, the method further comprises:

[0021] Add page identifiers to pages of freed memory.

[0022] In one embodiment, the method further comprises:

[0023] Check whether the page to be opened has a page identifier;

[0024] If there is a page identifier, the data information corresponding to the page to be opened is obtained from the logic engine memory, and the page to be opened is displayed according to the data information.

[0025] In one embodiment, the method further comprises:

[0026] Check whether the page to be opened has a page identifier;

[0027] If there is a page identifier, data information corresponding to the page to be opened is created, and the page to be opened is displayed according to the data information.

[0028] In a second aspect, the present application further provides a memory management device, the device comprising:

[0029] The acquisition module is used to obtain the number of pages in the open state;

[0030] A release module, used for determining a target memory release strategy according to the number of pages, and releasing memory from the pages in an open state according to the target memory release strategy;

[0031] Open module, used to open new pages based on freed memory.

[0032] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method provided in the first aspect are implemented.

[0033] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the method provided in the first aspect when the computer program is executed by a processor.

[0034] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the method provided in the first aspect when the computer program is executed by a processor.

[0035] The above-mentioned memory management method, device, computer equipment, storage medium and program product, the method obtains the number of pages in the open state, determines the target memory release policy according to the number of pages, and releases memory from the pages in the open state according to the target memory release policy; opens a new page based on the released memory. In this embodiment, the memory is released from the pages in the open state by the target memory release policy determined according to the number of pages, so that when the number of pages reaches the upper threshold, the released memory can be used to open a new page, thereby solving the problem that the pages exceeding the upper threshold cannot be opened, thereby ensuring that the mini program can run normally, so that the user can continue to operate the mini program. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 An application environment diagram of a memory management method in one embodiment;

[0037] Figure 2 A schematic diagram of a step flow of a memory management method in one embodiment;

[0038] Figure 3 A schematic diagram of a step flow of a memory management method in another embodiment;

[0039] Figure 4 A schematic diagram of a first memory release strategy in an embodiment;

[0040] Figure 5A schematic diagram of a second memory release strategy in an embodiment;

[0041] Figure 6 A schematic diagram of a third memory release strategy in an embodiment;

[0042] Figure 7 A schematic diagram of a step flow of a memory management method in another embodiment;

[0043] Figure 8 A schematic diagram of a step flow of a memory management method in another embodiment;

[0044] Fig. 9 A schematic diagram of a step flow of a memory management method in another embodiment;

[0045] Fig.10 FIG. 4 is a schematic diagram of the structure of a memory management device in an embodiment. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0047] The serial numbers assigned to the components in this application, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning.

[0048] First of all, before specifically introducing the technical solutions of the disclosed embodiments of the present application, the background technology or technical evolution context on which the embodiments of the present application are based is introduced. With the development of computer technology, more and more applets have emerged. The applets include a logic engine and a view engine. The logic engine is a system that controls the business logic of the applets, and is mainly responsible for the execution of business modules and data processing in the applets; the view engine is a system for rendering the applets' pages, and is mainly responsible for page and function interactions, as well as view control of the built-in components of the applets. An Internet page is a global, dynamically interactive, cross-platform distributed graphic information system based on hypertext and the hypertext transfer protocol. An Internet page in a mini-program is an offline Internet page with local resources.

[0049] During the use of the mini program, the business party needs to open too many page stacks under a complex processing flow. Each page stack represents an Internet page. The opened pages always occupy the mini program system memory, which can easily lead to insufficient memory in the mini program system. After the mini program system memory exceeds the upper threshold, the system will start the default protection behavior and forcibly clean up the memory occupied by the open pages, which will cause the page to appear white and cannot be restored, causing the user to be unable to operate. In traditional technology, when designing mini programs, technicians forcibly set users to open a maximum of a preset number of pages, and new pages cannot be opened beyond the preset number. However, although the technical solutions in traditional technology can solve the problem that the page appears white and cannot be restored after the memory exceeds the upper threshold, when the number of opened pages exceeds the preset number, the new page still cannot be opened, affecting the user's continued operation. Normally, each page in the mini program occupies 30M of memory, the preset number is 10, and the 11th page cannot be opened. In this regard, the present application provides a memory management method.

[0050] The technical solution of the present application and how the technical solution of the present application solves the technical problem are described in detail below with specific embodiments.

[0051] The memory management method provided in this application can be applied to computer devices installed with various applets, and the computer devices can be, but are not limited to, smart phones, tablet computers, portable wearable devices, etc. The internal structure of the computer device can be as follows: Figure 1 As shown, the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected to a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a memory management method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0052] In one embodiment, Figure 2As shown, a memory management method is provided for managing the memory in the applet system. This embodiment is illustrated by applying the method to a computer device, that is, the computer device manages the memory in the applet. In this embodiment, the method includes the following steps:

[0053] Step 200: Get the number of pages in the open state.

[0054] The order of opening multiple pages in the mini program is that when the first page is opened, the user operates the components on the first page to open the second page, and the second page will cover the first page; the user operates the components on the second page to open the third page, and the third page will cover the first page. Multiple pages can be opened in the same way. If the user is currently on the third page and needs to view the second page, he needs to exit the third page to return to the second page.

[0055] During the running of the mini program, the computer device obtains the number of pages in the open state, that is, the total number of pages opened in sequence when the user uses the mini program.

[0056] In an optional embodiment, the computer device monitors the number of pages in the mini-program that are open in real time when monitoring the user launching the mini-program.

[0057] Step 210: determine a target memory release policy according to the number of pages, and release memory from the pages in the open state according to the target memory release policy.

[0058] After obtaining the number of pages in the applet that are open, the computer device determines the target memory release strategy to be used according to the number of pages in the applet that are open at this time. That is, the target memory release strategy is related to the number of pages in the applet that are open. The target memory release strategy can be pre-set by the technician and stored in the computer device.

[0059] After determining the target memory policy, the computer device uses the target memory release policy to release memory from the pages in the open state, that is, the memory occupied by the pages in the open state is released according to the memory release method specified in the target memory release policy. The memory released according to the target memory release policy can be the memory occupied by all the pages in the open state, or it can be the memory occupied by some of the pages in the open state. This embodiment does not limit this, as long as the released memory is enough to open a new page.

[0060] In an optional embodiment, a technician may pre-set a memory threshold value and store it in a computer device, and the memory threshold value indicates the maximum memory required to open a new page. The computer device may execute a target memory release policy to release memory from an open page according to the memory threshold value, that is, release memory of a memory threshold value size from an open page according to the target memory release policy.

[0061] In another optional embodiment, the computer device may detect the memory required for opening a new page, and execute a target memory release policy to release memory from the opened page according to the detected required memory.

[0062] Step 220: Open a new page based on the released memory.

[0063] After the computer device releases memory according to the target memory release policy, the applet in the computer device can open a new page in response to the user's opening operation based on the released memory, that is, use the released memory to open a new page.

[0064] The memory management method provided in the embodiment of the present application obtains the number of pages in an open state, determines a target memory release policy according to the number of pages, and releases memory from the pages in an open state according to the target memory release policy; and opens a new page based on the released memory. In this embodiment, memory is released from the pages in an open state by using a target memory release policy determined according to the number of pages, so that when the number of pages reaches an upper threshold, the released memory can be used to open a new page, thereby solving the problem that pages exceeding the upper threshold cannot be opened, thereby ensuring that the mini program can run normally and the user can continue to operate the mini program.

[0065] In one embodiment, an implementation method of determining a target memory release strategy according to the number of pages is provided, and the steps of the implementation method include:

[0066] The target memory release strategy is determined based on the number of pages and a preset number threshold.

[0067] The preset quantity threshold may be pre-set by a technician and stored in the computer device. The quantity threshold set by the technician may be one or more. In the case where the technician sets more than one quantity threshold, there may also be more than one corresponding memory release strategy.

[0068] After obtaining the number of pages of the applet that are currently open, the computer device compares the number of pages with a preset number threshold, and determines a target memory release strategy based on the comparison result.

[0069] When there is one preset number threshold, there is one corresponding memory release strategy. After obtaining the number of pages, the computer device determines whether the number of pages is greater than the preset number threshold; if it is determined that the threshold of the number of pages is greater than the preset number threshold, the corresponding memory release strategy is determined as the target memory release strategy.

[0070] When there are multiple preset quantity thresholds, there are multiple corresponding memory release strategies, that is, one preset quantity threshold corresponds to one memory release strategy. After obtaining the number of pages, the computer device compares the number of pages with the multiple preset quantity thresholds and determines a target memory release strategy from the multiple memory release strategies.

[0071] In this embodiment, the target memory release policy is determined by the number of pages and a preset number threshold. This method of determining the target memory release policy is quick and easy to implement, and can improve the efficiency of the memory management method, thereby improving the efficiency of opening new pages.

[0072] In one embodiment, the preset quantity threshold includes a preset first quantity threshold, a preset second quantity threshold and a preset third quantity threshold, the first quantity threshold is greater than the second quantity threshold, and the second quantity threshold is greater than the third quantity threshold. Figure 3 As shown, an implementation method of determining a target memory release strategy according to the number of pages and a preset number threshold is involved, and the steps of the implementation method include:

[0073] Step 300: If the number of pages reaches a preset first number threshold, determine that the target memory release policy is a first memory release policy.

[0074] After obtaining the number of pages, the computer device compares the number of pages with a preset first number threshold to determine whether the number of pages reaches the preset first number threshold. In other words, the computer device determines whether the number of pages is greater than the first number threshold and less than the second number threshold.

[0075] If the computer device determines that the number of pages is greater than the first number threshold and less than the second number threshold, the target memory release policy is determined to be the first memory release policy. The first memory release policy is the memory release policy corresponding to the first number threshold.

[0076] Step 310: If the number of pages reaches a preset second number threshold, determine that the target memory release policy is the second memory release policy.

[0077] After obtaining the number of pages, the computer device compares the number of pages with a preset second number threshold to determine whether the number of pages reaches the preset second number threshold. In other words, the computer device determines whether the number of pages is greater than the second number threshold and less than the third number threshold.

[0078] If the computer device determines that the number of pages is greater than the second number threshold and less than the third number threshold, the target memory release policy is determined to be the second memory release policy. The second memory release policy is the memory release policy corresponding to the second number threshold.

[0079] Step 320: If the number of pages reaches a preset third number threshold, determine that the target memory release policy is the third memory release policy.

[0080] After obtaining the number of pages, the computer device compares the number of pages with a preset third number threshold to determine whether the number of pages reaches the preset third number threshold. In other words, the computer device determines whether the number of pages is greater than the third number threshold.

[0081] If the computer device determines that the number of pages is greater than the third number threshold, the target memory release policy is determined to be the third memory release policy. The third memory release policy is the memory release policy corresponding to the third number threshold.

[0082] The memory released by the third memory release strategy is greater than the memory released by the second memory release strategy, and the memory released by the second memory release strategy is greater than the memory released by the first memory release strategy. As the number of pages increases, the memory release strategy used releases more memory.

[0083] In this embodiment, by comparing the number of pages with different preset number thresholds, the memory release policies corresponding to the different number thresholds are determined as target memory release policies, so that the target memory release policy can be determined quickly and accurately, thereby improving the efficiency of opening new pages.

[0084] In an optional embodiment, if the number of pages is less than a preset first number threshold, it means that the number of pages opened at this time has not reached the situation where memory needs to be released before a new page can be opened. In other words, if the unused memory in the applet is sufficient to open a new page, the new page is opened directly without releasing memory according to the determined target memory release policy.

[0085] In an optional embodiment, if the computer device determines that the number of pages is within a first number threshold range formed by a first number threshold and a second number threshold, then the target memory release policy is determined to be the first memory release policy; if the computer device determines that the number of pages is within a second number threshold range formed by a second number threshold and a third number threshold, then the target memory release policy is determined to be the second memory release policy; if the computer device determines that the number of pages is neither within the first number threshold range nor within the second number threshold range, and is greater than the first number threshold range, then the target memory release policy is determined to be the third memory release policy.

[0086] In one embodiment, the first memory release strategy includes: releasing the first memory corresponding to at least one page in the open state; the first memory includes at least one of the virtual tree, component tree and component data in the view engine memory of at least one page.

[0087] The memory corresponding to the applet includes view engine memory and logic engine memory. The view engine memory is used to represent the data required for page display and data for user interaction, and the logic engine memory is used to represent the data required for executing business modules.

[0088] The view engine memory includes real node tree, virtual tree, component tree and component data, etc. The real node tree refers to the various data that users see on the page, and the virtual tree is the structure corresponding to the real node tree. The virtual tree can reflect the layout of the page, but the components in the virtual tree cannot be operated; the component tree refers to the components in the page layout, and the component data refers to the status of each component in the page layout.

[0089] When a computer device releases memory according to a first memory release strategy, at least one of the virtual trees, component trees, and component data corresponding to any one of the pages in an open state is released; or at least one of the virtual trees, component trees, and component data corresponding to any multiple pages in an open state is released.

[0090] In this embodiment, when the number of pages is greater than the first number threshold and less than the second number threshold, at least one of the virtual tree, component tree and component data in the page in the open state is released. The memory released in this way is various data in the view engine, and the business interaction of the applet is all realized through the logic engine. At this time, releasing the memory in the view engine will not affect the normal operation of various functions in the logic engine. For example, the interface request, timer, event callback and other functions in the logic engine can be realized, and the released memory can be used to open a new page, thereby solving the problem that the page whose number exceeds the third number threshold cannot be opened, so that the user can continue to operate the applet. In addition, the various data in the released view engine are also saved in the logic engine, so that when the page whose memory is released is opened later, the corresponding data is directly obtained in the logic engine, which can improve the efficiency of opening the page, and there will be no white screen when the page is opened.

[0091] In an optional embodiment, if Figure 4 As shown, assuming that the first quantity threshold is 10 pages, and the memory occupied by each page is 30M. When the 11th page is opened, part of the data in the first two pages in the view engine memory is released (15M for each page). Figure 4 The memory in the dashed box is the released memory.

[0092] In one embodiment, the second memory release strategy includes: releasing the second memory corresponding to at least one page in the open state; the second memory includes all data in the view engine memory corresponding to the at least one page.

[0093] For the description of the view engine memory, please refer to the specific description in the above embodiment, which will not be repeated here.

[0094] When the computer device releases memory according to the second memory release strategy, it releases all data in the view engine memory corresponding to any one or more pages in the open state, that is, it releases the real node tree, virtual tree, component tree and component data corresponding to any one or more pages.

[0095] In this embodiment, when the number of pages is greater than the second number threshold and less than the third number threshold, the real node tree, virtual tree, component tree and component data in at least one of the pages in the open state are released. The memory released in this way is the data in the view engine, and the business interactions of the applet are all implemented through the logic engine. At this time, releasing the memory in the view engine will not affect the normal operation of various functions in the logic engine, such as interface requests, timers, event callbacks and other functions in the logic engine. In addition, the released memory can be used to open a new page, thereby solving the problem that the page whose number exceeds the second number threshold cannot be opened, so that the user can continue to operate the applet. In addition, the data in the released view engine is also saved in the logic engine, so that when the page that releases the memory is opened later, the corresponding data is directly obtained in the logic engine, which can improve the efficiency of opening the page.

[0096] In an optional embodiment, if Figure 5 As shown, assuming that the first quantity threshold is 15 pages, and the memory occupied by each page is 30M, all data in the view engine of the first page are released when the 16th page is opened. Figure 5 The memory in the dashed box is the released memory.

[0097] In one embodiment, the third memory release strategy includes: releasing the third memory corresponding to at least one page in the open state; the third memory includes data in the view engine memory and data in the logic engine memory corresponding to the at least one page.

[0098] For the description of the logic engine memory, please refer to the specific description in the above example, which will not be repeated here.

[0099] When the computer device releases memory according to the third memory release strategy, it releases the data in the view engine memory and logic engine memory corresponding to any one or more pages in the open state, that is, the view engine memory and logic engine memory in at least one page in the open state are released.

[0100] In this embodiment, when the number of pages is greater than the third number threshold, data in the view engine memory and data in the logic engine memory corresponding to at least one of the pages in the open state are released. In this way, the released memory can be used to open a new page, thereby solving the problem that the pages whose number exceeds the third number threshold cannot be opened, so that the user can continue to operate the mini program.

[0101] In an optional embodiment, if Figure 6 As shown, assuming that the first quantity threshold is 20 pages, and the memory occupied by each page is 30M, when the 21st page is opened, all data in the view engine of the first page and all data in the logic engine memory are released. Figure 6 The memory in the dashed box is the released memory.

[0102] In one embodiment, after the computer device releases memory from the page in the open state according to the target memory release policy, the memory management method further includes:

[0103] Add page identifiers to pages of freed memory.

[0104] The page identifier is used to indicate that the page is a page that has released memory data. After releasing the memory of a page, the computer device will directly add a page identifier to the page. The page identifier can be a label added to the name corresponding to the page, or a retrieval function can be set for the page, through which the data required to open the page can be obtained. This embodiment does not limit the form of the page identifier added to the page that has released memory, as long as its function can be achieved.

[0105] In this embodiment, after the memory of a page is released according to the target memory release policy, a page identifier will be added to the page. In this way, when the page is reopened later, it can be determined through the page identifier that the data corresponding to the page is released. When the released data is retained in the logic engine memory, it can be directly obtained in the logic engine, thereby improving the practicality and reliability of the memory management method.

[0106] In one embodiment, Figure 7 As shown, when the user needs to open the page before the current page, that is, exit the current page, or open a new page, the steps of the method further include:

[0107] Step 700: Detect whether there is a page identifier for the page to be opened.

[0108] The page to be opened can be a new page opened by the user, or can be a page returned by the user after exiting the current page. When the page to be opened needs to be opened, the computer device detects whether the page to be opened has a page identifier.

[0109] Step 710: If a page identifier exists, data information corresponding to the page to be opened is obtained from the logic engine memory, and the page to be opened is displayed according to the data information.

[0110] If the computer device determines through detection that there is a page identifier in the page to be opened, indicating that the page is a page that has released memory data, the computer device obtains data information corresponding to the page to be opened from the logic engine memory and displays the page to be opened according to the data information.

[0111] If the page with the page identifier releases memory according to the first memory release strategy, the computer device obtains the data information corresponding to the page to be opened from the logic engine memory; creates a new virtual tree and component tree according to the data information, and restores the mapping relationship between the created virtual tree and component tree and the real node tree to ensure that the page to be opened can respond normally.

[0112] If the page with the page identifier releases memory according to the second memory release policy, the computer device obtains the data information corresponding to the page to be opened from the logic engine memory; creates a new virtual tree, component tree and real node tree based on the data information to ensure that the page to be opened can respond normally.

[0113] In this embodiment, the computer device determines whether there is a page identifier for the page to be opened, and when it is determined that the page identifier exists for the page, it directly obtains the data information corresponding to the page from the logic engine memory, and displays the page to be opened according to the data information. This can improve the efficiency of opening the page to be opened, thereby improving the practicality of the memory management method.

[0114] In one embodiment, Figure 8 As shown, the method also includes:

[0115] Step 800: Detect whether there is a page identifier for the page to be opened.

[0116] The page to be opened can be a new page opened by the user, or can be a page returned by the user after exiting the current page. When the page to be opened needs to be opened, the computer device detects whether the page to be opened has a page identifier.

[0117] Step 810: If a page identifier exists, data information corresponding to the page to be opened is created, and the page to be opened is displayed according to the data information.

[0118] If the page with a page identifier releases memory according to the first memory release strategy, that is, the memory data such as the virtual tree, component tree and component data in the view engine are released, the computer will restore the data through the logic engine, and the unreleased pages of the real node tree memory can still be reused. The user needs to wait until the page is restored before responding normally.

[0119] If the page with a page identifier releases memory according to the second memory release strategy, that is, the memory data such as the virtual tree, real node tree, component tree and component data in the view engine are all released, then the computer restores the entire page through the data in the logic engine, and the user needs to wait until the page is restored before responding normally.

[0120] If the page with a page identifier releases memory according to the third memory release strategy, that is, the data in the view engine memory and the logic engine memory corresponding to the page are released, then the computer device needs to reload the page like opening a new page, create data information corresponding to the page to be opened, and ensure that the page to be opened can respond normally.

[0121] In an optional embodiment, the step of adding a page identifier to a page of released memory includes:

[0122] A page identifier is added to the page of the released memory according to the target memory release strategy corresponding to the page of the released memory. Different target memory release strategies are used, and different page identifiers are added.

[0123] In an optional embodiment, the steps of the memory management method further include:

[0124] If the page to be opened has a page identifier, a target memory release policy corresponding to the page identifier is determined; and the page to be opened is displayed according to the target memory release policy.

[0125] Different target memory release policies correspond to different page identifiers. After determining the page identifier, the computer device determines the target memory release policy according to the corresponding relationship between the page identifier and the target memory release policy. The target memory release policy is any one of the first memory release policy, the second memory release policy and the third memory release policy.

[0126] For different target memory release strategies, different methods are used to obtain data information corresponding to the page to be opened, and the page to be opened is displayed according to the data information. For the description of different methods adopted by different target memory release strategies, reference can be made to the specific description in the above embodiment, which will not be repeated here.

[0127] In one embodiment, Fig. 9 As shown, a memory management method is provided, the steps of the method comprising:

[0128] Step 900: Get the number of pages in the open state;

[0129] Step 910: If the number of pages reaches a preset first number threshold, a first memory corresponding to at least one of the pages in the open state is released; the first memory includes at least one of a virtual tree, a component tree, and component data in the view engine memory of the at least one page;

[0130] Step 920: If the number of pages reaches a preset second number threshold, release the second memory corresponding to at least one of the pages in the open state; the second memory includes all data in the page view engine memory corresponding to the at least one page;

[0131] Step 930: If the number of pages reaches a preset third quantity threshold, the third memory corresponding to at least one page in the open state is released; the third memory includes data in the view memory corresponding to at least one page and data in the logic engine memory; wherein the first quantity threshold is less than the second quantity threshold, and the second quantity threshold is less than the third quantity threshold.

[0132] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0133] Based on the same inventive concept, the embodiment of the present application also provides a memory management device for implementing the memory management method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more memory management device embodiments provided below can refer to the limitations on the memory management method above, and will not be repeated here.

[0134] In one embodiment, Fig.10 As shown, a memory management device 10 is provided, comprising: an acquisition module 11, a release module 12 and an opening module 13, wherein:

[0135] The acquisition module 11 is used to acquire the number of pages in the open state.

[0136] The release module 12 is used to determine a target memory release strategy according to the number of pages, and release memory from the pages in the open state according to the target memory release strategy.

[0137] The opening module 13 is used to open a new page based on the released memory.

[0138] In one embodiment, the release module 12 is specifically configured to determine a target memory release strategy according to the number of pages and a preset number threshold.

[0139] In one embodiment, the release module 12 includes a first determination unit, a second determination unit, and a third determination unit. The first determination unit is used to determine that the target memory release policy is the first memory release policy if the number of pages reaches a preset first quantity threshold; the second determination unit is used to determine that the target memory release policy is the second memory release policy if the number of pages reaches a preset second quantity threshold; the third determination unit is used to determine that the target memory release policy is the third memory release policy if the number of pages reaches a preset third quantity threshold; wherein the first quantity threshold is less than the second quantity threshold, and the second quantity threshold is less than the third quantity threshold; the memory released by the third memory release policy is greater than the memory released by the second memory release policy, and the memory released by the second memory release policy is greater than the memory released by the first memory release policy.

[0140] In one embodiment, the first memory release strategy includes: releasing the first memory corresponding to at least one page in the open state; the first memory includes at least one of the virtual tree, component tree and component data in the view engine memory of at least one page.

[0141] In one embodiment, the second memory release strategy includes: releasing the second memory corresponding to at least one page in the open state; the second memory includes all data in the view engine memory corresponding to the at least one page.

[0142] In one embodiment, the third memory release strategy includes: releasing the third memory corresponding to at least one page in the open state; the third memory includes data in the view engine memory and data in the logic engine memory corresponding to the at least one page.

[0143] In one embodiment, the memory management device 10 further includes an adding module; the adding module is used to add a page identifier to the page of the released memory.

[0144] In one embodiment, the memory management device 10 also includes a detection module; the detection module is used to detect whether there is a page identifier for the page to be opened; if there is a page identifier, the data information corresponding to the page to be opened is obtained from the logic engine memory, and the page to be opened is displayed according to the data information.

[0145] In one embodiment, the detection module is further used to detect whether there is a page identifier for the page to be opened; if there is a page identifier, data information corresponding to the page to be opened is created, and the page to be opened is displayed according to the data information.

[0146] Each module in the above memory management device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0147] In one embodiment, a computer device is provided, whose internal structure diagram can be as follows: Figure 1 As shown. Those skilled in the art can understand that Figure 1 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0148] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0149] Get the number of pages that are open;

[0150] Determine a target memory release strategy according to the number of pages, and release memory from the pages in an open state according to the target memory release strategy;

[0151] Open new pages based on freed memory.

[0152] In one embodiment, when the processor executes the computer program, the following steps are further implemented: determining a target memory release strategy according to the number of pages and a preset number threshold.

[0153] In one embodiment, the processor further implements the following steps when executing the computer program: if the number of pages reaches a preset first quantity threshold, the target memory release policy is determined to be the first memory release policy; if the number of pages reaches a preset second quantity threshold, the target memory release policy is determined to be the second memory release policy; if the number of pages reaches a preset third quantity threshold, the target memory release policy is determined to be the third memory release policy; wherein the first quantity threshold is less than the second quantity threshold, and the second quantity threshold is less than the third quantity threshold; the memory released by the third memory release policy is greater than the memory released by the second memory release policy, and the memory released by the second memory release policy is greater than the memory released by the first memory release policy.

[0154] In one embodiment, when the processor executes the computer program, the following steps are also implemented: releasing the first memory corresponding to at least one page in the open state; the first memory includes at least one of the virtual tree, component tree and component data in the view engine memory of at least one page.

[0155] In one embodiment, when the processor executes the computer program, the following steps are also implemented: releasing the second memory corresponding to at least one page in the open state; the second memory includes all data in the view engine memory corresponding to the at least one page.

[0156] In one embodiment, when the processor executes the computer program, the following steps are also implemented: releasing the third memory corresponding to at least one page in the open state; the third memory includes data in the view engine memory and data in the logic engine memory corresponding to at least one page.

[0157] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: adding a page identifier to the page of the released memory.

[0158] In one embodiment, when the processor executes the computer program, the following steps are also implemented: detecting whether there is a page identifier for the page to be opened; if there is a page identifier, obtaining data information corresponding to the page to be opened from the logic engine memory, and displaying the page to be opened according to the data information.

[0159] In one embodiment, when the processor executes the computer program, the following steps are also implemented: detecting whether there is a page identifier for the page to be opened; if there is a page identifier, creating data information corresponding to the page to be opened, and displaying the page to be opened according to the data information.

[0160] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0161] Get the number of pages that are open;

[0162] Determine a target memory release strategy according to the number of pages, and release memory from the pages in an open state according to the target memory release strategy;

[0163] Open new pages based on freed memory.

[0164] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: determining a target memory release strategy according to the number of pages and a preset number threshold.

[0165] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: if the number of pages reaches a preset first quantity threshold, the target memory release policy is determined to be the first memory release policy; if the number of pages reaches a preset second quantity threshold, the target memory release policy is determined to be the second memory release policy; if the number of pages reaches a preset third quantity threshold, the target memory release policy is determined to be the third memory release policy; wherein the first quantity threshold is less than the second quantity threshold, and the second quantity threshold is less than the third quantity threshold; the memory released by the third memory release policy is greater than the memory released by the second memory release policy, and the memory released by the second memory release policy is greater than the memory released by the first memory release policy.

[0166] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: releasing the first memory corresponding to at least one page in the open state; the first memory includes at least one of the virtual tree, component tree and component data in the view engine memory of at least one page.

[0167] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: releasing the second memory corresponding to at least one page in the open state; the second memory includes all data in the view engine memory corresponding to the at least one page.

[0168] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: releasing the third memory corresponding to at least one page in the open state; the third memory includes data in the view engine memory and data in the logic engine memory corresponding to at least one page.

[0169] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: adding a page identifier to the page of the released memory.

[0170] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: detecting whether there is a page identifier for the page to be opened; if there is a page identifier, obtaining data information corresponding to the page to be opened from the logic engine memory, and displaying the page to be opened according to the data information.

[0171] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: detecting whether there is a page identifier for the page to be opened; if there is a page identifier, creating data information corresponding to the page to be opened, and displaying the page to be opened according to the data information.

[0172] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0173] Get the number of pages that are open;

[0174] Determine a target memory release strategy according to the number of pages, and release memory from the pages in an open state according to the target memory release strategy;

[0175] Open new pages based on freed memory.

[0176] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: determining a target memory release strategy according to the number of pages and a preset number threshold.

[0177] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: if the number of pages reaches a preset first quantity threshold, the target memory release policy is determined to be the first memory release policy; if the number of pages reaches a preset second quantity threshold, the target memory release policy is determined to be the second memory release policy; if the number of pages reaches a preset third quantity threshold, the target memory release policy is determined to be the third memory release policy; wherein the first quantity threshold is less than the second quantity threshold, and the second quantity threshold is less than the third quantity threshold; the memory released by the third memory release policy is greater than the memory released by the second memory release policy, and the memory released by the second memory release policy is greater than the memory released by the first memory release policy.

[0178] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: releasing the first memory corresponding to at least one page in the open state; the first memory includes at least one of the virtual tree, component tree and component data in the view engine memory of at least one page.

[0179] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: releasing the second memory corresponding to at least one page in the open state; the second memory includes all data in the view engine memory corresponding to the at least one page.

[0180] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: releasing the third memory corresponding to at least one page in the open state; the third memory includes data in the view engine memory and data in the logic engine memory corresponding to at least one page.

[0181] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: adding a page identifier to the page of the released memory.

[0182] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: detecting whether there is a page identifier for the page to be opened; if there is a page identifier, obtaining data information corresponding to the page to be opened from the logic engine memory, and displaying the page to be opened according to the data information.

[0183] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: detecting whether there is a page identifier for the page to be opened; if there is a page identifier, creating data information corresponding to the page to be opened, and displaying the page to be opened according to the data information.

[0184] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processors involved in each embodiment provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, data processing logic devices based on quantum computing, etc., but are not limited thereto.

[0185] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0186] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A memory management method, characterized in that: The method comprises: Get the number of pages that are open; Determining a target memory release strategy according to the number of pages, and releasing memory from the pages in the open state according to the target memory release strategy; Open new pages based on freed memory.

2. The method according to claim 1, characterized in that Determining the target memory release strategy according to the number of pages includes: The target memory release strategy is determined according to the page quantity and a preset quantity threshold.

3. The method according to claim 2, characterized in that The determining the target memory release strategy according to the number of pages and a preset number threshold comprises: If the number of pages reaches a preset first number threshold, determining that the target memory release policy is a first memory release policy; If the number of pages reaches a preset second number threshold, determining that the target memory release policy is a second memory release policy; If the number of pages reaches a preset third number threshold, determining that the target memory release policy is a third memory release policy; Among them, the first quantity threshold is smaller than the second quantity threshold, and the second quantity threshold is smaller than the third quantity threshold; the memory released by the third memory release policy is larger than the memory released by the second memory release policy, and the memory released by the second memory release policy is larger than the memory released by the first memory release policy.

4. The method according to claim 3, characterized in that The first memory release strategy includes: releasing the first memory corresponding to at least one of the pages in the open state; the first memory includes at least one of the virtual tree, component tree and component data in the view engine memory of the at least one page.

5. The method according to claim 3, characterized in that: The second memory release strategy includes: releasing the second memory corresponding to at least one of the pages in the open state; the second memory includes all data in the view engine memory corresponding to the at least one page.

6. The method according to claim 3, characterized in that The third memory release strategy includes: releasing the third memory corresponding to at least one page among the pages in the open state; the third memory includes data in the view engine memory and data in the logic engine memory corresponding to the at least one page.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Add page identifiers to pages of freed memory.

8. The method according to claim 7, characterized in that The method further comprises: Detecting whether the page to be opened has the page identifier; If the page identifier exists, the data information corresponding to the page to be opened is obtained from the logic engine memory, and the page to be opened is displayed according to the data information.

9. The method according to claim 7, characterized in that: The method further comprises: Detecting whether the page to be opened has the page identifier; If the page identifier exists, data information corresponding to the page to be opened is created, and the page to be opened is displayed according to the data information.

10. A memory management device, characterized in that: The device comprises: The acquisition module is used to obtain the number of pages in the open state; A release module, used to determine a target memory release strategy according to the number of pages, and release memory from the pages in the open state according to the target memory release strategy; Open module, used to open new pages based on freed memory.

11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.