Memory management method, electronic device and computer-readable medium

By detecting user operations and releasing memory resources occupied by inactive application interfaces, the problem of continuous increase in memory usage of electronic devices is solved, and memory usage efficiency and device performance are improved.

WO2025044435A1PCT designated stage expired Publication Date: 2025-03-06HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/100770
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-09-08
Filing Date
2024-06-21
Publication Date
2025-03-06

AI Technical Summary

Technical Problem

As the number of applications increases, the system memory usage of electronic devices continues to increase, resulting in a gradual decrease in available memory, which in turn causes lag during application operation and affects the performance of the device.

Method used

By detecting user operations, we judge whether the application interface is inactive and release corresponding memory resources, such as the storage space corresponding to animation, to improve memory usage efficiency.

Benefits of technology

It realizes the timely release of memory resources occupied by the background running applications, improves memory usage efficiency and device usage performance, and avoids lag in application operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024100770_06032025_PF_FP_ABST
    Figure CN2024100770_06032025_PF_FP_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of computers, in particular to a memory management method, an electronic device and a computer-readable medium. The method comprises: displaying a first application interface of a first application, wherein the first application interface comprises a played first animation; detecting a first user operation, displaying a second application interface of a second application, and the first application interface entering an inactive state; and releasing a first part of memory resources occupied by the first application, wherein the first part of memory resources comprises a storage space corresponding to the first animation. The method enables electronic devices such as a mobile phone to release in a timely manner memory resources occupied by some applications running in the background, thus improving the memory use efficiency and the use performance.
Need to check novelty before this filing date? Find Prior Art

Description

Memory management method, electronic device, and computer-readable medium

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on September 8, 2023, with application number 202311159921.8 and application name “Memory Management Method, Electronic Device and Computer-Readable Medium”, the entire contents of which are incorporated by reference into this application.

[0002] In addition, this application claims priority to the Chinese patent application filed with the China Patent Office on August 29, 2023, with application number 202311103137.5 and application name “Memory Management Method, Electronic Device and Computer-Readable Medium”, all contents of which are incorporated by reference into this application. Technical Field

[0003] The present invention relates to the field of computer technology, and in particular to a memory management method, electronic equipment, and computer-readable medium. Background Art

[0004] With the development of electronic devices, various application programs (APPs) emerge in an endless stream, allowing users to handle many things through applications on electronic devices, providing convenience for users.

[0005] However, as electronic devices are used, the number of open applications increases, leading to an increasing number of running processes. After some application processes request corresponding memory, they may remain unused and unreleased for extended periods of time, as they may need to keep running. This causes the system's memory usage to continue to increase, while available memory gradually decreases. This can lead to lags in some applications, impacting the overall performance of the electronic device.

[0006] Summary of the Invention

[0007] The present application provides a memory management method, electronic device and computer-readable medium, which enable electronic devices such as mobile phones to promptly release memory resources occupied by some background running applications, thereby improving memory usage efficiency and performance.

[0008] In a first aspect, the present application provides a memory management method applied to an electronic device, the method comprising: displaying a first application interface of a first application, the first application interface including a first animation being played; detecting a first user operation, displaying a second application interface of a second application, and the first application interface entering an inactive state; releasing a first part of memory resources occupied by the first application, wherein the first part of memory resources includes storage space corresponding to the first animation.

[0009] For example, the electronic device may be a mobile phone or other device, the first application may be a desktop application, and the first animation may be a dynamic wallpaper provided by a dynamic wallpaper application. Correspondingly, the first application interface may be a desktop or lock screen interface displayed by a mobile phone or other device, and the desktop or lock screen interface may display a dynamic wallpaper that occupies a large amount of memory resources, providing the user with an animated visual effect. When a mobile phone or other electronic device detects a user operation indicating a switch to another application interface, such as the first user operation mentioned above, the mobile phone or other electronic device temporarily does not need to display the desktop or lock screen interface, that is, the first application interface enters an inactive state, and the mobile phone or other electronic device also does not need to display a dynamic wallpaper that occupies a large amount of memory resources. Based on the memory management solution provided in the first aspect of the present application, mobile phones and other electronic devices can release a portion of the memory resources occupied by the desktop application to provide storage space for dynamic wallpapers, such as the first portion of memory resources mentioned above.

[0010] It can be understood that dynamic wallpaper applications can usually be mounted in a desktop application process (such as a launcher process) to run. Therefore, the memory resources required for the dynamic wallpaper application to run and provide dynamic wallpapers displayed on the desktop or lock screen interface can be included in the first part of the memory resources occupied by the above-mentioned first application, or can be this part of the memory resources, and there is no restriction here.

[0011] In a possible implementation of the first aspect above, the method also includes: detecting a second user operation indicating switching back to display the first application interface, allocating a second portion of memory resources to the first application, wherein the second portion of memory resources is of the same type and has the same space size as the first portion of memory resources, and the second portion of memory resources includes storage space provided for the first animation.

[0012] For example, the above-mentioned first application interface is the desktop or lock screen interface. When a mobile phone or other electronic device detects a user operation instructing to switch back to the desktop or lock screen interface, such as the above-mentioned second user operation, the mobile phone or other electronic device can then allocate the released memory resources to the desktop application or the dynamic wallpaper application mounted in the launcher process, thereby providing storage space for the dynamic wallpaper (or the above-mentioned first animation) displayed on the desktop or lock screen interface.

[0013] In a possible implementation of the first aspect above, the first application interface enters an inactive state, including: the first application interface is not displayed, and the first animation is in an unplayed state.

[0014] Taking the desktop or lock screen interface as an example, the above-mentioned first application interface entering the inactive state can correspond to the state in which the electronic device such as a mobile phone exits the desktop or lock screen interface and does not need to continue playing the dynamic wallpaper on the desktop or lock screen interface.

[0015] In other embodiments, the above-mentioned first application can also be other applications, such as a short video application. The above-mentioned first application interface can be, for example, a short video playback interface of a short video application. Correspondingly, the first application interface entering an inactive state can correspond to a state in which the short video playback interface no longer continues to play the corresponding short video, etc., and there is no limitation here.

[0016] In a possible implementation of the first aspect above, releasing the first part of memory resources occupied by the first application includes: determining that the first part of memory resources meets a release condition, and releasing the first part of memory resources; wherein the release condition is related to the type of the first part of memory resources and / or the type of data related to the first animation stored in the first part of memory resources.

[0017] In a possible implementation of the first aspect above, the type of the first part of memory resources includes GPU memory and / or ION memory, wherein the GPU memory is used to store the resources required for the GPU of the electronic device to perform the rendering process of the first animation: the ION memory is used to store the video stream data corresponding to the first animation.

