Memory management method, electronic equipment and storage medium
By detecting and displaying the storage space occupancy of each application in the graphics rendering service, the problem that users cannot optimize according to the specific occupancy of each application is solved, and more efficient memory management is achieved.
Patent Information
- Application Number
- CN202311468962.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-03
- Publication Date
- 2025-05-06
AI Technical Summary
During the graphics rendering service, users cannot optimize the application based on the specific occupation of each application, because they can only view the overall occupation of GPU memory.
By detecting the viewing instructions of the memory in the image processor, the memory storage results are displayed, including the size of the memory space occupied by each application in multiple applications, and the user can optimize according to the specific occupancy of each application.
This enables users to accurately view the storage space usage of each application, so that they can optimize the application in a targeted manner and improve the efficiency of memory management.
Smart Images

Figure CN119938434A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of memory technology, and in particular to a memory management method, electronic device and storage medium. Background Art
[0002] When the graphics rendering service (RenderService) renders an image, the rendering data corresponding to the image needs to be stored in the GPU memory. Currently, when checking the GPU memory usage, you can only view the overall GPU memory usage, such as the total memory occupied by multiple applications, which makes it impossible for users to optimize applications based on the specific usage of each application. Summary of the invention
[0003] To solve the problem of low configuration efficiency, an embodiment of the present application provides a memory management method, an electronic device, and a storage medium.
[0004] In a first aspect, the present application provides a memory management method for an electronic device, the electronic device comprising an image processor, and the memory management method comprises: detecting an instruction to view a memory in the image processor; and displaying a storage result of the memory, wherein the storage result comprises the size of storage space occupied by each application in the memory among multiple applications.
[0005] Based on the above solution, when checking the memory usage of the terminal device, the storage space occupied by each application can be counted according to the application tags stored in the memory, so that the user can view the storage space occupied by each application and optimize the application according to the storage space occupied by each application.
[0006] It is understood that the memory viewing instruction in the image processor may also be referred to as a memory viewing instruction, and the memory viewing instruction may be a memory viewing instruction for the memory in the image processor. In some optional examples, the memory viewing instruction may refer to a generation instruction, such as a jump instruction.
[0007] In some optional instances, the application to which the image data stored in each storage space belongs can be determined based on the application label of the image data stored in each storage space in the memory of the image processor, such as the process number, and then the storage space of the image data of different applications can be counted to obtain the memory storage result.
[0008] In other optional instances, the application window to which the image data stored in each storage space belongs can be determined based on the application tags of the image data stored in each storage space in the memory of the image processor, such as the process number, thread number, window identification number, and drawing function identification number, and then the storage space of the image data of different application windows can be counted to obtain the memory storage result.
[0009] In some optional examples of the first aspect, the storage result of the memory is determined based on an application tag of the image data stored in each storage space in the memory.
[0010] In some optional instances of the first aspect, the storage result of the memory is determined in the following manner: based on the application label of the image data stored in each storage space in the memory, the application to which the image data stored in each storage space belongs is determined; the storage space occupied by different applications is counted to obtain the size of the storage space occupied by the image data of each application.
[0011] In some optional instances of the first aspect, the application tag includes a first application tag, and the method further includes: when running the first application, the kernel assigns the first application tag to the first image data corresponding to the first application, and the first application tag indicates that the first image data belongs to the first application.
[0012] It can be understood that under the unified rendering framework, the content required to be drawn by each application in multiple applications can be uniformly sent to a rendering service (such as RenderService), and then the RenderService can be used to render graphics. For example, the content required to be drawn by the first application window win1 of the first application can be sent to the RenderService, the content required to be drawn by the second application window win2 of the first application can be sent to the RenderService, and the content required to be drawn by the third application window win3 of the second application can be sent to the RenderService.
[0013] Furthermore, RenderService can generate a call instruction according to the content that each application needs to draw, for example, a call instruction "render win1" is generated according to the content that the first application window win1 of the first application needs to draw, a call instruction "render win2" is generated according to the content that the second application window win2 of the first application needs to draw, and a call instruction "render win3" is generated according to the content that the third application window win3 of the second application needs to draw. The call instruction can be used to indicate the call of the drawing function of the required drawing content.
[0014] Then, RenderService can send the call instruction to the graphics library (such as skia), and the graphics library can call the drawing function corresponding to the content to be drawn according to the call instruction corresponding to the content to be drawn by each application, and generate the drawing instruction. For example, the first application window of the first application needs to draw a rectangle, skia can call the drawing function "drawRect()", and generate "drawing instruction newGrOp(1)" based on the called drawing function "drawRect()", where "1" can represent the drawing function "drawRect()".
[0015] When the process corresponding to the application is running, the kernel can assign an application tag to the application. In some specific implementations, the kernel can assign a process number to the application according to the running order of the process corresponding to the application. The process number can be a positive number and is the unique identity of the application. For example, the kernel can assign process numbers to the application starting from 1 until the maximum process number of the system, for example, the maximum process number of a 32-bit system is 32768, and the maximum process number of a 64-bit system is 4194304.
[0016] In some optional instances of the first aspect, corresponding to the image data being image data of an application window, the application tag includes an application process number, an application thread number, a window number of the application window, and an identification number of a drawing function.
[0017] It can be understood that when the process corresponding to the application is running, the kernel can assign an application tag to the application. In some specific implementations, the kernel can assign a process number to the application according to the running order of the process corresponding to the application. The process number can be a positive number and is the unique identity of the application. For example, the kernel can assign process numbers to the application starting from 1 until the maximum process number of the system, for example, the maximum process number of a 32-bit system is 32768, and the maximum process number of a 64-bit system is 4194304.
[0018] In some optional instances, the application tag of the application may be expressed in the form of [Pid], where Pid may represent a process number. For example, when the first application is started first and then the second application is started, where the first application first displays the first application window (e.g., the homepage) and then displays the second application window (e.g., the inner page), the kernel may assign the process number "1" to the first application window win1 of the first application, assign the process number "2" to the second application window win2 of the first application, and assign the process number "3" to the third application window win3 of the second application.
[0019] In some other specific implementations, since a process may include multiple threads, the kernel may also assign a thread number to the application as part of the application tag. For example, the kernel may assign thread numbers to the application starting from 1.
[0020] In some optional instances of the first aspect, the image data stored in the memory of the image processor includes at least one of a text texture, a mask from a software rendering path Path to a texture, a path object, a pixel effect mask, a Texture image texture, a mask for a rounded blur effect, and a vertex array.
[0021] It can be understood that when the process corresponding to the application is running, the kernel can also allocate GPU memory resources for the application, that is, allocate storage space for storing data to be rendered for the application. For example, the resource allocation function "new gpuresource(1)" can be called to allocate GPU resource "gpu1" for the first application window, GPU resource "gpu2" for the second application window, and GPU resource "gpu3" for the third application window, and store the application's data to be rendered and the application tag in the storage space allocated for the application, such as storing the application's data to be rendered and the application's process number, thread number, window identification number, and drawing function identification number in the storage space allocated for the application, so that when checking the occupancy of the device's GPU memory, the storage space specifically occupied by each application window can be counted according to the application tag stored in the GPU memory, so that the user can view the specific storage space occupied by each application window, and optimize the application according to the specific storage space occupied by each application window. In this way, in the rendering process of the application, by allocating GPU memory resources to the application, when the user checks the specific occupancy of the GPU memory, the occupancy of each GPU can be accurately viewed. Furthermore, when a GPU memory leak occurs, the complexity of the drawing logic can be checked based on the occupancy of each GPU. In addition, when the GPU memory occupancy is greater than the occupancy threshold, the application can be optimized in a targeted manner.
[0022] In some optional instances of the first aspect, the storage result of the memory is displayed in any form of a file, a table, a document, a column chart, a pie chart, or a bar chart.
[0023] In some optional instances of the first aspect, the method also includes: when a drawing request of a first application is detected, drawing first image data of the first application, and assigning a first application tag to the first image data; storing the first image data and the first application tag in a first storage space of the memory.
[0024] In a second aspect, the present application provides an electronic device, comprising: a memory for storing instructions executed by one or more processors of the electronic device, and a processor, which is one of the one or more processors of the electronic device, for executing the memory management method mentioned in the present application.
[0025] In a third aspect, the present application provides a readable storage medium having instructions stored thereon, which, when executed on an electronic device, enables the electronic device to execute the memory management method mentioned in the present application.
[0026] In a fourth aspect, an embodiment of the present application provides a computer program product, including: a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium containing a computer program code for executing the memory management method mentioned in the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 According to some examples of the present application, an internal structure of an image processor is shown;
[0028] Figure 2 According to some examples of the present application, a schematic diagram of the total memory occupied in real time by a memory block included in an electronic device is shown;
[0029] Figure 3 According to some examples of the present application, a flowchart of a memory management method is shown;
[0030] Figure 4 According to some examples of the present application, a schematic diagram of a framework of a memory management method is shown;
[0031] Figure 5 According to some examples of the present application, a schematic diagram of the hardware structure of a computer is shown. DETAILED DESCRIPTION
[0032] The illustrative embodiments of the present application include, but are not limited to, a memory management method, an electronic device, and a storage medium.
[0033] It can be understood that the memory management method mentioned in the embodiments of the present application can be applicable to any electronic device that can display images, including but not limited to mobile phones, laptops, smart TVs, smart speakers, tablet computers, computers, wearable devices (such as smart watches, smart bracelets, smart glasses, etc.), head-mounted displays, mobile email devices, portable game consoles, portable music players, reader devices, etc., and the embodiments of the present application do not make specific limitations.
[0034] The following is an introduction to the internal structure of the image processor in electronic devices. Figure 1 As shown, the image processor 100 may include a control unit 110 and a memory 120. When an application in the electronic device is started, the control unit 110 may obtain rendering data of an image of the application and store it in the memory 120.
[0035] Currently, when you view the memory usage, you can only view the overall memory usage. Figure 2As shown, the total memory occupied in real time by the memory blocks (such as memory 1 to memory 4) contained in the electronic device is illustrated. For example, the size of the unreleased memory (i.e., the occupied memory) of memory 1 is 617.79MB, the size of the unreleased memory of memory 2 is 2.27MB, the size of the unreleased memory of memory 3 is 168.08MB, and the size of the unreleased memory of memory 4 is 167.34MB. When only the overall memory usage can be viewed, the user cannot optimize the application according to the specific situation of each application occupying memory.
[0036] In order to solve the above problems, an embodiment of the present application provides a memory management method. In this method, when rendering the data to be rendered, an application tag of the data to be rendered is generated, and the data to be rendered and the application tag of the data to be rendered are stored in the memory, wherein the application tag of the data to be rendered indicates the application to which the data to be rendered belongs. In this way, when checking the memory occupancy of the electronic device, the storage space specifically occupied by each application can be counted according to the application tags stored in the memory, so that the user can check the storage space specifically occupied by each application, and optimize the application according to the storage space specifically occupied by each application.
[0037] For example, an application can send a drawing request to a graphics rendering service. After receiving the drawing request sent by the application, the graphics rendering service draws the image data of each frame of the image and performs rendering (such as shading, rasterization, ray tracing, etc.) according to the image data. During the rendering process, the image data of each frame of the image can be obtained from the memory, and the display interface of each frame of the image can be obtained by rendering based on the image data, and the display interface is stored in the memory. Then, the display interface is displayed on the display screen of the electronic device frame by frame.
[0038] It is understood that when the process corresponding to the application is running, the kernel can assign a process number to the process. In the rendering process of the data to be rendered, the process number can indicate the application to which the data to be rendered belongs. In some optional instances, the method of generating the application tag of the data to be rendered can be: generating the application tag of the data to be rendered according to the process number of the data to be rendered.
[0039] In some specific scenarios, for example, when the data to be rendered is data corresponding to an application window, an application tag of the data to be rendered can be generated according to the process number, thread number, application window identification number and drawing function identification number of the data to be rendered.
[0040] The memory management method mentioned in the embodiments of the present application is introduced below. Figure 3 A schematic diagram of a memory management method is shown, which can be executed by an electronic device, such as Figure 3 As shown, the memory management method may include:
[0041] 301: Responding to a memory check instruction.
[0042] It can be understood that the memory viewing instruction can be a memory viewing instruction for the memory in the image processor. In some optional examples, the memory viewing instruction can refer to a generation instruction, such as a jump command.
[0043] 302: Display memory storage results, wherein the memory storage results may include application memory usage statistics corresponding to multiple different applications. It can be understood that the memory storage results may be determined based on application tags of image data (i.e., data to be rendered) stored in each storage space in the memory of the image processor.
[0044] In some optional examples, a dump file (a file into which dynamic data is exported and saved) may be generated in response to a jump instruction, wherein the dump file may indicate the specific situation of the application window occupying the GPU memory.
[0045] In some optional instances, the application to which the image data stored in each storage space belongs can be determined based on the application label of the image data stored in each storage space in the memory of the image processor, such as the process number, and then the storage space of the image data of different applications can be counted to obtain the memory storage result.
[0046] In other optional instances, the application window to which the image data stored in each storage space belongs can be determined based on the application tags of the image data stored in each storage space in the memory of the image processor, such as the process number, thread number, window identification number, and drawing function identification number, and then the storage space of the image data of different application windows can be counted to obtain the memory storage result.
[0047] It can be understood that the application tag of the application can be assigned to the application by the process when the application is running, and marked by the rendering service, that is, the application's to-be-rendered data and the application tag are stored in the storage space of the GPU memory allocated to the application. In some specific implementations, the application tag can be expressed in the form of [Pid], where Pid can represent the process number. The application tag of the application window can also be expressed in the form of [Pid, Tid, Wid, Fid], where Pid can represent the process number, Tid can represent the thread number, Wid can represent the window's identification number, and Fid can represent the drawing function's identification number.
[0048] The following is a detailed introduction to the memory management method mentioned in the embodiment of the present application using a specific scenario.
[0049] like Figure 4As shown, under the unified rendering framework, the application layer can send the content required to be drawn by each application in multiple applications to the rendering service (such as RenderService), and then use RenderService to render graphics. For example, the content required to be drawn by the first application window win1 of the first application can be sent to RenderService, the content required to be drawn by the second application window win2 of the first application can be sent to RenderService, and the content required to be drawn by the third application window win3 of the second application can be sent to RenderService.
[0050] Furthermore, RenderService can generate a call instruction according to the content that each application needs to draw, for example, a call instruction "render win1" is generated according to the content that the first application window win1 of the first application needs to draw, a call instruction "render win2" is generated according to the content that the second application window win2 of the first application needs to draw, and a call instruction "render win3" is generated according to the content that the third application window win3 of the second application needs to draw. The call instruction can be used to indicate the call of the drawing function of the required drawing content.
[0051] Then, RenderService can send the call instruction to the graphics library (such as skia), and the graphics library can call the drawing function corresponding to the content to be drawn according to the call instruction corresponding to the content to be drawn by each application, and generate the drawing instruction. For example, the first application window of the first application needs to draw a rectangle, skia can call the drawing function "drawRect()", and generate "drawing instruction newGrOp(1)" based on the called drawing function "drawRect()", where "1" can represent the drawing function "drawRect()".
[0052] When the process corresponding to the application is running, the kernel can assign an application tag to the application. In some specific implementations, the kernel can assign a process number to the application as the application tag of the application according to the running order of the process corresponding to the application. The process number can be a positive number, which is the unique identity of the application. For example, the kernel can assign process numbers to the application starting from 1, up to the maximum process number of the system, for example, the maximum process number of a 32-bit system is 32768, and the maximum process number of a 64-bit system is 4194304.
[0053] In some optional instances, the application tag of the application may be expressed in the form of [Pid], where Pid may represent a process number. For example, when the first application is started first and then the second application is started, where the first application first displays the first application window (e.g., the homepage) and then displays the second application window (e.g., the inner page), the kernel may assign the process number "1" to the first application window win1 of the first application, assign the process number "2" to the second application window win2 of the first application, and assign the process number "3" to the third application window win3 of the second application.
[0054] In some other specific implementations, since a process may include multiple threads, the kernel may also assign a thread number to the application as part of the application tag. For example, the kernel may assign thread numbers to the application starting from 1.
[0055] When the process corresponding to the application is running, the kernel can also allocate GPU memory resources to the application, that is, allocate storage space for storing data to be rendered to the application, and store the data to be rendered and the application tag of the application in the storage space allocated to the application, such as storing the data to be rendered and the process number of the application in the storage space allocated to the application, so that when checking the GPU memory occupancy of the device, the storage space specifically occupied by each application can be counted according to the application tag stored in the GUP memory, so that the user can view the specific storage space occupied by each application and optimize the application according to the specific storage space occupied by each application.
[0056] However, for an application with multiple application windows, only the process number and thread number are used as application tags, which cannot distinguish the specific occupancy of each application window. Therefore, in some optional examples, the kernel can assign window identity documents (IDs) to application windows according to the order of application windows. In addition, the kernel can also assign the identity document of a drawing function to the application window according to the drawing function corresponding to the content to be drawn by the application window. Therefore, the application tag of an application may include but is not limited to the process number, thread number, window identity document, and drawing function identity document of the application.
[0057] In some optional instances, the application tag of the application window can be expressed in the form of [Pid, Tid, Wid, Fid], where Pid can represent the process number, Tid can represent the thread number, Wid can represent the window identification number, and Fid can represent the drawing function identification number. For example, when the first application is started first and then the second application is started, the first application first displays the first application window (such as a splash screen advertisement) and then displays the second application window (such as an inner page), the kernel can assign the process number "1", the thread number "1", the window identification number "11" and the drawing function identification number "12" to the first application window win1 of the first application, and can assign the process number "2", the thread number "21", the window identification number "2" and the drawing function identification number "34" to the second application window win2 of the first application, and assign the process number "3", the thread number "31", the window identification number "3" and the drawing function identification number "56" to the third application window win3. Among them, the drawing function with the identification number "12" may be a function for drawing an image, the drawing function with the identification number "34" may be a function for drawing a rectangle, and the drawing function with the identification number "56" may be a function for drawing a circle.
[0058] Table 1 below shows an application tag of multiple application windows. As shown in Table 1, the process numbers of application windows of the same application are the same, but the window identification numbers are different, and the process numbers of application windows of different applications are different.
[0059] Table 1
[0060] Window Name Process number Window Number Window 1 2170 5 Window 2 2170 6 Window 3 10166 20 ... ... ...
[0061] As shown in Table 1, the process numbers of application window 1 and application window 2 are the same, and the window identification numbers of application window 1 and application window 2 are different, that is, application window 1 and application window 2 are different windows of the same application. The process numbers of application window 1 and application window 3 are different, and the window numbers of application window 1 and application window 3 are different, that is, application window 1 and application window 3 are different windows of different applications.
[0062] When the process corresponding to the application is running, the kernel can also allocate GPU memory resources for the application, that is, allocate storage space for storing data to be rendered for the application. For example, the resource allocation function "new gpuresource(1)" can be called to allocate GPU resource "gpu1" for the first application window in the example listed above, allocate GPU resource "gpu2" for the second application window, and allocate GPU resource "gpu3" for the third application window, and store the application's data to be rendered and the application tag in the storage space allocated for the application, such as storing the application's data to be rendered and the application's process number, thread number, window identification number, and drawing function identification number in the storage space allocated for the application, so that when checking the occupancy of the device's GPU memory, the specific storage space occupied by each application window can be counted according to the application tag stored in the GPU memory, so that the user can view the specific storage space occupied by each application window, and optimize the application according to the specific storage space occupied by each application window. In this way, in the rendering process of the application, by allocating GPU memory resources to the application, when the user checks the specific occupancy of the GPU memory, the occupancy of each GPU can be accurately viewed. Furthermore, when a GPU memory leak occurs, the complexity of the drawing logic can be checked based on the occupancy of each GPU. In addition, when the GPU memory occupancy is greater than the occupancy threshold, the application can be optimized in a targeted manner.
[0063] It can be understood that the data to be rendered may include text texture (gr_text_blob_cache), software rendering path to texture mask (SW Path Mask), path object (Path), pixel effect mask (Mask Filtered Masks), image (Image), rounded blur effect mask (RoundRect Blur Mask), vertex array, etc. In the process of allocating GPU memory resources to the application, RenderService can add application tags to the GPU resources allocated to the application, that is, store the application's data to be rendered and the application tag in the GPU memory.
[0064] In some optional instances, when checking the GPU memory usage, a generation command (such as a jump command) can be used to generate a dump file (a file into which dynamic data is exported and transferred). The dump file can indicate the specific situation of the application window occupying the GPU memory. In actual applications, the generation command can count the specific situation of the application window occupying the GPU memory based on the application tags stored in the storage space of the GPU together with the data to be rendered, for example, based on the application tags stored in the storage space of the GPU together with the text texture (gr_text_blob_cache), the mask of the software rendering path to the texture (SW Path Mask), the path object (Path), the pixel effect mask (Mask FilteredMasks), the image (Image), the mask of the rounded blur effect (RoundRectBlur Mask), the vertex array (Other) and other rendering data, and count the specific situation of the application window occupying the GPU memory.
[0065] In some optional instances, the dump file can indicate in the form of a document the specific situation that the to-be-rendered data of the application window occupies the GPU memory. The following shows in the form of a document the specific situation that the to-be-rendered data of the application window with process number xxx occupies the GPU memory.
[0066] Application window: launcher process number: xxx
[0067] Skia GPU Caches:
[0068] skia / gr_text_blob_cache:
[0069] Other:37.39KB(1entyr)
[0070] Mask Filtered Masks:
[0071] Texture: 8.00KB (2 entries)
[0072] Image:
[0073] Texture: 48.42MB (30 entries)
[0074] Other:
[0075] Buffer Object:30.83KB(3entries)
[0076] SWPath Mask:
[0077] Texture: 11.10KB (5 entries)
[0078] Scratch:
[0079] Texture: 130.17MB (34 entries)
[0080] Buffer Object:48.00KB(1entry)
[0081] Stencil: 3.55MB (1 entry)
[0082] Other Caches:
[0083] Current / Maximum
[0084] VectorDrawableAtlas 0.00KB / 0.00KB(entries=0)
[0085] Total GPU memory usage:
[0086] 191127584bytes,182.27MB(177.64MB is purgeable)
[0087] From the above, we can see that the text texture in the to-be-rendered data of the application window with process number xxx occupies 37.39KB of GPU memory, the pixel effect mask occupies 8.00KB of GPU memory, the image occupies 48.42MB of GPU memory, the vertex data occupies 30.83KB of GPU memory, and the entire application window occupies 182.27MB of GPU memory.
[0088] In some other optional examples, the dump file can indicate in a table the specific situation of the GPU memory occupied by the to-be-rendered data of the application window. Table 2 indicates in a table the specific situation of the GPU memory occupied by the to-be-rendered data of the application window with process number xxx.
[0089] Table 2
[0090]
[0091] MB of GPU memory, images occupy 10.41MB of GPU memory, vertex arrays occupy 0.03MB of GPU memory, the mask of the software rendering path to the texture occupies 0.01MB of GPU memory, the mask of the rounded blur effect occupies 1.00MB of GPU memory, the texture occupies 0.04MB of GPU memory, the background occupies 3.55MB of GPU memory, and window 1 occupies a total of 15.1MB of GPU memory.
[0092] In addition, the dump file can also illustrate the specific situation of the GPU memory occupied by the to-be-rendered data of the application or application window in the form of a column chart, a pie chart, a bar chart, etc., which is not specifically limited in the embodiments of the present application.
[0093] It can be understood that in the embodiment of the present application, the above memory management method can be executed by an electronic device, and the electronic device can be a computer. The hardware structure of the computer is introduced below.
[0094] Figure 5 This is a block diagram of a computer provided in an embodiment of the present application. In some embodiments, the computer may include one or more processors 501, a system control logic 502 connected to at least one of the processors 501, a system memory 503 connected to the system control logic 502, a non-volatile memory (NVM) 504 connected to the system control logic 502, and a network interface 505 connected to the system control logic 502.
[0095] In some embodiments, the processor 501 may include one or more single-core or multi-core processors. In some embodiments, the processor 501 may include any combination of a general-purpose processor and a dedicated processor (e.g., an image processor, an application processor, a baseband processor, etc.). In an embodiment where the computer employs an enhanced base station (evolved Node B, eNB) or a radio access network (Radio Access Network, RAN) controller, the processor 501 may be configured to execute various embodiments that comply with the present invention.
[0096] In some embodiments, system control logic 502 may include any suitable interface controller to provide any suitable interface to at least one of processors 501 and / or any suitable device or component in communication with system control logic 502 .
[0097] In some embodiments, the system control logic 502 may include one or more memory controllers to provide an interface to the system memory 503. The system memory 503 may be used to load and store data and / or instructions. In some embodiments, the system memory 503 of the computer may include any suitable volatile memory, such as a suitable dynamic random access memory (DRAM).
[0098] The non-volatile memory (NVM) 504 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, the non-volatile memory (NVM) 504 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as a hard disk drive (HDD), a compact disc (CD) drive, and a digital versatile disc (DVD) drive.
[0099] The non-volatile memory (NVM) 504 may include a portion of storage resources on the device on which the computer is installed, or it may be accessible by the device but not necessarily a portion of the device. For example, the non-volatile memory (NVM) 504 may be accessed over a network via the network interface 505 .
[0100] The system memory 503 and the non-volatile memory (NVM) 504 may respectively include: a temporary copy and a permanent copy of the instruction 507. The instruction 507 may include: an instruction that causes the computer to implement the memory management method mentioned in the embodiment of the present application when executed by at least one of the processors 501. In some embodiments, the instruction 507, hardware, firmware and / or its software components may be additionally / alternatively placed in the system control logic 502, the network interface 505 and / or the processor 501.
[0101] The network interface 505 may include a transceiver for providing a radio interface for the computer, and then communicating with any other suitable device (such as a front-end module, an antenna, etc.) through one or more networks. In some embodiments, the network interface 505 can be integrated with other components of the computer. For example, the network interface 505 can be integrated with at least one of the processor 501, the system memory 503, the non-volatile memory (NVM) 504, and a firmware device (not shown) with instructions. When at least one of the processors 501 executes the instructions, the computer implements the memory management method mentioned in the embodiments of the present application.
[0102] The network interface 505 may further include any suitable hardware and / or firmware to provide a multiple-input multiple-output radio interface. For example, the network interface 505 may be a network adapter, a wireless network adapter, a telephone modem and / or a wireless modem.
[0103] In some embodiments, at least one of the processors 501 may be packaged together with logic for one or more controllers of the system control logic 502 to form a system in package (SiP). In one embodiment, at least one of the processors 501 may be integrated on the same die with logic for one or more controllers of the system control logic 502 to form a system on chip (SoC).
[0104] The computer may further include: input / output (I / O) devices 506. The input / output (I / O) devices 506 may include a user interface to enable a user to interact with the computer; the design of the peripheral component interface enables the peripheral components to interact with the computer. In some embodiments, the computer also includes a sensor for determining at least one of an environmental condition and location information related to the computer.
[0105] In some embodiments, the user interface may include, but is not limited to, a display (e.g., an LCD display, a touch screen display, etc.), a speaker, a microphone, one or more cameras (e.g., a still image camera and / or a video camera), a flashlight (e.g., an LED flash), and a keyboard.
[0106] In some embodiments, the peripheral component interface may include, but is not limited to, a non-volatile memory port, an audio jack, and a power interface.
[0107] In some embodiments, the sensors may include, but are not limited to, gyroscope sensors, accelerometers, proximity sensors, ambient light sensors, and positioning units. The positioning unit may also be part of or interact with the network interface 505 to communicate with components of a positioning network (e.g., global positioning system (GPS) satellites).
[0108] The memory management method provided in the embodiment of the present application can be executed by the processor 501 in the above-mentioned computer.
[0109] The various embodiments of the mechanism disclosed in the present 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 a computer program or program code 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.
[0110] Program code can be applied to input instructions to perform the functions described in this application 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, or a microprocessor.
[0111] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program 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.
[0112] 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, machine-readable media may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including, but not limited to, floppy disks, optical disks, optical disks, read-only memories (CD-ROMs), magneto-optical disks, read-only memories (ROMs), random access memories (RAMs), erasable programmable read-only memories (EPROMs), electrically erasable programmable read-only memories (EEPROMs), magnetic or optical cards, flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in electrical, optical, acoustic, or other forms of propagation signals. Therefore, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a machine (e.g., computer) readable form.
[0113] The above describes the hardware structure that the electronic device may have. It is understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0114] In the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0115] The various embodiments of the mechanism disclosed in the present 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 a computer program or program code 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.
[0116] Program code can be applied to input instructions to perform the functions described in this application 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, or a microprocessor.
[0117] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program 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.
[0118] 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, machine-readable media may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including, but not limited to, floppy disks, optical disks, optical disks, read-only memories (CD-ROMs), magneto-optical disks, read-only memories (ROMs), random access memories (RAMs), erasable programmable read-only memories (EPROMs), electrically erasable programmable read-only memories (EEPROMs), magnetic or optical cards, flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in electrical, optical, acoustic, or other forms of propagation signals. Therefore, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a machine (e.g., computer) readable form.
[0119] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.
[0120] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0121] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the present application.
Claims
1. A memory management method for an electronic device, characterized in that: The electronic device includes an image processor, and The method comprises: detecting a viewing instruction to a memory in the image processor; The storage result of the memory is displayed, wherein the storage result includes the size of the storage space of the memory occupied by each application among the multiple applications.
2. The method according to claim 1, characterized in that The storage result of the memory is determined based on the application tag of the image data stored in each storage space in the memory.
3. The method according to claim 2, characterized in that The storage result of the memory is determined by: Determining the application to which the image data stored in each storage space belongs based on the application tag of the image data stored in each storage space in the memory; The storage space occupied by different applications is counted to obtain the size of the storage space occupied by the image data of each application.
4. The method according to claim 2, characterized in that: The application tags include a first application tag, and The method further comprises: When running the first application, the kernel allocates the first application tag to the first image data corresponding to the first application, and the first application tag indicates that the first image data belongs to the first application.
5. The method according to claim 2, characterized in that: The image data corresponds to the image data of the application window, The application tag includes the process number of the application, the thread number of the application, the window number of the application window and the identification number of the drawing function.
6. The method according to claim 1, characterized in that The image data stored in the memory of the image processor includes at least one of a text texture, a mask from a software rendering path Path to a texture, a path object, a pixel effect mask, a Texture picture texture, a mask for a rounded blur effect, and a vertex array.
7. The method according to any one of claims 1 to 5, characterized in that: The display form of the storage result of the memory is any one of a file, a table, a document, a column chart, a pie chart, and a bar chart.
8. The method according to claim 1, characterized in that The method further comprises: When a drawing request of a first application is detected, first image data of the first application is drawn, and a first application tag is assigned to the first image data; The first image data and the first application tag are stored in a first storage space of the memory.
9. An electronic device, characterized in that: include: A memory, used to store instructions executed by one or more processors of the electronic device, and a processor, which is one of the one or more processors of the electronic device, used to execute the memory management method described in any one of claims 1-8.
10. A readable storage medium, characterized in that: The readable medium stores instructions, and when the instructions are executed on an electronic device, the electronic device executes the memory management method according to any one of claims 1 to 8.