Three-dimensional model memory management method and related device
By responding to the rendering end signal in the browser environment, removing child objects of the 3D model scene and releasing graphics processor resources, the memory leak problem is solved, and the browser's performance and stability are improved.
Patent Information
- Application Number
- CN202510987240.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-17
- Publication Date
- 2025-10-28
AI Technical Summary
When creating 3D models in a browser environment, memory leaks can cause browser lag or crashes. Existing technologies cannot effectively release resources in the graphics processor, affecting the user experience.
By responding to the rendering end signal, the system removes child objects from the 3D model scene, traverses the resource reference tree to release resources, removes reference relationships, and deletes debug logs, thus achieving full lifecycle memory management.
It effectively reduces the risk of memory leaks, improves browser performance, avoids lag or crashes, and ensures stable application operation.
Smart Images

Figure CN120852148A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data storage technology, and in particular to a method and related apparatus for managing the memory of a three-dimensional model. Background Technology
[0002] With the rapid development of emerging technologies such as artificial intelligence, the construction and rendering of 3D model scenes has become a crucial aspect of technical implementation. In the development of 3D model applications, a complete 3D model typically comprises multiple components, including geometry, indexes, materials, textures, and animations, each consuming system memory resources. Currently, when creating 3D models in a browser environment, the model's context resources are not automatically handled by the garbage collection mechanism. This often leads to memory leaks. Even if the user deletes the relevant model, memory resources may not be released in time, causing unreleased 3D model resources to accumulate and lead to memory leaks, ultimately causing browser lag or even crashes, impacting the user experience. Summary of the Invention
[0003] In view of the above problems, this application provides a method and related apparatus for three-dimensional model memory management to reduce memory leaks and improve browser performance. The specific solution is as follows:
[0004] The first aspect of this application provides a method for managing the memory of a three-dimensional model, including:
[0005] In response to the rendering end signal of the 3D model in the current webpage, remove each sub-object displayed in the 3D model scene;
[0006] Traverse the resource reference tree of each sub-object, determine the resources used by each sub-object, and perform a resource release operation on each used resource to clear the memory occupation of each used resource in the graphics processor;
[0007] Based on the correspondence between the 3D model scene and the auxiliary rendering object, the reference relationship between the 3D model scene and the auxiliary rendering object is removed;
[0008] Filter out the debug logs related to the sub-object from the console's operation logs, and delete the debug logs.
[0009] In one possible implementation, the process of determining the rendering end signal includes:
[0010] The rendering end signal is generated in response to either closing the current webpage or creating a 3D model rendering process.
[0011] In one possible implementation, the used resources include: geometry, and the resource release operation for each of the used resources includes:
[0012] Perform a corresponding resource release operation on the geometry to clear the memory occupied by the geometry in the graphics processor.
[0013] In one possible implementation, the resources used include textures and materials, and the resource release operation for each of the used resources includes:
[0014] According to the texture and material information corresponding to the 3D model scene, the resource release operation is performed sequentially on each texture and material to clear the memory occupied by the texture and material in the graphics processor.
[0015] In one possible implementation, the 3D model memory management method further includes:
[0016] Based on the amount of resources used recorded in the operation log in real time, the clearing status of the used resources in the graphics processor is monitored.
[0017] In one possible implementation, the process of obtaining the texture and material information corresponding to the 3D model scene includes:
[0018] The system scans the textures and materials of the 3D model scene based on texture attribute information and material attribute information to obtain all textures and materials of the 3D model scene.
[0019] A second aspect of this application provides a three-dimensional model memory management device, comprising:
[0020] The sub-object removal module is used to remove each sub-object displayed in the 3D model scene in response to the rendering end signal of the 3D model in the current webpage.
[0021] The memory resource release module is used to traverse the resource reference tree of each sub-object, determine the resources used by each sub-object, and perform a resource release operation on each used resource to clear the memory occupation of each used resource in the graphics processor.
[0022] The reference removal module is used to remove the reference relationship between the 3D model scene and the auxiliary rendering object based on the correspondence between the 3D model scene and the auxiliary rendering object; and,
[0023] The debug log deletion module is used to filter out debug logs related to the sub-object from the console operation logs and delete the debug logs.
[0024] A third aspect of this application provides a computer program product including computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the three-dimensional model memory management method of the first aspect or any implementation thereof.
[0025] A fourth aspect of this application provides an electronic device, including at least one processor and a memory connected to the processor, wherein:
[0026] The memory is used to store computer programs;
[0027] The processor is used to execute the computer program so that the electronic device can implement the three-dimensional model memory management method of the first aspect or any implementation thereof.
[0028] The fifth aspect of this application provides a computer storage medium carrying one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the three-dimensional model memory management method described in the first aspect or any implementation thereof.
[0029] By employing the aforementioned technical solution, the 3D model memory management method provided in this application removes each sub-object displayed in the 3D model scene in response to the rendering end signal of the 3D model in the current webpage. Then, it traverses the resource reference tree of each sub-object to determine the resources used by each sub-object and performs resource release operations on each used resource to clear the memory occupation of each used resource in the graphics processor. Next, based on the correspondence between the 3D model scene and auxiliary rendering objects, it releases the reference relationship between the 3D model scene and the auxiliary rendering objects. Finally, it filters out the debug logs related to the sub-objects from the console operation logs and deletes the debug logs. This achieves a complete resource release process from scene objects, memory resources, reference relationships, and debug logs, enabling timely cleanup of model resources when object references are no longer needed, effectively reducing the risk of memory leaks, significantly improving application performance, and preventing browser lag or crashes. Attached Figure Description
[0030] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0031] Figure 1 An architecture diagram of a three-dimensional model memory management system is provided for this application;
[0032] Figure 2A flowchart of a three-dimensional model memory management method provided in this application;
[0033] Figure 3 A structural diagram of a three-dimensional model memory management device provided in this application;
[0034] Figure 4 This is a structural diagram of an electronic device provided in this application. Detailed Implementation
[0035] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0036] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0037] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0038] See Figure 1 , Figure 1 A schematic diagram of the architecture of a three-dimensional model memory management system is shown. The system may include a terminal 100 and a server 200. The server 200 can provide web browsers for one or more terminals.
[0039] The terminal 100 can be equipped with a 3D model memory management application, which can clear model resources based on webpage operations.
[0040] It should be understood that in some optional implementations, the terminal 100 can also complete the action of obtaining the processing result based on the received parameters on its own, without the need for the server to cooperate. This application embodiment is not limited to this.
[0041] The following description Figure 1 The product form of the mid-terminal 100;
[0042] The terminal 100 in this application embodiment can be a tablet computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and this application embodiment does not impose any restrictions on it.
[0043] Terminal 100 may include a radio frequency unit, memory, input unit, display unit, camera (optional), audio circuitry (optional), speaker (optional), microphone (optional), headphone jack (optional), processor, external interface, power supply, and other components. Those skilled in the art will understand that the above-mentioned components are merely examples and do not constitute a limitation on the terminal or multifunctional device; it may include more or fewer components, or a combination of certain components, or different components.
[0044] The input unit can be used to receive input numeric or character information, and to generate key signal inputs related to user settings and function control of the portable multi-functional device. Specifically, the input unit may include a touchscreen (optional) and / or other input devices. Other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0045] Among them, the input device can receive input data, etc.
[0046] The display unit can be used to display information input by the user or information provided to the user, various menus of the terminal, interactive interfaces, file display, and / or playback of any multimedia file. In the embodiments of this application, the display unit can be used to display the interface for 3D model memory management, processing results, etc.
[0047] The memory can be used to store software code related to the 3D model memory management method, the processor can execute the steps of the 3D model memory management method, and can also schedule other units (such as the above-mentioned input unit and display unit) to achieve the corresponding functions.
[0048] This radio frequency unit (optional) can be used to receive and send signals during information transmission or calls.
[0049] In this embodiment of the application, the radio frequency unit can send browser data to the server 200 and receive the webpage request result sent by the server 200.
[0050] It should be understood that this radio frequency unit is optional and can be replaced with other communication interfaces, such as a network port.
[0051] Terminal 100 also includes a power source (such as a battery) for supplying power to the various components.
[0052] Terminal 100 also includes an external interface, which can be a standard Micro USB interface or a multi-pin connector, which can be used to connect terminal 100 to other devices for communication or to connect a charger to charge terminal 100.
[0053] Server 200 includes a bus, a processor, a communication interface, and memory. The processor, memory, and communication interface communicate with each other via the bus.
[0054] 3D models consist of core data such as geometry, materials, and textures. In a graphics rendering environment, this data not only occupies JavaScript heap memory but also allocates resources in GPU (Graphics Processing Unit) memory. However, JavaScript's garbage collection mechanism can only process objects in heap memory and cannot automatically release GPU resources, leading to frequent memory leaks. Different 3D models may rely on different external file formats (such as .glb, .fbx) or program-generated data, requiring parsing and storage during loading. JavaScript has a unique resource management method when processing 3D models; its context resources are not automatically handled by the garbage collection mechanism. This can lead to memory leaks. Even if the user deletes the relevant model, memory resources may not be released in time. Unreleased geometry, materials, and textures accumulate, causing memory leaks and ultimately leading to system lag or crashes, impacting user experience.
[0055] To address the aforementioned problems, this application provides a method for managing the memory of a three-dimensional model. The method for managing the memory of a three-dimensional model according to this application will be described in detail below with reference to the accompanying drawings.
[0056] Reference Figure 2 , Figure 2 This application provides a flowchart illustrating a three-dimensional model memory management method as an embodiment. Figure 2 As shown in the embodiment of this application, a three-dimensional model memory management method may include steps 201 to 204, which are described in detail below.
[0057] 201. In response to the rendering end signal of the 3D model in the current webpage, remove each sub-object displayed in the 3D model scene.
[0058] Specifically, for 3D model rendering applications running on web pages, closing the current webpage or creating a 3D model will terminate the display of the current 3D model and generate a rendering end signal. This means that during the destruction or reloading of the current 3D model, excessive memory usage can occur.
[0059] The 3D model scene, acting as a rendering container, holds all objects involved in rendering, including 3D models and other elements. If child objects in the scene are not properly removed, these objects will continue to participate in the rendering loop, including updating transformation matrices and triggering event listeners. This leads to unnecessary CPU resource consumption, impacting application performance. Especially in applications that frequently dynamically load and unload large numbers of 3D models, failure to clean up these residual objects in a timely manner will cause memory usage to continuously increase, potentially leading to application crashes. Although modern JavaScript engines have garbage collection mechanisms, if objects are still held by other references, the garbage collector will not be able to reclaim them. Therefore, removing objects from the 3D model scene is the first step in breaking the reference chain and correctly releasing resources—that is, deleting visible child objects from the webpage. Specifically, the removal operation can be performed by calling the `remove` function through the corresponding interface.
[0060] Of course, those skilled in the art can use other means to remove sub-objects, and no restrictions are imposed here.
[0061] 202. Traverse the resource reference tree of each child object, determine the resources used by each child object, and perform resource release operations on each used resource to clear the memory occupation of each used resource in the graphics processor.
[0062] Specifically, existing graphics rendering frameworks require significant GPU memory to store 3D model resources such as geometry, materials, and textures. These resources request corresponding resource handles upon creation and their lifecycles are not automatically managed. This is because these resources may be referenced in multiple scenes or objects, and the framework cannot accurately determine when resources can be safely released. Furthermore, while JavaScript has an automatic garbage collection mechanism, it only handles memory resources and cannot release GPU resources. Even if the corresponding JavaScript object is garbage collected, the related resources may still reside on the GPU, requiring developers to manually release them.
[0063] In 3D model resource management, the most difficult types of resources to completely destroy are materials and textures. This is because the types and number of texture attributes are affected by the material type and rendering requirements; different models may use different texture combination schemes. Even if the resource destruction methods recommended by the software are followed, resources may still not be completely released.
[0064] Therefore, when resources include geometry, the corresponding resource release operation is performed on the geometry to clear the memory occupied by the geometry in the graphics processor.
[0065] When using resources including textures and materials, resource release operations can be performed sequentially for each texture and material according to the texture and material information corresponding to the 3D model scene, so as to clear the memory occupation of textures and materials in the graphics processor.
[0066] For example, the textures and materials of the 3D model scene in the system can be scanned separately based on texture attribute information (texture identifier, name, etc.) and material attribute information (material identifier, name, etc.) to obtain all textures and materials of the 3D model scene. That is, all texture and material attributes corresponding to the 3D model are scanned and recorded. Then, by recursively traversing all child objects of the model, when a leaf node is reached, it is determined whether the current node is geometry, material, or texture. For geometry, its dispose() method is called directly to release resources. For materials and textures, their dispose() methods are called respectively to release resources. The release of texture and material resources needs to be processed in conjunction with the previously recorded texture attribute information. That is, the dispose() method is called one by one to delete textures based on the texture attribute information. Finally, the clearing of resources used in the graphics processor can be monitored based on the amount of resources used recorded in the operation log in real time.
[0067] In practice, this can be verified by observing the renderer.info log information printed in the console. When the number of geometry and textures are both displayed as 0, it indicates that the resource destruction operation of the 3D model has been completed.
[0068] The console is a core module of the browser's built-in developer tools, providing a real-time interface for web page development, debugging, and performance optimization. Console logs are essential tools for developers during the development phase, serving as a core tool for debugging and analyzing web page behavior. Monitoring logs allows for the monitoring of the quantity of geometry, textures, and materials, thereby enabling the monitoring of cleanup status. The `dispose()` method, used in object-oriented programming, is used to release object resources or perform cleanup operations. It primarily ensures that memory and other system resources are released promptly when an object is no longer in use, preventing resource leaks. Calling the `dispose()` method can release textures, geometry, materials, and other resources occupied by child objects, reducing system resource consumption and preventing memory leaks. The specific calling process of the `dispose()` method can be determined by those skilled in the art as needed, and will not be elaborated upon here.
[0069] 203. Based on the correspondence between the 3D model scene and the auxiliary rendering object, remove the reference relationship between the 3D model scene and the auxiliary rendering object.
[0070] Specifically, considering that even after the 3D model scene is deleted, there is still a reference relationship between the 3D model scene and the included auxiliary rendering objects (such as lights, cameras, renderers, etc.), the reference relationship between the 3D model scene and the auxiliary rendering objects is broken by executing the reference relationship between the 3D model scene and the auxiliary rendering objects.
[0071] 204. Filter out the debug logs related to the sub-object from the console operation logs and delete the debug logs.
[0072] Specifically, since 3D models typically have a large amount of data, a large number of debugging logs are generated during the debugging process. These debugging logs occupy a lot of memory space, and if they are not deleted regularly, they will affect the normal operation of the browser. Therefore, the relevant debugging logs can be deleted in the end.
[0073] This 3D model memory management method first removes all sub-objects from the 3D model scene. Second, it completely destroys the geometry, materials, and textures contained in the 3D model. Third, it releases all related JavaScript object references in the scene. Finally, it clears all debug logs related to the model objects. Compared with existing solutions, this method achieves full lifecycle memory management from the modeling stage to the rendering stage, emphasizing both lightweight design during the modeling process and enhanced resource management after rendering. Through a complete resource release process, it effectively avoids memory leak risks and ensures the rational utilization of system resources. When loading or switching models in real time, it can promptly release unused model resources, significantly improving application performance and preventing browser lag or crashes. Simultaneously, it ensures that all object references are promptly cleaned up when no longer needed, effectively reducing memory leak risks and improving the stability and performance of 3D model rendering applications.
[0074] As a specific application of the above-mentioned 3D model memory management methods, memory management of core auxiliary rendering objects related to 3D model scenes can specifically include:
[0075] Scene management: The scene, as a container for the 3D model environment, does not directly occupy video memory, but its sub-objects (such as models, lights, etc.) need to be handled specially: first clean up all sub-objects, and then remove the reference to the scene object.
[0076] Camera management: The camera only occupies memory resources and does not consume video memory, so the reference to the camera object can be directly released.
[0077] Renderer management: As a graphics library context, the renderer occupies both video memory and system memory. It releases DOM (Document Object Model) element references by explicitly calling the dispose() method.
[0078] The release of resources for a 3D model needs to be done in steps: remove the model from the 3D model scene, then explicitly call the dispose() method to process its geometry, materials, and textures, and finally dereference the model object.
[0079] Controller memory management: Explicitly call the dispose() method to remove all event listeners, and then dereference the controller object.
[0080] Lighting management: Lights, as scene components, need to be removed from the 3D model scene and then unreferenced.
[0081] Animation Management: Stop all animations, then perform the cancel animation frame operation, and finally dereference the animation to prevent further execution.
[0082] By implementing the proactive resource release strategy based on the 3D model memory management method described above, memory and video memory leaks can be effectively avoided, ensuring stable and smooth application performance.
[0083] The above describes a three-dimensional model memory management method provided by the embodiments of this application. The following will describe the apparatus for performing the above three-dimensional model memory management method.
[0084] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of a three-dimensional model memory management device provided in an embodiment of this application. Figure 3 As shown, the 3D model memory management device includes:
[0085] The sub-object removal module 301 is used to remove each sub-object displayed in the 3D model scene in response to the rendering end signal of the 3D model in the current webpage.
[0086] The memory resource release module 302 is used to traverse the resource reference tree of each sub-object, determine the resources used by each sub-object, and perform resource release operations on each used resource to clear the memory occupation of each used resource in the graphics processor.
[0087] The reference removal module 303 is used to remove the reference relationship between the 3D model scene and the auxiliary rendering object based on the correspondence between the 3D model scene and the auxiliary rendering object; and,
[0088] The debug log deletion module 304 is used to filter out debug logs related to sub-objects from the console operation logs and delete them.
[0089] In one possible implementation, the process of determining the rendering end signal of the sub-object removal module 301 includes:
[0090] In response to closing the current webpage or creating a 3D model rendering process, a rendering end signal is generated.
[0091] In one possible implementation, the resources used include: geometry, and the process by which the memory resource release module 302 performs a resource release operation for each used resource includes:
[0092] Perform the corresponding resource release operation on the geometry to clear the memory occupied by the geometry in the graphics processor.
[0093] In one possible implementation, the resources used include textures and materials. The process by which the memory resource release module 302 performs a resource release operation for each used resource includes:
[0094] Based on the texture and material information corresponding to the 3D model scene, resource release operations are performed sequentially on each texture and material to clear the memory usage of textures and materials in the graphics processor.
[0095] In one possible implementation, it also includes: a clearing progress monitoring module, used to monitor the clearing status of resources used in the graphics processor based on the amount of resources used recorded in real time in the operation log.
[0096] In one possible implementation, the process of obtaining the texture and material information corresponding to the 3D model scene in the memory resource release module 302 includes:
[0097] The textures and materials of the 3D model scene in the system are scanned based on the texture attribute information and material attribute information to obtain all the textures and materials of the 3D model scene.
[0098] This application also provides an electronic device in its embodiments. (See reference...) Figure 4 The diagram illustrates a structural schematic suitable for implementing the electronic device in the embodiments of this application. The electronic device in the embodiments of this application may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0099] like Figure 4 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. When the electronic device is powered on, the RAM 403 also stores various programs and data required for the operation of the electronic device. The processing unit 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0100] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, memory cards, hard drives, etc.; and communication devices 409. Communication device 409 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have instead.
[0101] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the three-dimensional model memory management methods provided in this application.
[0102] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the three-dimensional model memory management methods provided in this application.
[0103] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0104] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0105] In the above embodiments, the implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, in the form of a computer program product.
[0106] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A method for managing memory of a three-dimensional model, characterized in that, include: In response to the rendering end signal of the 3D model in the current webpage, remove each sub-object displayed in the 3D model scene; Traverse the resource reference tree of each sub-object, determine the resources used by each sub-object, and perform a resource release operation on each used resource to clear the memory occupation of each used resource in the graphics processor; Based on the correspondence between the 3D model scene and the auxiliary rendering object, the reference relationship between the 3D model scene and the auxiliary rendering object is removed; Filter out the debug logs related to the sub-object from the console's operation logs, and delete the debug logs.
2. The three-dimensional model memory management method according to claim 1, characterized in that, The process of determining the rendering end signal includes: The rendering end signal is generated in response to either closing the current webpage or creating a 3D model rendering process.
3. The three-dimensional model memory management method according to claim 1, characterized in that, The resources used include: geometry, and the resource release operation for each of the used resources includes: Perform a corresponding resource release operation on the geometry to clear the memory occupied by the geometry in the graphics processor.
4. The three-dimensional model memory management method according to claim 1, characterized in that, The resources used include textures and materials, and the resource release operation for each of the used resources includes: According to the texture and material information corresponding to the 3D model scene, the resource release operation is performed sequentially on each texture and material to clear the memory occupied by the texture and material in the graphics processor.
5. The three-dimensional model memory management method according to claim 1, characterized in that, Also includes: Based on the amount of resources used recorded in real time in the operation log, the clearing status of the used resources in the graphics processor is monitored.
6. The three-dimensional model memory management method according to claim 4, characterized in that, The process of obtaining the texture and material information corresponding to the 3D model scene includes: The system scans the textures and materials of the 3D model scene based on texture attribute information and material attribute information to obtain all textures and materials of the 3D model scene.
7. A three-dimensional model memory management device, characterized in that, include: The sub-object removal module is used to remove each sub-object displayed in the 3D model scene in response to the rendering end signal of the 3D model in the current webpage. The memory resource release module is used to traverse the resource reference tree of each sub-object, determine the resources used by each sub-object, and perform a resource release operation on each used resource to clear the memory occupation of each used resource in the graphics processor. The reference relationship removal module is used to remove the reference relationship between the 3D model scene and the auxiliary rendering object based on the correspondence between the 3D model scene and the auxiliary rendering object; as well as, The debug log deletion module is used to filter out debug logs related to the sub-object from the console operation logs and delete the debug logs.
8. A computer program product, characterized in that, It includes computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the three-dimensional model memory management method as described in any one of claims 1 to 6.
9. An electronic device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the electronic device to implement the three-dimensional model memory management method as described in any one of claims 1 to 6.
10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the three-dimensional model memory management method as described in any one of claims 1 to 6.