[0018] For example, the type of data related to the first animation stored in the first part of the memory resources may be non-instruction data, including rendering resources such as textures, rendered video stream data, etc., which is not limited here.

[0019] In a possible implementation of the first aspect above, the electronic device is installed with a third application, and the third application is used to provide a first animation played on the first application interface, wherein the third application runs in a process corresponding to the first application, and the third application and the first application are different applications.

[0020] In a possible implementation of the first aspect above, the type of data related to the first animation stored in the first portion of memory resources does not include instructions related to the execution of the third application.

[0021] In a possible implementation of the first aspect above, the first application includes a desktop application, and the first animation includes a dynamic wallpaper.

[0022] In a possible implementation of the first aspect above, the resources occupied by the first application further include a third portion of memory resources that cannot be released, wherein the third portion of memory resources includes storage space corresponding to instructions related to the execution of the first application.

[0023] In a possible implementation of the first aspect above, the first part of memory resources is memory resources managed by the system of the electronic device.

[0024] For example, the first portion of memory resources described above can be described as releasable memory resources, i.e., releasable resources. Such memory resources can be marked as system-managed memory resources. Correspondingly, the non-releasable memory resources occupied by the first application, i.e., non-releasable resources, can be memory resources marked as managed by the first application. Detailed description thereof is omitted here.

[0025] In a second aspect, the present application provides an electronic device comprising: one or more processors; one or more memories; one or more memories storing one or more programs, which, when one or more programs are executed by one or more processors, enables the electronic device to execute the memory management method provided in the above-mentioned first aspect and various possible implementations of the first aspect.

[0026] In a third aspect, the present application provides a computer-readable medium having instructions stored thereon, which, when executed on a computer, causes the computer to execute the memory management method provided in the first aspect and various possible implementations of the first aspect.

[0027] In a fourth aspect, an embodiment of the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the memory management method provided in the above-mentioned first aspect and various possible implementations of the first aspect.

[0028] The beneficial effects of the second to fourth aspects mentioned above can be found in the relevant descriptions of the first aspect and various possible implementations of the first aspect, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] FIG1 is a schematic diagram showing a scenario in which an application process occupies system memory for a long time.

[0030] FIG. 2 a is a schematic diagram showing a desktop with dynamic wallpaper displayed on a mobile phone.

[0031] FIG2 b is a schematic diagram showing a lock screen interface with a dynamic wallpaper displayed on a mobile phone.

[0032] FIG3 is a schematic diagram showing an implementation flow of a memory management method provided in an embodiment of the present application.

[0033] FIG4 is a schematic diagram showing the distribution of memory resources provided in the form of a buffer according to an embodiment of the present application.

[0034] FIG5 a is a schematic diagram showing the distribution of GPU memory resources occupied by a mobile phone during the display of a dynamic wallpaper by a dynamic wallpaper application provided by an embodiment of the present application.

[0035] FIG5 b is a schematic diagram showing the distribution of ION memory resources occupied by the mobile phone 100 during the display of the dynamic wallpaper by running the dynamic wallpaper application according to an embodiment of the present application.

[0036] FIG6 is a schematic diagram showing the system software structure of an electronic device provided in an embodiment of the present application.

[0037] FIG7 is a schematic diagram showing the implementation process of a memory management method provided in an embodiment of the present application in a system of an electronic device.

[0038] FIG8 is a schematic diagram showing the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described in detail below with reference to the accompanying drawings and specific implementation methods.

[0040] Figure 1 shows a schematic diagram of a scenario in which an application process occupies system memory for a long time. As shown in Figure 1, the scenario may include a mobile phone 100, and a dynamic wallpaper application 101 may be installed and run on the mobile phone 100. During the operation of the dynamic wallpaper application 101, the mobile phone 100 may display the desktop 210 shown in Figure 2a and / or the lock screen interface 220 shown in Figure 2b. As shown in Figure 2a, a dynamic wallpaper 211 with animation effects may be displayed on the desktop 210. As shown in Figure 2b, a dynamic wallpaper 221 with animation effects may be displayed on the lock screen interface 220. This type of dynamic wallpaper with animation effects usually occupies memory in the form of a video stream, which takes up more graphics rendering resources and memory resources than static wallpapers. This part of the memory may include GPU memory used for graphics rendering, ION memory used for video stream playback, and other related types of memory.

[0041] It can be understood that the application of virtual memory technology can achieve process isolation for applications and improve the efficiency of physical memory usage in electronic devices. When an electronic device runs an application, the operating system can allocate an independent virtual address space for each application process. Because the virtual address spaces of different processes are independent and non-overlapping, a process cannot access the virtual address space of another process. This ensures process isolation and data security for different applications. However, for an electronic device to execute applications, the applications must run in real physical memory. Therefore, after allocating an independent virtual address space for each application process, the operating system can establish a mapping between virtual addresses in the virtual address space and physical addresses. Through this mapping mechanism, when an application accesses a virtual address in the virtual address space, it can map the virtual address to a physical address, enabling access to the physical address. This mapping relationship between virtual and physical addresses can be stored in a page table provided by the paging mechanism. This allows applications and hardware devices to share physical memory, reducing content copying. During the execution of an application, physical memory may be shared with some hardware devices, aiming to reduce content copying and improve service efficiency.

[0042] Typically, in some of the aforementioned shared physical memory scenarios, if the application process does not proactively release the occupied physical memory, the corresponding memory may be permanently occupied by the application process. Only when the process containing the application is killed will the application proactively release the occupied memory resources. Applications running in the background will not proactively release memory resources, but some system-managed memory resources within this memory resource will not be affected if released by the system. For example, this memory resource may be allocated by the system to the application to store some resource data. However, there is currently a lack of a memory release mechanism to promptly release this portion of system-managed memory resources within the memory resources occupied by the application.

[0043] For example, referring to the scenario shown in FIG1 above, when dynamic wallpaper needs to be displayed, the dynamic wallpaper application 101 usually needs to occupy a portion of GPU memory and ION memory. When dynamic wallpaper does not need to be displayed, for example, when the mobile phone 100 responds to a user operation to switch to an interface that displays other applications without displaying the desktop 210 or the lock screen interface 220, the dynamic wallpaper application may still remain running in the background and will not actively release the occupied memory resources. Therefore, a portion of the memory resources that are releasable by the system management, such as a portion of the GPU memory and ION memory occupied by the above-mentioned dynamic wallpaper application 101, cannot be released in time. In this way, the memory allocation efficiency of the mobile phone system will be affected to a certain extent, and the performance of the entire mobile phone will also be affected.

[0044] In order to solve the above problems, the present application provides a memory management method. Specifically, when a mobile phone or other electronic device detects that some applications have entered the background and do not need to be displayed in the foreground, it can analyze whether there is a part of the memory resources occupied by the application that can be released, and release the determined memory resources that can be released. The part of the memory resources that can be released is referred to as releasable resources below, and the other part of the memory resources that cannot be released can be referred to as non-releasable resources below. In this way, mobile phones and other electronic devices can release the memory resources occupied by some background running applications in a timely manner, thereby improving memory usage efficiency and performance.

[0045] It can be understood that the above-mentioned releasable resources are part of the memory resources occupied by the corresponding application. This part is usually managed by the operating system of electronic devices such as mobile phones and is used to store some resource data that does not affect the application's continued operation in the background. For example, the above-mentioned dynamic wallpaper application corresponds to the cached rendering resources and pictures, video streams, etc. when displaying dynamic wallpaper on the desktop or lock screen interface. When the dynamic wallpaper application and the desktop application enter the background together, the dynamic wallpaper application or the desktop application usually does not actively release this part of the releasable resources. At this time, the operating system of electronic devices such as mobile phones can delete the cached rendering resources and pictures, video streams, etc. in this part of the releasable resources based on the memory management method provided by this application. The release of this part of the releasable resources is realized when the dynamic wallpaper application enters the background, which is more timely than releasing the corresponding occupied memory resources after the process running the dynamic wallpaper application is killed.

[0046] In an embodiment of the present application, the above-mentioned releasable resources may include resources such as GPU memory and ION memory. This part of the resources may be a part of the entire GPU memory and ION memory occupied by the dynamic wallpaper application, and there is no limitation here.

[0047] Correspondingly, the aforementioned non-releasable resources may be memory resources that store instructions required for the application to run, such as display-related drawing instructions. The corresponding non-releasable resources may be, for example, some buffers (array buffers). These memory resources are usually managed by the corresponding application after being allocated to the application to support the normal operation of the application. To ensure that the application continues to run in the background and to provide a smoother display when entering the foreground, electronic devices such as mobile phones may not release these non-releasable resources managed by the application.

[0048] In an embodiment of the present application, when an application enters the background, a mobile phone or other electronic device can determine whether there are releasable resources by identifying whether there are system-managed GPU memory, ION memory, or other memory resources in the memory resources occupied by the application. In other embodiments, a mobile phone or other electronic device can also determine whether there are releasable resources in the memory resources occupied by the application entering the background by analyzing other distinguishing features between this part of the memory resources and other non-releasable resources, which is not limited here.

[0049] Referring to the above example, when a mobile phone runs a dynamic wallpaper application to display a dynamic wallpaper, a portion of the GPU memory and ION memory occupied by the dynamic wallpaper is a releasable resource, and the amount of memory resources occupied by this portion is larger than the amount occupied by static wallpaper. Based on the memory management method provided by this application, when the mobile phone detects that the dynamic wallpaper application enters the background and does not need to display the desktop or lock screen interface, for example, when it detects that the user opens another application on the mobile phone or turns off the screen of the mobile phone, the mobile phone can promptly release the releasable resources in the GPU memory, ION memory and other memory resources occupied by the dynamic wallpaper application.

[0050] It is understandable that when a mobile phone or other electronic device needs to run the above application in the foreground again in response to a user operation to display the relevant interface, for example, when the mobile phone detects that the user switches back to the desktop or opens the lock screen interface, the operating system of the mobile phone can reallocate the released memory resources for the application. At this time, the above application that keeps running in the background can also use the reallocated GPU memory, ION memory and other resources to redraw the relevant interface for display. Since the drawing instructions executed by the application are located in non-releasable resources, the drawing and rendering of the relevant interface can be executed in time during the above redrawing process. Therefore, the process of redrawing the relevant interface in the reallocated memory resources will not cause delay problems such as freezing of the display process of the relevant interface.

[0051] It can be understood that the memory management method provided in the embodiments of the present application is applicable to electronic devices including but not limited to mobile phones, tablet computers, desktop computers, laptop computers, handheld computers, netbooks, as well as augmented reality (AR) / virtual reality (VR) devices, smart TVs, smart watches and other wearable devices, car equipment, portable game consoles, portable music players, reader devices, and other electronic devices with one or more processors or one or more display screens.

[0052] Next, taking mobile phone 100 as an example, the specific implementation process of the memory management method provided by this application will be described in detail in combination with specific implementation flowcharts and other related drawings.

[0053] FIG3 is a schematic diagram illustrating a memory management method according to an embodiment of the present application. It is understood that each step in the process shown in FIG3 can be performed by the mobile phone 100. In other embodiments, each step in the process shown in FIG3 can also be performed by other electronic devices such as a tablet computer, which will not be described in detail here.

[0054] It should also be stated that the steps in the methods and processes in the embodiments of the present application are numbered for ease of reference, rather than to limit the order of precedence. If there is a sequence between the steps, the written description shall prevail.

[0055] As shown in Figure 3, the implementation process may include the following steps:

[0056] 301: A first user operation instructing to display a target application-related interface is detected.

[0057] Exemplarily, the target application may be an application that provides interface elements for the mobile phone 100 to display a related interface of an application running in the foreground, such as a dynamic wallpaper application.

[0058] As an example, the first user operation may be an operation in which the user instructs to exit the desktop or lock screen interface, such as the user switching to the desktop on the mobile phone 100, or the user pressing the power button on the mobile phone 100 when the screen is off to display the lock screen interface. In this case, the interface of the target application displayed on the mobile phone 100 may be, for example, the desktop or lock screen interface, and correspondingly, the target application may be a dynamic wallpaper application that provides dynamic wallpaper displayed on the desktop or lock screen interface.

[0059] 302: Allocate memory resources required for displaying related interfaces to the target application.

[0060] For example, when the mobile phone 100 runs a dynamic wallpaper application and displays related interfaces, it needs to call the system's drawing and rendering process through the launcher process to complete the drawing and rendering of the related interfaces. Therefore, when the mobile phone 100 displays the desktop and the dynamic wallpaper on the desktop, the system needs to allocate memory resources such as GPU memory and ION memory to the dynamic wallpaper application to draw and render the interface elements of the dynamic wallpaper and other related interfaces.

[0061] Among them, dynamic wallpapers can also be called video wallpapers, which can be set as the lock screen or desktop background of the mobile phone. Compared with the image format of static wallpapers, dynamic wallpapers are usually a short video in MP4 format or other video formats. As users have higher and higher requirements for the aesthetics, richness, fun and interactivity of mobile phone desktop wallpapers, applications that provide dynamic wallpapers (referred to as dynamic wallpaper applications) provide richer dynamic wallpapers. Some dynamic wallpapers not only have animation effects, but also have matching sound effects. Therefore, more memory resources such as GPU memory and ION memory are needed in the process of drawing, rendering and displaying dynamic wallpapers. Correspondingly, the mobile phone 100 runs dynamic wallpaper applications, etc. to provide dynamic wallpapers and other interface elements for related interfaces, including GPU memory, ION memory, etc. The memory resources required are also relatively large.

[0062] 303: Display the relevant interface of the target application.

[0063] For example, after the mobile phone 100 uses the GPU memory, ION memory and other memory resources allocated to the dynamic wallpaper application to complete the drawing and rendering process of the relevant interface, it can perform synthesis and display, and display the relevant interface on the display screen for the user to watch and operate.

[0064] As an example, referring to the desktop 210 shown in FIG2 a, after the user switches to the desktop, the mobile phone 100 can display the desktop 210 based on the execution process of steps 301 to 303. At this time, the mobile phone 100 can run the dynamic wallpaper application through the launcher process where the desktop (launcher) application is located, and then the dynamic wallpaper 211 can be displayed on the desktop 210.

[0065] For another example, referring to the lock screen 220 shown in FIG. 2 b , in response to the user pressing the on / off button while the screen is off, the mobile phone 100 may display the lock screen 220 based on the execution of steps 301 to 303. At this time, the mobile phone 100 may run a dynamic wallpaper application through the launcher process, and thus display a dynamic wallpaper 221 on the lock screen 220.

[0066] In other embodiments, the above-mentioned related interface may also be the interface of other target applications, such as the playback interface of a video application or the playback interface of a short video application, etc., which is not limited here.

[0067] 304: A second user operation instructing to display another interface is detected.

[0068] For example, a user can operate on the relevant interface displayed on mobile phone 100 to open another application, causing mobile phone 100 to display the interface of the corresponding application. This user operation can be the second user operation instructing to display the other interface. The other interface is different from the relevant interface of the target application. The other interface can be the interface of another application, or it can be an interface provided by the target application that is different from the relevant interface.

[0069] As an example, referring to FIG. 2a , if the target application's interface is a desktop 210 including a dynamic wallpaper 211 displayed on the desktop, the other interface may be an interface opened when a user clicks an application icon such as "Shop" or "Video" on the desktop 210, such as a chat interface of an instant messaging application, a video playback interface of a short video application or a video application, etc. The other interface may also be the homepage or settings interface of a dynamic wallpaper application opened when a user clicks the "Dynamic Wallpaper" application icon 212 on the desktop 210, without limitation.

[0070] In some embodiments, the mobile phone 100 may also support a display mode for displaying the open application interface in a small window mode. In this scenario, when the user operates on the desktop of the mobile phone 100 to open the interface of some applications, he may choose to use the small window mode to display the interface of the application, while the desktop of the mobile phone 100 still needs to be displayed. For this situation, the mobile phone 100 can determine whether to continue to execute the following step 305 to respond to the above-mentioned second user operation detected based on the judgment result of whether the current display mode is the small window mode. For example, when the mobile phone 100 detects the above-mentioned second user operation, if it is judged that the current display mode is the small window mode, it may not respond to the detected second user operation, that is, it may not continue to execute the subsequent steps 305, etc. On the contrary, when the mobile phone 100 detects the above-mentioned second user operation, if it is judged that the current display mode is not the small window mode, it may respond to the detected second user operation and continue to execute the subsequent steps 305, etc. I will not go into details here.

[0071] 305: Determine whether there are releasable resources in the memory resources occupied by the target application.

[0072] If the judgment result is yes, that is, there are releasable resources, then the following step 306 may be executed to release the memory resources.

[0073] If the judgment result is no, that is, there are no releasable resources or all resources are non-releasable resources, then the following step 310 may be executed to end this process.

[0074] For example, when the mobile phone 100 allocates the required memory resources to the target application in step 302, the system may add a status mark to the memory resources to record that the memory resources have been allocated to the corresponding application. The status mark may also include information about the entity that can manage the memory resources, such as system identification information, application identification information, etc.

[0075] It can be understood that the above process of allocating the required memory resources to the target application can be implemented in the form of a buffer. Part of the memory resources can be GPU memory, ION memory, and other memory resources required during the operation of the target application. Referring to Buffer1 in the Buffer resources shown in Figure 4, this part of the memory resources can be managed by the application, and the corresponding status mark can carry the corresponding application identification information. The other part of the memory resources can be GPU memory, ION memory, etc. used to support the target application to display related interfaces. Referring to Buffer0 shown in Figure 4, this part can be managed and scheduled by the system, and the corresponding status mark can carry system identification information.

[0076] Thus, when executing the determination process of step 305, the mobile phone 100 can determine which memory resources are system-managed memory resources based on the identification information carried by the memory resources occupied by the target application, and can then determine these system-managed memory resources as releasable resources. In other embodiments, the mobile phone 100 can also identify releasable resources in the memory resources occupied by the target application based on other identification information on the relevant memory resources, which is not limited here.

[0077] 306: Delete the cached content in the releasable resources to release the memory resources.

[0078] For example, for releasable resources, the mobile phone 100 can execute corresponding resource recovery instructions, such as the relevant instructions provided by the garbage collection mechanism (GC), to delete the cached content in the GPU memory and ION memory, and reclaim these resources into the resource pool. In this way, when other applications need to request memory resources, these released memory resources can be allocated by the system to other applications, which is conducive to improving the memory usage efficiency in the system.

[0079] 307: A third user operation instructing to switch back to displaying the target application-related interface is detected.

[0080] For example, the user can switch back to the desktop or enter the lock screen interface on other interfaces displayed on the mobile phone 100. Accordingly, the mobile phone 100 can detect the user operation indicating the switch back to the desktop or lock screen interface. In the embodiment of the present application, this user operation can be recorded as the third user operation mentioned above.

[0081] It is understood that when the mobile phone 100 detects the user operation indicating switching back to the desktop or lock screen, it indicates that the dynamic wallpaper application needs to redraw and render the dynamic wallpaper displayed on the desktop or lock screen through the system. At this time, since the releasable resources in the memory resources occupied by the dynamic wallpaper application have been released, the mobile phone 100 needs to continue to perform the following step 308 to reallocate the released memory resources to the dynamic wallpaper application.

[0082] 308: Reallocate the released memory resources to the target application.

[0083] For example, when the mobile phone 100 detects a user instruction to switch back to displaying a target application interface such as the desktop or lock screen, it can reallocate memory resources for the target application such as the desktop and the dynamic wallpaper application to redraw the dynamic wallpaper and other content displayed on the desktop or lock screen. The size and related configuration parameters of the reallocated memory resources can be the same as the memory resources released by the target application.

[0084] It is understood that the memory resources reallocated by the mobile phone 100 for the target application at this time may be the same portion as the memory resources released in step 306, or may be different portions. For example, the cache resources reallocated by the mobile phone 100 at this time and released in step 306 may both be the same Buffer0 shown in FIG. 4 , or may be different Buffer0s shown in FIG. 4 , without limitation.

[0085] 309: Redraw relevant interface elements for the target application using the reallocated memory resources.

[0086] For example, after reallocating the released portion of memory resources to the target application, the mobile phone 100 can use the memory resources to load drawing and rendering resources to redraw relevant interface elements (such as dynamic wallpaper) of the target application.

[0087] Then, the mobile phone 100 may execute the following step 310 to end this process, or continue to execute the memory management process of the above steps 303 to 308, which is not limited here.

[0088] It is understandable that after the mobile phone 100 executes this step 309, it can display the redrawn related interface. The related interface can refer to the corresponding example desktop 210 or lock screen interface 220 in the above step 303, etc., which will not be repeated here.

[0089] 310: End this process.

[0090] For example, if the mobile phone 100 determines that the memory resources occupied by the target application are not available for release during step 305, the memory management process may be terminated. Alternatively, after completing step 309, the mobile phone 100 may display the redrawn interface and execute step 310 to terminate the process. This is not a limitation.

[0091] Based on the execution of steps 301 to 310 above, the memory management method provided by this application can promptly release some memory resources occupied by applications running in the background, such as the releasable resources in GPU memory, ION memory, and other memory resources that continue to be occupied by the dynamic wallpaper application after entering the background. This helps improve the efficiency of memory resource usage in electronic devices such as mobile phones and also helps optimize the system's efficiency in managing memory resources.

[0092] FIG5 a shows a schematic diagram of the distribution of GPU memory resources occupied by the mobile phone 100 when the mobile phone 100 runs a dynamic wallpaper application and displays a dynamic wallpaper according to an embodiment of the present application.

[0093] As shown in Figure 5a, the total amount of GPU memory occupied by the dynamic wallpaper application can be 272.9984MB, including 0.77824MB occupied by the buffer (arraybuffer), 12.73856MB occupied by the drawing command (command), 114.2784MB occupied by the off-screen buffer (egl_surface), 34.69312MB occupied by other display-related buffers (gl), 73.35936MB occupied by the texture generator (texture), and 37.15072MB occupied by other (any(0)) parts. Among them, based on the memory management method provided by the present application, when the dynamic wallpaper application enters the background, the GPU memory that can be released by the mobile phone 100 can include the 114.2784MB occupied by the above-mentioned off-screen buffer (egl_surface), 34.69312MB occupied by other display-related buffers (gl), and 73.35936MB occupied by the texture generator (texture), totaling 222.33088MB.

[0094] FIG5 b shows a schematic diagram of the distribution of ION memory resources occupied by the mobile phone 100 when the dynamic wallpaper application is running and displaying the dynamic wallpaper according to an embodiment of the present application.

[0095] As shown in Figure 5b, the dynamic wallpaper application calls the multimedia service (omx@1.0-service) to display the dynamic wallpaper, and the corresponding occupied ION memory can be 442.715MB, including 144.234MB occupied by the dynamic wallpaper (wallpaper), 144.234MB occupied by display-related (vendor) data, and 272.203MB occupied by the interface synthesizer (surfaceflinger). Among them, based on the memory management method provided by this application, when the dynamic wallpaper application enters the background, the ION memory that can be released by the mobile phone 100 may include part of the memory resources in the 144.234MB occupied by the above-mentioned dynamic wallpaper. It can be understood that some of the memory resources occupied by the above-mentioned dynamic wallpaper may be the same as some of the memory resources occupied by other services or data, that is, duplicated memory resources. The above-mentioned released ION memory may be the memory resources that do not include this part of the duplicated occupied part.

[0096] It can be understood that the amount of memory resources occupied by the above-mentioned dynamic wallpaper application can be identified from the memory resources occupied by the launcher process based on the difference between the process number of the process corresponding to the dynamic wallpaper application and the process number corresponding to the launcher process. When the mobile phone 100 displays a desktop with dynamic wallpaper, the system of the mobile phone 100 will have a launcher process and a dynamic wallpaper process at the same time, wherein the dynamic wallpaper process can run in the launcher process. As an example, the process number of the launcher process is, for example, 2432, and the process number of the dynamic wallpaper process is, for example, 16041. Furthermore, developers of electronic devices such as mobile phones can read the amount of memory resources respectively occupied by the launcher process and the dynamic wallpaper process in the system of the mobile phone 100 by carrying relevant instructions with the above-mentioned process numbers, and then analyze and obtain the memory resource distribution table illustrated in the above-mentioned Figures 5a and 5b.

[0097] Based on the distribution of releasable resources in GPU memory and ION memory shown in Figures 5a and 5b above, it can be seen that the memory management method provided by this application can release a large portion of the memory resources occupied by the dynamic wallpaper application. When the dynamic wallpaper application enters the background, the released memory resources can be provided to other applications that need to run in the foreground to display related interfaces, thereby effectively improving the efficiency of memory resource utilization.

[0098] In order to more clearly understand the memory management solution provided by the present application, the specific implementation process of the memory management method provided by the present application in the operating system running on electronic devices such as mobile phones is introduced in detail below with reference to relevant drawings.

[0099] FIG6 shows a schematic diagram of a system software structure of an electronic device according to an embodiment of the present application.

[0100] It is understood that the operating system of an electronic device such as the mobile phone 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. TM Taking the system as an example, the system software structure of the mobile phone 100 is illustrated.

[0101] It can be understood that the layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, Android TM The system is divided into four layers, from top to bottom: application layer 610, application framework layer 620, Android TM Runtime 640 (Android TM runtime) and system libraries 630, and kernel layer 650.

[0102] As shown in Figure 6, the application layer 610 may include a series of application packages. The application packages may include the above-mentioned dynamic wallpaper, desktop, system user interface (system UI), camera, call, navigation, WLAN, Bluetooth, music, video, short message and other applications. Among them, the dynamic wallpaper application can provide the function of displaying dynamic wallpaper on the desktop. The system can run the desktop application through the launcher process to display the desktop or lock screen interface, and can also run the dynamic wallpaper application through the launcher process to provide the above-mentioned function of displaying dynamic wallpaper.

[0103] The application framework layer 620 provides an application programming interface (API) and a programming framework for the applications of the application layer 610. The application framework layer 620 includes some predefined functions.

[0104] In an embodiment of the present application, the application framework layer 620 may include a window manager service 621 (WMS), an activity manager service 622 (AMS), a rendering thread 623 (render thread), a resource management service 624, a notification management service, a view system, etc.

[0105] Among them, the window management service 621 (WMS) can be used to manage window programs. The window program can be any application currently running in the foreground and displaying the relevant interface, such as a desktop application and a dynamic wallpaper application. The window management service 621 can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc. In an embodiment of the present application, the window management service 621 can obtain information related to the application running in the foreground and provide it to the activity management service 622, so that the activity management service 622 can determine whether the application displaying the relevant interface in the current window is the target application, or determine whether the above-mentioned first user operation indicating the display of the target application-related interface, the second user operation indicating the display of other interfaces, and the third user operation indicating the switch back to the display of the target application-related interface are detected.

[0106] The activity management service 622 (AMS) can be used to manage activity events triggered by user operations detected by the system, also known as operation events. In an embodiment of the present application, the activity management service 622 can determine whether the first user operation indicating the display of the target application-related interface, the second user operation indicating the display of other interfaces, and the third user operation indicating the switch back to the display of the target application-related interface are detected based on the changes in relevant information of the application to which the interface displayed in the current window belongs provided by the window management service 621. In addition, the activity management service 622 can trigger the implementation of other related steps shown in Figure 3 above based on the detected first user operation, second user operation, or third user operation. For details, please refer to the relevant description of the process shown in Figure 3 above, which will not be repeated here.

[0107] The rendering thread 623 can be called by the window management service 621 to provide the target application with the ability to draw and render related interfaces. In an embodiment of the present application, the rendering thread 623 can respond to the call of the window management service 621 to draw and render dynamic wallpapers for the dynamic wallpaper application to display on the desktop or lock screen interface.

[0108] The resource management service 624 provides various resources for the application, such as localized strings, icons, images, layout files, video files, etc. In the embodiment of the present application, the resource management service 624 can also provide memory resource management functions for the application, manage the allocation and recycling of corresponding memory resources, etc.

[0109] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.

[0110] The Notification Management Service enables applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically, without requiring user interaction. For example, the Notification Management Service is used to notify users of completed downloads and message reminders. The Notification Management Service can also display notifications in the system's top status bar as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include text messages in the status bar, audible alerts, vibrations on electronic devices, and flashing indicator lights.

[0111] Android TM Runtime includes core libraries and virtual machines. Android TM runtime is responsible for Android TM System scheduling and management.

[0112] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

[0113] The application layer 610 and the application framework layer 620 run in a virtual machine. The virtual machine executes the Java files in the application layer 610 and the application framework layer 620 as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0114] The system library 630 may include multiple functional modules, such as a surface manager, media libraries, a 3D graphics processing library (e.g., OpenGL ES), and a 2D graphics engine (e.g., SGL). In this embodiment of the present application, the 3D graphics processing library (e.g., OpenGL ES) may support the operation of the rendering thread 623 and complete the rendering process of interface elements such as dynamic wallpapers.

[0115] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.

[0116] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0117] The 3D graphics processing library is used to implement 3D graphics drawing, graphics rendering, compositing, and layer processing.

[0118] A 2D graphics engine is a drawing engine for 2D drawings.

[0119] The kernel layer 650 is a layer between hardware and software and includes at least a display driver, a camera driver, an audio driver, a sensor driver, and a touch driver.

[0120] With reference to FIG6 above, electronic devices such as mobile phone 100 can implement the memory management method provided in this application based on the above-mentioned system software structure. For example, mobile phone 100 can receive system monitoring events based on activity management service 622, which may include user operation events on the interface of the corresponding application. The user performs the above-mentioned first user operation, second user operation or third user operation on the interface of the corresponding application displayed on mobile phone 100, and the structure providing the relevant interface in the kernel layer 650 or the system library 630 in the operating system of mobile phone 100 can report the corresponding event information to activity management service 622. Activity management service 622 can then determine whether the corresponding event detected by the system is an operation of the user on the relevant interface based on the received event information, that is, execute the relevant contents of steps 301, 304 and 307 shown in FIG3 above.

[0121] Furthermore, when the first user operation is detected, the mobile phone 100 can continue to execute step 302 shown in Figure 3 above based on the above-mentioned activity management service 622, and apply to the resource management service 624 for allocation of memory resources such as GPU memory and ION memory for the dynamic wallpaper application running in the application layer 610. After allocating memory resources, the activity management service 622 can notify the launcher process running the dynamic wallpaper application to call the system's drawing and rendering process, such as the above-mentioned rendering thread 623, to draw and render the dynamic wallpaper. In addition, the activity management service 622 can also notify the system UI of the application layer 610 to call the window management service 621 to display the dynamic wallpaper that has been drawn and rendered, that is, to execute the content of the display-related interface corresponding to the above-mentioned step 303.

[0122] While the mobile phone 100 is displaying the desktop, the activity management service 622 may continue to execute step 304 to detect a second user operation. If a second user operation is detected, it can be determined that the dynamic wallpaper application will enter the background. The mobile phone 100 may then continue to execute step 305 based on the activity management service 622 and request the system resource management service 624 to execute step 306 to reclaim the releasable resources.

[0123] While the mobile phone 100 is displaying other interfaces, the third user operation can be detected by executing step 307 based on the activity management service 622. If the third user operation is detected, it can be determined that the dynamic wallpaper application needs to be on the desktop or lock screen interface again. The mobile phone 100 can then continue to execute the memory reconstruction process described in steps 308 to 309 to display the desktop including the dynamic wallpaper interface elements again.

[0124] Based on the system software structure shown in FIG6 , the specific implementation process of the memory management method provided by the present application in the operating system of electronic devices such as mobile phones will be described in detail below in conjunction with FIG7 .

[0125] FIG7 shows a schematic diagram of an implementation process of a memory management method in a system of an electronic device according to an embodiment of the present application.

[0126] As shown in Figure 7, when the system detects a user operation indicating entry to the desktop or lock screen interface, such as detecting the first user operation described above, the launcher process in the system can run a desktop application to display the desktop or lock screen interface, and can run a dynamic wallpaper application to display a dynamic wallpaper on the displayed desktop or lock screen interface. Referring to process ① executed by the launcher process shown in Figure 7, during the process of the launcher process running the dynamic wallpaper application to display the dynamic wallpaper, the dynamic wallpaper application can occupy part of the system's GPU memory for graphics rendering, ION memory for caching video streams for video stream playback, and other types of memory.

[0127] When the system detects a user operation indicating a switch to the interface of another application, such as the second user operation mentioned above, the launcher process in the system can run the application corresponding to the operation and display the interface of the application. At this time, since the desktop or lock screen interface is no longer displayed, the dynamic wallpaper does not need to be displayed. Therefore, referring to the process ② of the launcher process execution shown in Figure 7, the launcher process in the system can release some of the releasable resources such as the releasable GPU memory and releasable ION memory in the memory resources occupied by the dynamic wallpaper application. It can be understood that the dynamic wallpaper application also needs to occupy a part of the non-releasable resources when running in the launcher process, such as other GPU memory, other ION memory and other types of memory shown in Figure 7, which are used to cache the instructions, data, etc. required for the operation of the dynamic wallpaper application.

[0128] Continuing to refer to process ③ shown in Figure 7, while other applications are running, the system's drawing and rendering resources can be provided to the other applications on a priority basis to support the other applications in responding to user operations on the relevant interfaces of the applications, i.e., the "in-application operations" shown in Figure 7.

[0129] When the system detects the user operation of switching back to the desktop or lock screen interface again, for example, when the above-mentioned third user operation is detected, the desktop application run by the launcher process in the system can display the desktop or lock screen interface again through the window management service 621 provided by the system, and the dynamic wallpaper application run by the Launcher process can now regain the allocated memory resources based on the launcher process and rebuild the dynamic wallpaper. Referring to process ④ executed by the launcher process shown in Figure 7, the launcher process can call the system's drawing and rendering based on the releasable GPU memory, releasable ION memory and other memory resources reallocated by the system for the dynamic wallpaper application, redraw the dynamic wallpaper and display the redrawn dynamic wallpaper together with the desktop or lock screen interface. In some embodiments, the above process ④ executed by the launcher process can also be briefly described as the process of "rebuilding memory", which is not limited here.

[0130] FIG8 shows a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application.

[0131] As shown in Figure 8, the electronic device 800 may include a processor 810, an external memory interface 820, an internal memory 821, a universal serial bus (USB) interface 830, a charging management module 840, a power management module 841, a battery 842, an antenna 1, an antenna 2, a mobile communication module 850, a wireless communication module 860, an audio module 870, a speaker 870A, a receiver 870B, a microphone 870C, an earphone interface 870D, a sensor module 880, a button 890, a motor 891, an indicator 892, a camera 893, a display screen 894, and a subscriber identity module (SIM) card interface 895, etc. The sensor module 880 may include a pressure sensor 880A, a gyroscope sensor 880B, an air pressure sensor 880C, a magnetic sensor 880D, an acceleration sensor 880E, a distance sensor 880F, a proximity light sensor 880G, a fingerprint sensor 880H, a temperature sensor 880J, a touch sensor 880K, an ambient light sensor 880L, a bone conduction sensor 880M, etc.

[0132] It is understood that the electronic device 800 may be the mobile phone 100 or other user terminal electronic device. The structure shown in the embodiment of the present invention does not constitute a specific limitation on the electronic device 800. In other embodiments of the present application, the electronic device 800 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0133] The processor 810 may include one or more processing units. For example, the processor 810 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0134] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0135] In an embodiment of the present application, the processor 810 can control the execution of each step in the process shown in FIG. 3 above through the controller to implement the memory management method provided by the present application, timely release the memory resources of the electronic device 800, and improve the performance of the electronic device 800. The specific execution process can be referred to the description of the relevant steps in the process shown in FIG. 3 above, and will not be repeated here.

[0136] Processor 810 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 810 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 810. If processor 810 needs to use the same instruction or data again, it can directly access it from the memory. This avoids duplicate accesses, reduces processor 810 latency, and thus improves system efficiency.

[0137] In some embodiments, the processor 810 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM card interface, and / or a universal serial bus (USB) interface.

[0138] USB interface 830 is an interface that complies with USB standards and specifications, and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. USB interface 830 can be used to connect a charger to charge electronic device 800, or to transfer data between electronic device 800 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as AR devices.

[0139] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 800. In other embodiments of the present application, the electronic device 800 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0140] The charging management module 840 is used to receive charging input from the charger. The power management module 841 is used to connect the battery 842, the charging management module 840 and the processor 810. The power management module 841 receives input from the battery 842 and / or the charging management module 840, and provides power to the processor 810, the internal memory 821, the display 894, the camera 893, and the wireless communication module 860. The power management module 841 can also be used to monitor parameters such as battery capacity, battery cycle count, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 841 can also be set in the processor 810. In other embodiments, the power management module 841 and the charging management module 840 can also be set in the same device.

[0141] The wireless communication function of the electronic device 800 can be implemented through antenna 1, antenna 2, mobile communication module 850, wireless communication module 860, modem processor and baseband processor.

[0142] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 800 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0143] The mobile communication module 850 can provide wireless communication solutions including 2G / 3G / 4G / 5G applied on the electronic device 800.

[0144] The wireless communication module 860 can provide wireless communication solutions for application on the electronic device 800, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.

[0145] Electronic device 800 implements display functionality through a GPU, display screen 894, and an application processor. The GPU is a microprocessor for image processing that connects display screen 894 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 810 may include one or more GPUs that execute program instructions to generate or modify display information.

[0146] Display screen 894 is used to display images, videos, and the like. Display screen 894 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini-LED, a Micro-LED, a Micro-OLED, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 800 may include one or N display screens 894, where N is a positive integer greater than one.

[0147] The electronic device 800 can implement a shooting function through an ISP, a camera 893, a video codec, a GPU, a display 894, and an application processor. The ISP is used to process data fed back by the camera 893. The camera 893 is used to capture still images or videos.

[0148] Digital signal processors are used to process digital signals. In addition to processing digital image signals, they can also process other digital signals.

[0149] Video codecs are used to compress or decompress digital video. Electronic device 800 may support one or more video codecs. This allows electronic device 800 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.

[0150] The external memory interface 820 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 800. The external memory card communicates with the processor 810 via the external memory interface 820 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0151] The internal memory 821 can be used to store computer executable program code, which includes instructions. The internal memory 821 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device 800 (such as dynamic wallpaper, etc.), etc. In addition, the internal memory 821 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, a universal flash storage (UFS), etc. The processor 810 executes various functional applications and data processing of the electronic device 800 by running instructions stored in the internal memory 821 and / or instructions stored in a memory provided in the processor.

[0152] In the embodiment of the present application, the internal memory 821 can provide the memory space required for application execution. This memory space can be allocated by the system to the corresponding application in the form of one or more buffers. These buffers can be freely combined to form GPU memory or ION memory of different sizes for caching instructions and data, etc., and can also be used to cache user interface elements drawn, such as the dynamic wallpaper, without limitation.

[0153] The electronic device 800 can implement audio functions such as music playback and recording through the audio module 870, speaker 870A, receiver 870B, microphone 870C, headphone jack 870D, and application processor.

[0154] The pressure sensor 880A is used to sense pressure signals and convert them into electrical signals. In some embodiments, the pressure sensor 880A can be set on the display screen 894. There are many types of pressure sensors 880A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a device comprising at least two parallel plates with conductive material. When force acts on the pressure sensor 880A, the capacitance between the electrodes changes. The electronic device 800 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 894, the electronic device 800 detects the intensity of the touch operation based on the pressure sensor 880A. The electronic device 800 can also calculate the position of the touch based on the detection signal of the pressure sensor 880A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions.

[0155] The touch sensor 880K is also referred to as a "touch-sensitive device." The touch sensor 880K can be disposed on the display screen 894. The touch sensor 880K and the display screen 894 form a touch screen, also referred to as a "touch screen." The touch sensor 880K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 894. In other embodiments, the touch sensor 880K can also be disposed on the surface of the electronic device 800, at a location different from that of the display screen 894.

[0156] Keys 890 include a power button, a volume button, and the like. Keys 890 may be mechanical keys or touch-sensitive keys. Electronic device 800 may receive key inputs and generate key signal inputs related to user settings and function control of electronic device 800.

[0157] Motor 891 can generate vibration prompts. Motor 891 can be used for incoming call vibration prompts, as well as touch vibration feedback. For example, touch operations on different applications (such as taking photos, playing audio, etc.) can correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.

[0158] Indicator 892 can be an indicator light, which can be used to indicate charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc.

[0159] The SIM card interface 895 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 800 by inserting or removing the SIM card into or from the SIM card interface 895.

[0160] The following is an example of the workflow of the software and hardware of the electronic device 800, with reference to a user operation scenario of switching from displaying the desktop to displaying other interfaces.

[0161] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, touch operation timestamp and other information). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer and identifies the control corresponding to the input event. For example, if the touch operation is a single-click operation on an icon of an application displayed on the desktop, and the control corresponding to the single-click operation is the control of the application icon, the application calls the interface of the application framework layer and calls the system UI control to display an interface different from the desktop.

[0162] The embodiments of the present application also provide a computer program product for implementing the memory management methods provided in the above embodiments.

[0163] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. The embodiments of the present application can be implemented as computer program modules or module codes executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0164] A computer program module or module code can be applied to input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.

[0165] Module code can be implemented with high-level modular language or object-oriented programming language to communicate with the processing system. When necessary, module code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.

[0166] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, instructions may be distributed over a network or through other computer-readable media. Therefore, a machine-readable medium may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including but not limited to a floppy disk, an optical disk, an optical disk, a magneto-optical disk, a read-only memory (ROM), a random access memory (RAM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic card or an optical card, a flash memory, or a tangible machine-readable memory for transmitting information (e.g., a carrier wave, an infrared signal, a digital signal, etc.) using the Internet in an electrical, optical, acoustic, or other form of propagation signal. Accordingly, machine-readable media includes any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (eg, a computer).

[0167] References in the specification to "one embodiment" or "an embodiment" mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one exemplary implementation or technique disclosed according to the embodiment of the present application. The appearances of the phrase "in one embodiment" in various places in the specification do not necessarily all refer to the same embodiment.

[0168] The disclosure of the embodiments of the present application also relates to an operating device for executing the text. The device can be constructed specifically for the required purpose or it can include a general-purpose computer that is selectively activated or reconfigured by a computer program stored in the computer. Such a computer program can be stored in a computer-readable medium, such as, but not limited to, any type of disk, including a floppy disk, an optical disk, a CD-ROM, a magneto-optical disk, a read-only memory (ROM), a random access memory (RAM), an EPROM, an EEPROM, a magnetic or optical card, an application-specific integrated circuit (ASIC) or any type of medium suitable for storing electronic instructions, and each can be coupled to a computer system bus. In addition, the computer mentioned in the specification can include a single processor or can be an architecture involving multiple processors for increased computing power.

[0169] In addition, the language used in this specification has been primarily selected for readability and instructional purposes and may not be selected to describe or limit the disclosed subject matter. Therefore, the present disclosure of embodiments is intended to illustrate, not to limit, the scope of the concepts discussed herein.

Claims

1. A memory management method, applied to an electronic device, characterized in that: The method comprises: Displaying a first application interface of a first application, wherein the first application interface includes playing a first animation; A first user operation is detected, a second application interface of a second application is displayed, and the first application interface enters an inactive state; A first portion of memory resources occupied by the first application is released, wherein the first portion of memory resources includes a storage space corresponding to the first animation.

2. The method according to claim 1, characterized in that: The method further comprises: A second user operation instructing to switch back to displaying the first application interface is detected, and a second portion of memory resources is allocated to the first application, wherein: The second portion of memory resources is of the same type and has the same space size as the first portion of memory resources, and the second portion of memory resources includes storage space provided for the first animation.

3. The method according to claim 1, characterized in that The first application interface enters an inactive state, including: The first application interface is not displayed, and the first animation is in an unplayed state.

4. The method according to claim 1, characterized in that: The releasing the first part of memory resources occupied by the first application includes: Determining that the first part of memory resources meets a release condition, releasing the first part of memory resources; wherein, The release condition is related to the type of the first portion of memory resources and / or the type of data related to the first animation stored in the first portion of memory resources.

5. The method according to claim 4, characterized in that The types of the first part of memory resources include GPU memory and / or ION memory, wherein: The GPU memory is used to store resources required for the GPU of the electronic device to perform a rendering process of the first animation: The ION memory is used to store the video stream data corresponding to the first animation.

6. The method according to claim 5, characterized in that The electronic device is installed with a third application, and The third application is used to provide a first animation played on the first application interface, wherein the third application runs in a process corresponding to the first application, and the third application and the first application are different applications.

7. The method according to claim 6, characterized in that The type of data related to the first animation stored in the first part of the memory resources does not include instructions related to the running of the third application.

8. The method according to any one of claims 1 to 7, characterized in that The first application includes a desktop application, and the first animation includes a dynamic wallpaper.

9. The method according to any one of claims 1 to 7, characterized in that The resources occupied by the first application also include a third portion of memory resources that cannot be released, wherein the third portion of memory resources includes storage space corresponding to instructions related to the running of the first application.

10. The method according to any one of claims 1 to 7, characterized in that The first part of memory resources is memory resources managed by the system of the electronic device.

11. An electronic device, characterized in that: include: one or more processors; One or more memories; the one or more memories store one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device executes the memory management method described in any one of claims 1 to 10.

12. A computer-readable medium, characterized in that The readable medium stores instructions, which, when executed on a computer, enable the computer to execute the memory management method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Method and device for optimizing memory

    CN104375828A

  • Method and device for managing internal memory

    CN104407981A

  • Application switching method and device

    CN114153570A

Cited By

  • Memory optimization system for intelligent health care accompanying robot

    CN119829294A