Memory analysis method and device for virtual scene, electronic equipment and storage medium

By collecting memory data from virtual scenes in Unity game development, determining memory hotspots and configuring acquisition tags and engines, the problem of low memory data acquisition efficiency in the existing technology is solved, and the R&D efficiency of subsequent memory analysis is improved.

CN119987986APending Publication Date: 2025-05-13TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311510120.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-13
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The existing technology has low memory data acquisition efficiency in Unity game development, resulting in low subsequent memory analysis research and development efficiency.

Method used

By obtaining the software packages for virtual scenes, in the process of running the software packages in memory, performance data is collected from memory, the distribution of performance data and memory hotspots are determined, the acquisition tag and acquisition engine are configured, and memory data with tags are collected from memory hotspots for parsing.

Benefits of technology

It improves the efficiency of memory data acquisition, thereby improving the R&D efficiency of subsequent memory parsing, and reducing dependence on software package construction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987986A_ABST
    Figure CN119987986A_ABST
Patent Text Reader

Abstract

The invention provides a memory analysis method and device for a virtual scene, electronic equipment, a computer program product and a computer readable storage medium. The method comprises the steps of obtaining a software package of a virtual scene; allocating a memory for the software package, and running the software package based on the memory; acquiring performance data from the memory; determining the distribution condition of the performance data in the memory based on the performance data; determining a memory hotspot corresponding to the performance data in the memory based on the distribution condition; acquiring an acquisition label configuration, and acquiring an acquisition engine configuration, in which the acquisition label configuration records a label of the memory data to be acquired, and the acquisition engine configuration records an acquisition engine for acquiring the memory data to be acquired; acquiring memory data with a label from the memory hotspot through an acquisition engine to serve as to-be-analyzed memory data; and analyzing the to-be-analyzed memory data to obtain an analysis result of the to-be-analyzed memory data. The memory data acquisition efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to computer technology, and in particular to a memory parsing method, device, electronic device and storage medium for a virtual scene. Background Art

[0002] Unity is a widely used mobile game development engine. In addition to meeting functional requirements, games developed based on the Unity engine also need to perform necessary optimization work during the development process. Game developers need to obtain relevant performance data of mobile games and parse it in order to optimize mobile games based on the relevant performance data of the game (for example, locate software package problems). However, in the prior art, it is necessary to build a separate software package for the problems that arise, and the efficiency of memory data collection is low. On this basis, the relevant memory data is parsed, and the R&D efficiency is low. Summary of the invention

[0003] The embodiments of the present application provide a memory analysis method, device, electronic device, computer program product and computer-readable storage medium for a virtual scene, which can improve the efficiency of memory data collection, thereby improving the research and development efficiency of subsequent memory analysis.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present application provides a virtual scene memory parsing method, the method comprising:

[0006] Get the software package of the virtual scene;

[0007] Allocating memory for the software package, and running the software package based on the memory;

[0008] collecting performance data from the memory;

[0009] Determine, based on the performance data, the distribution of the performance data in the memory;

[0010] Determine a memory hotspot corresponding to the performance data in the memory based on the distribution condition;

[0011] Acquire a collection tag configuration and acquire a collection engine configuration, wherein the collection tag configuration records a tag of the memory data to be collected, and the collection engine configuration records a collection engine for collecting the memory data to be collected;

[0012] Collecting memory data with the tag from the memory hotspot through the collection engine as memory data to be parsed;

[0013] The memory data to be parsed is parsed to obtain a parsing result of the memory data to be parsed.

[0014] The embodiment of the present application provides a memory parsing device for a virtual scene, comprising:

[0015] An acquisition module is used to acquire a software package of a virtual scene; acquire an acquisition tag configuration, and acquire an acquisition engine configuration, wherein the acquisition tag configuration records a tag of memory data to be acquired, and the acquisition engine configuration records an acquisition engine for acquiring the memory data to be acquired;

[0016] A processing module, configured to allocate memory to the software package and run the software package based on the memory; parse the memory data to be parsed to obtain a parsing result of the memory data to be parsed;

[0017] A collection module, used to collect performance data from the memory; collect memory data with the label from the memory hotspot through the collection engine as memory data to be parsed;

[0018] A determination module is used to determine the distribution of the performance data in the memory based on the performance data; and to determine the memory hotspot corresponding to the performance data in the memory based on the distribution.

[0019] An embodiment of the present application provides an electronic device, the electronic device comprising:

[0020] A memory for storing computer executable instructions;

[0021] The processor is used to implement the memory parsing method of the virtual scene provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.

[0022] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing a memory parsing method for a virtual scene provided in an embodiment of the present application when executed by a processor.

[0023] An embodiment of the present application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, the memory parsing method of the virtual scene provided in the embodiment of the present application is implemented.

[0024] The embodiments of the present application have the following beneficial effects:

[0025] By acquiring the software package of the virtual scene, performance data is collected from the memory during the process of running the software package in the memory; the corresponding memory hotspots in the memory are determined based on the distribution of the performance data in the memory; then, by configuring the collection tags and the collection engine, memory data is collected based on the memory hotspots in the memory and the acquired collection tag configuration and the collection engine configuration, as the memory data to be parsed; the memory data to be parsed is parsed to obtain the parsing results of the memory data to be parsed. The above scheme does not rely on building a software package specifically for a specific problem as in the prior art. On the basis of the existing software package, memory data can be collected and related memory data can be parsed to provide parsing results for reference in the development of the software package, thereby improving the efficiency of memory data collection, thereby improving the research and development efficiency of subsequent memory parsing. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a structural diagram of the memory parsing system architecture of the virtual scene provided in the embodiment of the present application;

[0027] Figure 2 It is a structural diagram of a memory parsing device for a virtual scene provided in an embodiment of the present application;

[0028] Figure 3A It is a flowchart of a memory parsing method for a virtual scene provided in an embodiment of the present application;

[0029] Figure 3B It is a flowchart of a software package for obtaining a virtual scene provided in an embodiment of the present application;

[0030] Figure 3C It is a schematic diagram of the process of collecting performance data provided by an embodiment of the present application;

[0031] Figure 3D This is a schematic diagram of a process for obtaining memory data to be parsed provided in an embodiment of the present application;

[0032] Figure 3E It is a schematic diagram of the process of parsing memory data provided by an embodiment of the present application;

[0033] Figure 4A It is a flowchart of the collection configuration provided in the embodiment of the present application;

[0034] Figure 4B It is a flowchart of the collection engine configuration provided in the embodiment of the present application;

[0035] Figure 5A It is a schematic diagram of a process for obtaining a full stack of managed heap memory provided by an embodiment of the present application;

[0036] Figure 5BIt is a schematic diagram of the process of offline writing of memory data provided in an embodiment of the present application;

[0037] Fig. 6A This is a schematic diagram of automatic analysis of MemoryProfiler performance provided in an embodiment of the present application;

[0038] Figure 6B It is a schematic diagram of the MemoryProfiler acquisition tag configuration provided in an embodiment of the present application;

[0039] Figure 6C It is a schematic diagram of the configuration of the MemoryProfiler collection engine provided in an embodiment of the present application;

[0040] Fig.6D It is a schematic diagram of the memory configuration of the MemoryProfiler acquisition resource provided in the embodiment of the present application;

[0041] Fig. 6E This is a schematic diagram of the MemoryProfiler full memory collection and analysis provided in the embodiment of this application

[0042] Fig. 6F It is a schematic diagram of the automated performance analysis of MonoProfiler provided in an embodiment of the present application;

[0043] Figure 6G This is a schematic diagram of a memory object allocator collected by MonoProfiler provided in an embodiment of the present application;

[0044] Figure 6H It is a schematic diagram of obtaining the MonoProfiler engine configuration stack provided in an embodiment of the present application;

[0045] Fig.6I A schematic diagram of symbol table analysis provided in an embodiment of the present application;

[0046] Figure 6J A schematic diagram of the dl_info structure provided in an embodiment of the present application;

[0047] Figure 6K A diagram showing the symbol table analysis provided in the embodiment of the present application;

[0048] Figure 6L This is a schematic diagram of MonoProfiler memory analysis provided in an embodiment of the present application;

[0049] Fig. 7A It is a schematic diagram of the collection configuration interface provided in an embodiment of the present application;

[0050] Figure 7B It is a schematic diagram of the collection tag configuration interface and the collection engine configuration interface provided in the embodiment of the present application. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0052] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0053] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0054] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0055] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0056] 1) Unity: It is a cross-platform game development engine that can help developers quickly build game scenes, develop and publish games. It supports publishing developed works to multiple platforms such as Windows, Mac OS, Android, iOS, Linux, etc.

[0057] 2) Release version: refers to the final version in the software development cycle. It is a version that has been tested and verified and is ready to be officially released to end users. The release version is usually the last stage of the software development cycle and contains all major functions and features.

[0058] 3)PerfDog: It is a tool that supports performance testing on all mobile platforms including iOS / Android / applets / H5. It does not require rooting or jailbreaking the phone, and does not require any changes to the phone hardware, games, or applications. It is extremely plug-and-play. It helps users conduct effective client performance testing during R&D, including obtaining performance data for each version, conducting in-depth performance optimization analysis, pre-project performance evaluation reports, and comparative analysis of performance of peer products. Clear execution steps can be viewed through screenshots and screen recordings, and the timeline, screenshot tracks, performance tracks, test logs, and other content can be displayed.

[0059] 4) Proportional Set Size (PSS), the actual physical memory used (the memory occupied by the proportional shared library, divided proportionally according to the number of processes). For example: if three processes all use a shared library, occupying a total of 30 pages of memory, then PSS will consider each process to occupy 10 pages of the shared library.

[0060] 5) Memory Profiler: Memory Profiler is mainly used to view the detailed allocation of managed memory and native memory. It detects memory leaks and memory fragmentation by capturing, inspecting, and comparing memory snapshots. It provides actionable information about allocations in the engine, allowing developers to manage and reduce memory usage.

[0061] 6) For mobile games developed with Unity engine, the memory consists of three parts:

[0062] Program code: including the Unity engine, the libraries used, and the game code written. After compilation, the resulting running files will be loaded into the device for execution and occupy a certain amount of memory. There is actually no way to "manage" this part of memory, and they will exist in the memory from the beginning to the end. Optimization can only reduce the number of libraries used.

[0063] Managed Heap: The managed heap is used to store class instances (such as lists generated by new, various declared variables in instances, etc.), and plays the role of a basic class library for Unity development. For most projects currently developed based on the Unity engine, managed heap memory is allocated and managed by Mono. The original meaning of "managed" is that Mono can automatically change the size of the heap to adapt to the memory you need, and call the garbage collection (GarbageCollection) operation in a timely manner to release the memory that is no longer needed, thereby lowering the threshold for developers in code memory management.

[0064] Native Heap: This is where the Unity engine applies for and operates, such as textures, sound effects, scenes, etc. Unity uses its own memory management mechanism to make this memory have similar functions to the managed heap. The basic idea is that if a resource is needed in this level, it will be loaded when needed, and then unloaded when there is no reference.

[0065] 7) Mono memory management strategy: Memory is managed through the garbage collection mechanism (Garbage Collect, GC). Mono memory is divided into two parts, used memory (used) and heap memory (heap). Used memory refers to the memory that Mono actually needs to use, and heap memory refers to the memory that Mono applies to the operating system. The difference between the two is Mono's free memory. When Mono needs to allocate memory, it will first check whether the free memory is sufficient. If it is sufficient, it will directly allocate it in the free memory. Otherwise, Mono will perform a GC to release more free memory. If there is still not enough free memory after GC, Mono will apply for memory from the operating system and expand the heap memory.

[0066] In the existing technology, when Unity games conduct memory performance acceptance, a Release version containing all game scene resources is first built; PerfDog is used to collect performance data indicators. When various performance hotspots appear, a development version is built to collect Profiler data. After that, the collected data is analyzed in detail, and various targeted performance optimizations are implemented. After entering the version, the next round of version performance acceptance is carried out.

[0067] However, the above method has the following technical problems:

[0068] First, when problems arise, a separate development version needs to be built, which takes a long time.

[0069] Secondly, when collecting data from various memory profilers, the data storage length is very limited, and customized collection of various memory data cannot be achieved.

[0070] Finally, after the development package completes the collection of various memory data, various logs will be collected and output, which will affect the memory data recording, especially for the frame rate of low-end machines. It is often difficult to reproduce the problems that occurred in the Release in the Development version, especially for various multi-person scene problems. Organizing the reproduction scene will be very labor-intensive. Moreover, when parsing memory data, only single-frame capture and analysis can be performed, and curves cannot be recorded continuously.

[0071] Based on the above analysis of the technical problems in the prior art, the applicant has set up a collection configuration control in the software package, and in response to the opening operation of the collection configuration control, has realized the configuration of the collection tag and the collection engine during the operation of the software package. By obtaining the collection tag configuration and the collection engine configuration, the memory data with the label is collected from the memory hotspot as the memory data to be parsed, and the memory data to be parsed is parsed to obtain the parsing result of the memory data to be parsed. The above scheme does not rely on the construction of a software package specifically for a specific problem like the prior art. On the basis of the existing software package, memory data can be collected and the relevant memory data can be parsed to provide parsing results for reference as a software package development; at the same time, the collected memory data is custom collected in an offline writing manner, so that all kinds of data can be stored offline for a long time; finally, by parsing the memory data to be parsed, the parsing result of the memory data to be parsed is obtained, which can improve the efficiency of memory data collection, thereby improving the subsequent research and development efficiency of memory parsing.

[0072] The embodiments of the present application provide a memory parsing method, apparatus, electronic device, computer-readable storage medium and computer program product for a virtual scene, which can improve the efficiency of memory data collection, thereby improving the research and development efficiency of subsequent memory parsing. The following describes an exemplary application of an electronic device for memory parsing of a virtual scene provided by the embodiments of the present application. The device provided by the embodiments of the present application can be implemented as various types of user terminals such as laptop computers, tablet computers, desktop computers, set-top boxes, mobile devices (for example, mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), smart phones, smart speakers, smart watches, smart televisions, and vehicle-mounted terminals, and can also be implemented as servers.

[0073] See also Figure 1 , Figure 1 1 is a schematic diagram of the architecture of a memory parsing system 100 for a virtual scene provided in an embodiment of the present application, for example, to implement a memory parsing application supporting a virtual scene. Figure 1 The memory parsing system 100 of the virtual scene involves a server 200, a network 300 and a terminal 400. The terminal 400 is connected to the server 200 via the network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.

[0074] In some embodiments, the terminal 400 is used to obtain a software package from a local development environment and set a collection configuration control for the software package before the software package is run; the terminal 400 responds to the opening operation of the collection configuration control to implement the configuration of the collection tag and the collection engine during the operation of the software package. By obtaining the collection tag configuration and the collection engine configuration, the memory data is collected, and the collected memory data is collected in a custom manner in an offline writing manner, and then a memory parsing request is sent to the server 200 through the network 300. The server 200 parses the memory data and sends the parsing result to the terminal 400 through the network 300, and the parsing result is presented in the graphical interface 410 (graphical interface 410-1 is shown as an example).

[0075] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a car terminal, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0076] See also Figure 2 , Figure 2 is a schematic diagram of the structure of the terminal 400 provided in an embodiment of the present application, Figure 2 The terminal 400 shown includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the terminal 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 2 Various buses are labeled as bus system 440 .

[0077] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0078] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0079] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0080] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0081] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0082] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0083] A network communication module 452, used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;

[0084] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);

[0085] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.

[0086] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 The memory parsing device 455 of the virtual scene stored in the memory 450 is shown, which can be software in the form of a program and a plug-in, etc., including the following software modules: an acquisition module 4551, a processing module 4552, a collection module 4553 and a determination module 4554. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.

[0087] In some embodiments, the terminal or server can implement the memory parsing method of the virtual scene provided in the embodiment of the present application by running various computer executable instructions or computer programs. For example, computer executable instructions can be commands, machine instructions or software instructions at the microprogram level. The computer program can be a native program or software module in the operating system; it can be a local (Native) application (APPlication, APP), that is, a program that needs to be installed in the operating system to run, such as memory data acquisition software. In short, the above-mentioned computer executable instructions can be instructions in any form, and the above-mentioned computer program can be an application, module or plug-in in any form.

[0088] The memory parsing method of the virtual scene provided in the embodiment of the present application will be explained in combination with the exemplary application and implementation of the terminal provided in the embodiment of the present application.

[0089] Next, the memory parsing method of the virtual scene provided by the embodiment of the present application is described. As mentioned above, the electronic device implementing the image processing method of the embodiment of the present application can be a terminal or a server, or a combination of the two. Therefore, the execution subject of each step will not be repeatedly described below.

[0090] See also Figure 3A , Figure 3A is a flow chart of a memory parsing method for a virtual scene provided in an embodiment of the present application, which will be combined with Figure 3A The steps shown are explained.

[0091] In step 101, a software package of a virtual scene is obtained.

[0092] In some embodiments, the version of the software package is any version, including a released version and a development version.

[0093] In some embodiments, see Figure 3B , Figure 3B is a flowchart of a software package for obtaining a virtual scene provided in an embodiment of the present application, Figure 3A Step 101 can be performed by Figure 3BThe processing from step 1011 to step 1012 is implemented as described in detail below.

[0094] In step 1011, resources of the virtual scene are obtained.

[0095] As an example, in a Unity game scene, the resources of the virtual scene include the environment, characters, obstacles, decorations, and UI interfaces in the scene.

[0096] In step 1012, a software package of the virtual scene is constructed based on the resources, wherein the version of the software package is any version including a release version and a development version.

[0097] Continue to see Figure 3A , and the description continues with step 101 above.

[0098] In step 102, memory is allocated to the software package, and the software package is run based on the memory.

[0099] In some embodiments, the dynamic activation of relevant configurations for performance data collection can be accomplished by adding a collection configuration control in the software package. Figure 4A , Figure 4A is a flow chart of the collection configuration provided in the embodiment of the present application. Figure 3A Before step 102, you can execute Figure 4A The processing from step 201 to step 202 is implemented as described in detail below.

[0100] In step 201, acquisition configuration controls are displayed.

[0101] In some embodiments, a configuration entry of a software package is displayed, and in response to a trigger operation on the configuration entry, a collection configuration control of a release version is displayed.

[0102] As an example, see Fig. 7A , Fig. 7A This is a schematic diagram of the acquisition configuration interface provided by the embodiment of the present application. Fig. 7A When the collection configuration 701A is executed, the subsequent configuration of the collection tag and the collection engine is completed in response to the triggering operation of the collection tag configuration 702A or the collection engine configuration 703A.

[0103] In step 202, in response to the start operation of the collection configuration control, the collection tag configuration interface and the collection engine configuration interface are displayed, the collection tag configuration is obtained through the collection tag configuration interface, and the collection engine configuration for collecting memory data is obtained through the collection engine configuration interface.

[0104] The embodiment of the present application sets a collection configuration control before the software package is run, thereby realizing that there is no need to build a separate software package. The memory data with problems can be specially collected as the memory data to be parsed by obtaining the collection tag configuration and the collection engine configuration; the memory data to be parsed is parsed to obtain the parsing result of the memory data to be parsed. The above scheme does not rely on building a software package specifically for a specific problem as in the prior art. On the basis of the existing software package, memory data can be collected and related memory data can be parsed to provide a parsing result for reference in the development of the software package, thereby improving the efficiency of memory data collection, thereby improving the research and development efficiency of subsequent memory parsing.

[0105] In some embodiments, the acquisition tag configuration interface includes multiple type tags for memory data, and the multiple type tags include: vertex cache object, texture, render texture, managed heap memory, native code conversion, hash table, and process.

[0106] As an example, see Figure 7B , Figure 7B It is a schematic diagram of the collection tag configuration interface and the collection engine configuration interface provided in the embodiment of the present application. Figure 7B The acquisition engine configuration interface 701B includes multiple type tags such as vertex cache objects, textures, rendering textures, managed heap memory, local code conversion, hash tables and processes.

[0107] In some embodiments, obtaining the collection tag configuration through the collection tag configuration interface includes: in response to the tag configuration operation, storing the selected type tag in the tag array as the collection tag configuration, wherein the selected type tag represents the data collection function of the corresponding type of memory data.

[0108] In some embodiments, when performing a collection tag configuration operation, all tags may be selected by default; or all tags may be unselected and manually selected by the user; or previously selected tags (e.g., high frequency, i.e., frequency higher than a frequency threshold) may be automatically selected.

[0109] In some embodiments, by adding a switch configuration in the release version software package, dynamic activation when performance collection is required can be achieved without building a development version software package.

[0110] In some embodiments, the acquisition engine configures the on / off state of the memory allocation function and the on / off state of the memory release function. Figure 4B , Figure 4B is a flow chart of the configuration of the acquisition engine provided in the embodiment of the present application, Figure 4A In step 202, "obtaining the collection engine configuration for collecting memory data through the collection engine configuration" can be performed by executing Figure 4B The processing from step 2021 to step 2023 is implemented as described in detail below.

[0111] In step 221, the collection engine configuration interface is displayed, wherein the collection engine configuration interface includes configuration controls for a memory allocation function function and configuration controls for a memory release function function, the memory allocation function function is used to record classification mark records of memory data corresponding to collection tags, and the memory release function function is used to record release records of memory data.

[0112] As an example, see Figure 7B , Figure 7B The acquisition engine configuration interface 702B includes configuration controls for memory allocation functions and configuration controls for memory release functions.

[0113] In step 2022, in response to an opening operation of a configuration control for the memory allocation function, the memory allocation function is placed in an open state.

[0114] As an example, see Figure 7B The developer can trigger the configuration control of the memory allocation function in the acquisition engine configuration interface 702B to turn on the memory allocation function.

[0115] In step 2023, in response to the start operation of the configuration control for the memory release function, the memory release function is placed in an open state.

[0116] As an example, see Figure 7B The developer can trigger the configuration control of the memory release function in the acquisition engine configuration interface 702B to turn on the memory release function.

[0117] The embodiment of the present application solves the technical problem in the prior art that only single-frame capture and analysis can be performed during memory data analysis by capturing the entire memory allocation process during the memory data collection process, thereby achieving complete curve recording of memory data, greatly facilitating subsequent analysis of memory data in problem scenarios, and improving research and development efficiency.

[0118] Continue to see Figure 3A , and the description continues with step 102 above.

[0119] In step 103, performance data is collected from the memory.

[0120] In some embodiments, performance data is collected from memory using PerfDog.

[0121] As an example, first connect PerfDog to the terminal to be tested (such as a mobile phone); then, obtain the parameters required for the performance test that the tester has checked on PerfDog; secondly, in response to the tester selecting the APP to be tested on PerfDog, run the APP (such as a game) in the terminal. Wait for the game to stabilize and start recording, for example, wait for 2 minutes, and in response to the tester clicking the trigger operation to start performance recording on PerfDog, upload the selected performance data to the PerfDog cloud web, and generate an excel table locally.

[0122] In some embodiments, see Figure 3C , Figure 3C is a schematic diagram of a process for collecting performance data provided in an embodiment of the present application, Figure 3A Step 103 can be performed by the acquisition engine Figure 3C The processing from step 1031 to step 1032 is implemented as described in detail below.

[0123] In step 1031, performance parameters of a terminal device used to run the software package are obtained, wherein the performance parameters include at least one of the following: frame rate, processor computing power, and memory capacity.

[0124] In some embodiments, the frame rate represents the number of images played per second. The higher the frame rate, the better the picture quality. Frame rate-related performance parameters also include: average number of frames (average frame rate over a period of time), frame rate variance (frame rate variance over a period of time), APP average CPU usage, average GPU usage, average memory, and peak memory.

[0125] In step 1032, memory data corresponding to the performance parameters is collected from the memory of the terminal device as performance data.

[0126] In some embodiments, memory data corresponding to frame rate, average CPU usage, average GPU usage, average memory, and peak memory are collected from the memory of the terminal device as performance data.

[0127] Continue to see Figure 3A , and the description continues with step 103 above.

[0128] In step 104, the distribution of the performance data in the memory is determined based on the performance data.

[0129] In some embodiments, the distribution of the performance data in the memory is determined based on the location of the performance data collected from the memory of the terminal device. The performance data collected from the terminal device is distributed at different locations in the memory, and the distribution of each part of the performance data in the memory can be determined from the location of the performance data in the memory.

[0130] In step 105, a memory hotspot corresponding to the performance data in the memory is determined based on the distribution condition.

[0131] In some embodiments, the memory hotspot corresponding to the performance data in the memory can be determined based on the distribution of the performance data in the memory. When the distribution of the performance data is relatively concentrated, that is, the distribution density of the performance data in the memory is higher than a preset threshold, the memory hotspot corresponding to the performance data in the current distribution concentration in the memory can be determined.

[0132] In step 106, a collection tag configuration is obtained, and a collection engine configuration is obtained, wherein the collection tag configuration records the tag of the memory data to be collected, and the collection engine configuration records the collection engine for collecting the memory data to be collected.

[0133] In some embodiments, before collecting memory data, by configuring the collection tag and the collection engine, and obtaining the corresponding collection tag configuration and collection engine configuration, the configuration of the collection engine corresponds to the configuration of the collection tag.

[0134] In step 107, memory data with tags are collected from memory hot spots by a collection engine as memory data to be parsed.

[0135] In some embodiments, see Figure 3D , Figure 3D is a schematic diagram of a process for obtaining memory data to be parsed provided in an embodiment of the present application, Figure 3A Step 107 can be performed by the acquisition engine Figure 3D The processing from step 1071 to step 1073 is implemented as described in detail below.

[0136] In step 1071, the type of memory data and auxiliary memory information in the memory hotspot are obtained.

[0137] In some embodiments, the resource types of memory data include Texture2D, Mesh, Material, AnimationClip, etc.; the auxiliary memory information of the resource includes instance number instanceID, memory size memorySize, resource type assetType, resource name name and object pointer, etc.

[0138] In step 1072, the registration object function is called to compare the registration object and type of the memory data.

[0139] In some embodiments, the registration object function may be RegisterObject, which checks whether the current registered object contains attribute categories such as Texture2d, Mesh, Material, AnimationClip, RenderTexture, etc. If similar attributes are contained, the current object category will be statistically classified.

[0140] In step 1073, in response to the comparison being consistent, the memory data corresponding to the registered object is obtained as the memory data to be parsed.

[0141] In some embodiments, in response to receiving a deregistration operation for an object, a deregistration object function is called to collect statistics on memory data after the deregistration operation.

[0142] In some embodiments, see Figure 5A , Figure 5A is a flow chart of obtaining the full stack of the managed heap memory provided by the embodiment of the present application. When the memory data to be collected includes the full stack data in the managed heap memory and the data collection function of the managed heap memory is not enabled, in executing Figure 3A Before step 107, you can execute Figure 5A The processing from step 301 to step 304 is implemented as described in detail below.

[0143] In step 301, a memory allocator is configured for different types of objects, wherein the different types of objects include memory space, regular heap memory, and type space.

[0144] In some embodiments, different types of objects include memory space (ie, PTRPREE), regular heap memory (ie, NORMAL), and type space (ie, TYPED).

[0145] In step 302, memory is allocated to the object through a memory allocator corresponding to the object, and code is loaded into the memory allocated to the object.

[0146] In some embodiments, memory is allocated to the object through a memory allocator corresponding to the object, and code is loaded into the memory allocated to the object, where the code is used to allocate memory to the object.

[0147] In step 303, a code for obtaining a stack is embedded in the code, wherein the stack is used for function allocation.

[0148] In some embodiments, during the process of allocating memory for various types of objects, code for obtaining stack data is embedded in the code for performing memory allocation, so that during the process of parsing the memory allocation, stack data can be obtained for deep parsing.

[0149] In step 304, full stack data in the managed heap memory is obtained based on the code.

[0150] Continue to see Figure 3A Step 107.

[0151] In some embodiments, see Figure 5B , Figure 5B This is a schematic diagram of the process of writing memory data offline provided by the embodiment of the present application. Figure 3A After step 107, you can execute Figure 5B The processing from step 401 to step 402 is implemented as described in detail below.

[0152] In step 401, a custom duration and a custom data volume are obtained.

[0153] In some embodiments, the duration of memory data collection and the amount of data stored at a single time can be set to achieve customized collection of memory data.

[0154] The embodiments of the present application can realize customized collection of memory data through customized duration and customized data volume, solve the technical problem of limited data storage length in the prior art, and effectively improve the efficiency of memory data collection.

[0155] In step 402, the memory data with tags within the custom duration is generated into an offline file according to the defined data volume, and the offline file is written into the memory.

[0156] In some embodiments, the collected memory data is written to the hard disk once every 10 MB of memory through offline files, thereby realizing the custom collection of the embodiments of the present application. Through the custom collection of memory data, the length of the collection time can be customized at will.

[0157] Continue to see Figure 3A , and the description continues with step 107 above.

[0158] In step 108, the memory data to be parsed is parsed to obtain a parsing result of the memory data to be parsed.

[0159] In some embodiments, see Figure 3E , Figure 3E is a schematic diagram of a process for parsing memory data provided by an embodiment of the present application. When the memory data to be collected includes the full amount of stack data in the managed heap memory, Figure 3A Step 108 can be performed by the acquisition engine Figure 3E The processing from step 1081 to step 1085 is implemented as described in detail below.

[0160] In step 1081, addresses of multiple function call sequences are obtained through the full stack data of the managed heap memory.

[0161] In some embodiments, the addresses of function call sequences are stored in the full stack data of the managed heap memory. The addresses of multiple function call sequences can be obtained through the full stack data for subsequent symbol table parsing processing.

[0162] In step 1082, the addresses of the multiple function call sequences are restored to multiple function call sequence addresses in binary form respectively.

[0163] In some embodiments, the addresses of multiple function call sequences can be restored to multiple function call sequence addresses in binary form by loading a symbol table.

[0164] In step 1083, an address dictionary is constructed based on multiple binary function call sequence addresses and different function names, wherein the function name is the name of the function used for memory allocation.

[0165] In some embodiments, the binary form of the function call sequence address and the function name present a one-to-one correspondence.

[0166] In step 1084, the address dictionary is searched based on the address of each function call sequence to obtain the function name corresponding to the function call sequence address in binary form as the calling function name.

[0167] In some embodiments, based on the address of each function call sequence, the address dictionary is queried by calling the dladdr function to obtain the function name corresponding to the function call sequence address in binary form as the calling function name.

[0168] As an example, when the address of the function call sequence corresponding to sequence 1 of the first query is A, based on address A, the address dictionary is queried, and address A and the corresponding function name in the address dictionary are cached; the address of the function call sequence corresponding to sequence 2 of the second query is B, and the function name corresponding to address B is not found in the current cache data, the address dictionary is continued to be queried, and address A and the corresponding function name in the address dictionary are cached; when the address of the function call sequence corresponding to sequence 3 of the third query is A, the function name corresponding to address A exists in the current cache data, and there is no need to query the address dictionary again, and the function name corresponding to sequence 1 in the cache data can be directly determined as the function name corresponding to sequence 3.

[0169] In step 1085, the calling function name is parsed into a symbolic function name as a parsing result.

[0170] In some embodiments, calling a function name is a lower-level name demangle, and source-level parsing is performed by using abi::__cxa_demangle to decode the low-level symbol name into a readable function name.

[0171] The following describes an exemplary application of the virtual scene memory parsing method provided in an embodiment of the present application in an actual application scenario.

[0172] For example, the application scenario can be the scene of acceptance of Unity game memory performance. When accepting the memory performance of Unity game, it is necessary to first collect the game-related memory data, and then perform detailed analysis of the collected data, perform various targeted performance optimizations, and perform the next round of version performance acceptance after the version is optimized. The embodiment of the present application provides a virtual scene memory analysis method to perform full automatic analysis of Unity game memory data and deep analysis of managed heap memory, thereby improving the efficiency of memory data collection, thereby improving the research and development efficiency of subsequent memory analysis.

[0173] See also Fig. 6A , Fig. 6A 1 is a flow chart of the automatic analysis of MemoryProfiler performance provided in the embodiment of the present application, corresponding to the analysis of the full memory data part proposed in the embodiment of the present application. Fig. 6A As shown, first in step 601A, MemoryProfiler collects tags and configures various memory tags that need to be collected. By default, all tags are collected to determine the scope of collection. Figure 6B , Figure 6B is a schematic diagram of the MemoryProfiler collection tag configuration provided in an embodiment of the present application, Figure 6B The label array in is the label array in the collection label configuration in the memory parsing method of the virtual scene provided in the embodiment of the present application. Various memory items such as vertex buffer objects (vbo) and textures are configured in the label array. By default, all memory label items will be configured and collected.

[0174] Next, in step 602A, the MemoryProfiler collection engine configuration is performed to enable the configuration of various tag collections in the engine, so as to enable the engine collection function. Figure 6C , Figure 6C is a schematic diagram of the configuration of the MemoryProfiler collection engine provided in the embodiment of the present application. Figure 6CIn the MemoryManager:Allocate memory allocator in the MemoryManager:Allocate function, the memory allocation function CUSTOM_MEMSTATS_ALLOC is enabled to classify and mark the memory under each label. Figure 6C The MemoryManager: Deallocate allocated memory releaser in the CUSTOM_MEMSTATS_DEALLOC function is used to record the release of memory data.

[0175] Then in step 603A, MemoryProfiler is used to collect resource memory configurations, and memory configurations of various resources are collected for collecting memory data. Fig.6D , Fig.6D Schematic diagram of the memory configuration of the resource collection provided by the MemoryProfiler embodiment of the present application. Fig.6D As shown, the AssetType in the memory resource information 601D shows various resource types such as Texture2D, Mesh, Material, AnimationClip, etc.; the AssetInfo in the memory resource information 601D shows the auxiliary memory information of various resources, including the instance ID instanceID, memory size memorySize, resource type assetType, resource name name, and object pointer, etc. Fig.6D The functions in the resource statistics registration 602D are used to perform various resource statistics registration tasks. Specifically, by calling the RegisterObject function in the resource statistics registration 602D, it is checked whether the current registered object obj contains attribute categories such as Texture2d, Mesh, Material, AnimationClip, RenderTexture, etc. If it contains similar attributes, the current object category will be statistically classified; if the current object is to be deregistered, the UnRegisterObject function in the resource statistics registration 602D will be called to perform statistical operations on the deregistration of related objects in the resource memory.

[0176] In the process of collecting the full amount of memory data, the collected memory data is written into the storage device in the form of an offline file in step 604A according to the above steps. After the collection is completed, the overall performance file is compressed in step 605A. Finally, in step 606A, the compressed file is uploaded to the background. Fig. 6E , Fig. 6EThis is a schematic diagram of the MemoryProfiler full memory collection and analysis provided by the embodiment of this application. Fig. 6E As shown, from the memory resource information 601E, you can see the subdivided memory of each resource such as texture, shader, animation, vertexdata, etc. You can view Mono related memory such as Monoreserved and Monooused, and you can also view system related memory such as swappss and gfxdevice. From the analysis result 602E, it can be seen that all kinds of data can be collected and obtained continuously, so that you can see the memory loading and release status of the entire game.

[0177] For an in-depth analysis of managed heap memory data proposed in the embodiments of this application, see Fig. 6F , Fig. 6F It is a flow chart of the MonoProfiler performance automatic analysis provided by the embodiment of the present application. First, in step 601F, the MonoProfiler engine configuration is performed, including various configurations of the engine memory allocation collection to obtain interfaces to various memory allocations and recycling, including the memory object allocator configuration collected by MonoProfiler and the MonoProfiler engine configuration stack acquisition.

[0178] For the configuration of memory object allocators collected by MonoProfiler, see Figure 6G , Figure 6G This is a schematic diagram of the memory object allocator collected by MonoProfiler provided in the embodiment of the present application. In the process of managed heap memory data collection, the operation of the Boehm GC memory allocator used in Unity is mainly recorded, such as Figure 6G As shown, three types of objects and corresponding allocators are involved, namely, memory space (ie, PTRPREE), conventional heap memory (ie, NORMAL), and type space (ie, TYPED), including PTRFREE object memory allocator ALLOC_PTRFREE, NORMAL object memory allocator ALLOC_OBJECT, and TYPED object memory allocator ALLOC_TYPED. For TYPED objects, if GCJ is supported, the GC_gcj_malloc allocator will be used at the bottom layer; if there are no description files of various types, the GC_MALLOC allocator will be used at the bottom layer.

[0179] See MonoProfiler engine configuration stack for more information. Figure 6H , Figure 6H is a schematic diagram of obtaining the MonoProfiler engine configuration stack provided in an embodiment of the present application, such as Figure 6HAs shown, by embedding the stack acquisition code when allocating PTRFREE objects, the stack chain of each function allocation can be acquired. This function mainly acquires the full stack through the GetStack function in the AutoStack function. At this time, only the address of the function call sequence is saved, and the subsequent symbol table parsing will be performed.

[0180] Secondly, in step 602F, MonoProfiler memory data collection is performed. MonoProfiler will collect various managed heap memory data during the running process of the game.

[0181] In passing Figure 6H After the MonoProfiler engine configuration stack acquisition processing is shown, symbol table parsing processing is performed to translate the collected function call sequence addresses into corresponding text expressions, so that R&D personnel can view them easily. Fig.6I , Fig.6I A schematic diagram of the flowchart of symbol table parsing provided in an embodiment of the present application.

[0182] like Fig.6I As shown, firstly, in step 601I, the call sequence is summarized. The call sequence contains all hexadecimal address values ​​of the function call sequence. The address of the function call sequence after the call sequence summary operation in step 601I needs to be parsed and restored to the name string.

[0183] Secondly, by loading the symbol table, the hexadecimal address of the function call sequence is restored to the binary form of the function call sequence address, and based on the correspondence between the binary form of the function call sequence address and different function names, step 602I is executed to establish the address dictionary table, where the function name is the name of the function used for memory allocation.

[0184] Then in step 603I, the calling function name is obtained, and the address dictionary table obtained by the address dictionary table establishment operation in step 602I is queried based on the address of each function calling sequence, and the function name corresponding to the binary function calling sequence address is obtained as the calling function name. Specifically, the calling function name is obtained by using the dladdr function, which returns the dl_info structure according to the function address. Figure 6J , Figure 6J This is a schematic diagram of the dl_info structure provided in the embodiment of the present application. Figure 6JAs shown, dli_sname is a pointer to the name of the symbol closest to the specified address (that is, the address of the function call sequence), which has the same address or the closest symbol with a lower address. The function name obtained at this time is a relatively low-level name decoding, and finally abi::__cxa_demangle is used to decode the low-level symbol name into a readable function name, thereby completing the source code level parsing.

[0185] Finally, in step 604I, all symbolized sequences are saved, that is, all the calling functions obtained by the operation of obtaining the calling function name in step 603I are parsed into symbolized function names and saved. Figure 6K , Figure 6K This is a diagram showing the effect of symbol table analysis provided in the embodiment of the present application. Figure 6K As shown, the hexadecimal value of the allocation address of the first sequence in the function call sequence 601K is 0x15477BAB0. The symbol table analysis result 602K shows that the allocation method of the first sequence in the corresponding function call sequence 601K is GC_Malloc, and the allocation size is 34 bytes. The first sequence in the function call sequence 601K is symbolically analyzed, and the following can be obtained: Figure 6K As shown, the symbol table parsing result 602K shows that the specific function name is GentleGuideUIBaseCtrl::GetOffset(), its parent function is GentleGuideCircleUICtrl::UpdateUIPos(), and its parent function is GentleGuideUIBaseCtrl::Update().

[0186] During the process of collecting managed heap memory data, the file writing operation in step 603F is still performed to write the collected memory data into the storage device in the form of an offline file. After the collection is completed, the overall performance file is compressed and saved in step 604F, and finally the compressed file is uploaded to the background in step 605F. Figure 6L , Figure 6L : is a schematic diagram of MonoProfiler memory analysis provided by the embodiment of the present application. Figure 6LAs shown, there are function call sequence 601L, symbol table analysis result 602L, memory analysis curve 603L, and memory data information 604L. Function call sequence 601L shows the address, type and allocation size of each Mono memory allocation; the symbol table analysis result 602L shows that the corresponding memory allocation stack is 34 bytes, and the overall call queue from the parent function to the child function is: GentleGuideUIBaseCtrl::Update()->GentleGuideCircleUICtrl::UpdateUIPos()->GentleGuideUIBaseCtrl::GetOffset(); the memory data information 604L shows the frame number frameindex, Monoreserved memory, Monoused memory and event events number.

[0187] Through the memory parsing method of the virtual scene provided by the embodiment of the present application, full automated parsing of Unity game memory data and deep parsing of managed heap memory are achieved, thereby improving the efficiency of memory data collection and thus improving the research and development efficiency of subsequent memory parsing.

[0188] The following is a description of an exemplary structure of a virtual scene memory parsing device 455 provided in an embodiment of the present application implemented as a software module. In some embodiments, Figure 2 As shown, the software modules stored in the memory parsing device 455 of the virtual scene in the memory 440 may include:

[0189] The acquisition module 4551 is used to acquire the software package of the virtual scene; acquire the acquisition tag configuration, and acquire the acquisition engine configuration, wherein the acquisition tag configuration records the tags of the memory data to be acquired, and the acquisition engine configuration records the acquisition engine used to acquire the memory data to be acquired.

[0190] The processing module 4552 is used to allocate memory for the software package and run the software package based on the memory; parse the memory data to be parsed and obtain the parsing result of the memory data to be parsed.

[0191] The collection module 4553 is used to collect performance data from the memory; the memory data with the label is collected from the memory hotspots through the collection engine as the memory data to be parsed.

[0192] The determination module 4554 is used to determine the distribution of the performance data in the memory based on the performance data; and determine the memory hotspot corresponding to the performance data in the memory based on the distribution.

[0193] In some embodiments, the acquisition module 4551 is also used to display the acquisition configuration control; in response to the start operation of the acquisition configuration control, the acquisition tag configuration interface and the acquisition engine configuration interface are displayed, the acquisition tag configuration is acquired through the acquisition tag configuration interface, and the acquisition engine configuration for acquiring memory data is acquired through the acquisition engine configuration interface.

[0194] In some embodiments, the collection tag configuration interface includes multiple type tags for memory data, and the multiple type tags include: vertex cache object, texture, render texture, managed heap memory, native code conversion, hash table, and process.

[0195] In some embodiments, the acquisition module 4551 is further used to store the selected type tag into the tag array in response to the tag configuration operation as a collection tag configuration, wherein the selected type tag represents the data collection function of the corresponding type of memory data.

[0196] In some embodiments, the processing module 4552 is further used to configure the switch state of the memory allocation function and the switch state of the memory release function through the acquisition engine.

[0197] In some embodiments, the processing module 4552 is also used to display the collection engine configuration interface, wherein the collection engine configuration interface includes a configuration control of a memory allocation function function and a configuration control of a memory release function function, the memory allocation function function is used to record the classification mark record of the memory data corresponding to the collection tag, and the memory release function function is used to record the release record of the memory data; in response to an opening operation on the configuration control of the memory allocation function function, the memory allocation function function is placed in an open state; in response to an opening operation on the configuration control of the memory release function function, the memory release function function is placed in an open state.

[0198] In some embodiments, when the memory data to be collected includes the full stack data in the managed heap memory and the data collection function of the managed heap memory is not enabled, the processing module 4552 is also used to configure a memory allocator for different types of objects, where the different types of objects include memory space, regular heap memory, and type space; allocate memory for the object through the memory allocator corresponding to the object, and load the code in the memory allocated for the object; embed code for obtaining the stack in the code, where the stack is used for function allocation; and obtain the full stack data in the managed heap memory based on the code.

[0199] In some embodiments, when the memory data to be collected includes the full stack data in the managed heap memory, the processing module 4552 is also used to obtain the addresses of multiple function call sequences through the full stack data of the managed heap memory; restore the addresses of the multiple function call sequences into multiple function call sequence addresses in binary form respectively; construct an address dictionary based on the multiple binary function call sequence addresses and different function names, wherein the function name is the name of the function used for memory allocation; query the address dictionary based on the address of each function call sequence to obtain the function name corresponding to the binary function call sequence address as the calling function name; parse the calling function name into a symbolic function name as the parsing result.

[0200] In some embodiments, the acquisition module 4553 is also used to obtain performance parameters of a terminal device used to run the software package, wherein the performance parameters include at least one of the following: frame rate, processor computing power, and memory capacity; and memory data corresponding to the performance parameters is collected from the memory of the terminal device as performance data.

[0201] In some embodiments, the acquisition module 4553 is also used to perform the following processing through the acquisition engine: obtaining the type of memory data and auxiliary memory information in the memory hotspot; calling the registration object function to compare the registration object and type of the memory data; in response to the comparison being consistent, obtaining the memory data corresponding to the registration object as the memory data to be parsed.

[0202] In some embodiments, the processing module 4552 is further used to call the object deregistration function to collect statistics on memory data after the deregistration operation in response to receiving the deregistration operation for the object.

[0203] In some embodiments, the acquisition module 4551 is further used to acquire resources of the virtual scene; and construct a software package of the virtual scene based on the resources, wherein the version of the software package is any version including a release version and a development version.

[0204] In some embodiments, the acquisition module 4553 is also used to obtain a custom duration and a custom data volume;

[0205] Generate offline files for the tagged memory data within a custom duration according to the defined data volume, and write the offline files into the storage.

[0206] An embodiment of the present application provides a computer program product, which includes computer executable instructions. The computer executable instructions are stored in a computer-readable storage medium. A processor of an electronic device reads the computer executable instructions from the computer-readable storage medium, and the processor executes the computer executable instructions, so that the electronic device executes the memory parsing method of the virtual scene described above in the embodiment of the present application.

[0207] The embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will execute the memory parsing method of the virtual scene provided by the embodiment of the present application, for example, Figure 3A The memory parsing method of the virtual scene is shown.

[0208] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.

[0209] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0210] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0211] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.

[0212] In summary, the embodiment of the present application obtains the software package of the virtual scene, and sets the collection configuration control for the software package before the software package runs; in response to the opening operation of the collection configuration control, the configuration of the collection tag and the collection engine is realized during the operation of the software package. Among them, the collection tag configuration records the tags of the memory data to be collected, and the collection engine configuration records the collection engine for collecting the memory data to be collected; by obtaining the collection tag configuration and the collection engine configuration, the memory data with the tag is collected from the memory hotspot as the memory data to be parsed, so that the collected memory data is more comprehensive; at the same time, the collected memory data is collected in a custom manner by offline writing, so that all kinds of data can be stored offline for a long time; finally, by parsing the memory data to be parsed, the parsing result of the memory data to be parsed is obtained, which can improve the efficiency of memory data collection, thereby improving the research and development efficiency of subsequent memory parsing.

[0213] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A memory parsing method for a virtual scene, characterized in that: The method comprises: Get the software package of the virtual scene; Allocating memory for the software package, and running the software package based on the memory; collecting performance data from the memory; Determine, based on the performance data, the distribution of the performance data in the memory; Determine a memory hotspot corresponding to the performance data in the memory based on the distribution condition; Acquire a collection tag configuration and acquire a collection engine configuration, wherein the collection tag configuration records a tag of the memory data to be collected, and the collection engine configuration records a collection engine for collecting the memory data to be collected; Collecting memory data with the tag from the memory hotspot through the collection engine as memory data to be parsed; The memory data to be parsed is parsed to obtain a parsing result of the memory data to be parsed.

2. The method according to claim 1, characterized in that Before allocating memory for the software package and running the software package based on the memory, the method includes: Display acquisition configuration controls; In response to the opening operation of the acquisition configuration control, an acquisition tag configuration interface and an acquisition engine configuration interface are displayed, the acquisition tag configuration is obtained through the acquisition tag configuration interface, and the acquisition engine configuration for acquiring the memory data is obtained through the acquisition engine configuration interface.

3. The method according to claim 2, characterized in that The acquisition tag configuration interface includes multiple type tags of the memory data, and the multiple type tags include: vertex cache object, texture, render texture, managed heap memory, native code conversion, hash table and process; The acquiring the collection tag configuration through the collection tag configuration interface includes: In response to the tag configuration operation, the selected type tag is stored in the tag array as a collection tag configuration, wherein the selected type tag represents the activation of a data collection function for memory data of a corresponding type.

4. The method according to claim 2, characterized in that: The acquisition engine configuration includes a switch state of a memory allocation function and a switch state of a memory release function; The acquiring the acquisition engine configuration for acquiring the memory data through the acquisition engine configuration includes: Displaying a collection engine configuration interface, wherein the collection engine configuration interface includes a configuration control of the memory allocation function and a configuration control of the memory release function, the memory allocation function is used to record a classification mark record of the memory data corresponding to the collection tag, and the memory release function is used to record a release record of the memory data; In response to an opening operation of a configuration control for the memory allocation function, placing the memory allocation function in an opening state; In response to an opening operation of a configuration control for the memory release function, the memory release function is placed in an opening state.

5. The method according to claim 4, characterized in that When the memory data to be collected includes full stack data in a managed heap memory, and the data collection function of the managed heap memory is not enabled, before collecting the memory data with the tag from the memory hotspot by the collection engine, the method further includes: Configuring a memory allocator for different types of objects, wherein the different types of objects include memory space, regular heap memory, and type space; Allocating memory for the object through the memory allocator corresponding to the object, and loading code into the memory allocated for the object; embedding a code for acquiring a stack in the code, wherein the stack is used for function allocation; The full amount of stack data in the managed heap memory is obtained based on the code.

6. The method according to claim 1, characterized in that When the memory data to be collected includes full stack data in the managed heap memory, parsing the memory data to be parsed to obtain the parsing result of the memory data to be parsed includes: Obtaining addresses of multiple function call sequences through the full stack data of the managed heap memory; Restore the addresses of the plurality of function call sequences to a plurality of function call sequence addresses in binary form respectively; Building an address dictionary based on the multiple binary function call sequence addresses and different function names, wherein the function name is the name of the function used to perform the memory allocation; Based on the address of each function call sequence, the address dictionary is searched to obtain a function name corresponding to the function call sequence address in binary form as a calling function name; The calling function name is parsed into a symbolic function name as a parsing result.

7. The method according to claim 1, characterized in that The collecting performance data from the memory includes: Acquire performance parameters of a terminal device used to run the software package, wherein the performance parameters include at least one of the following: frame rate, processor computing power, and memory capacity; Memory data corresponding to the performance parameter is collected from the memory of the terminal device as the performance data.

8. The method according to any one of claims 1 to 7, characterized in that: The collecting the memory data with the tag from the memory hotspot by the collection engine as the memory data to be parsed includes: The following processing is performed by the acquisition engine: Obtaining the type of memory data and auxiliary memory information in the memory hotspot; Calling a registration object function to compare the registration object of the memory data with the type; In response to the comparison being consistent, the memory data corresponding to the registered object is obtained as the memory data to be parsed.

9. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: In response to receiving a deregistration operation for an object, a deregistration object function is called to collect statistics on memory data after the deregistration operation.

10. The method according to any one of claims 1 to 7, characterized in that: The software package for obtaining the virtual scene includes: Get resources of virtual scene; A software package of the virtual scene is constructed based on the resources, wherein the version of the software package is any version including a release version and a development version.

11. The method according to any one of claims 1 to 7, characterized in that: After the memory data with the tag is collected from the memory hotspot by the collection engine as the memory data to be parsed, the method further includes: Get custom duration and custom data volume; Generate an offline file for the memory data with the tag within the custom time according to the defined data volume, and write the offline file into the memory.

12. A memory parsing device for a virtual scene, characterized in that: The device comprises: An acquisition module is used to acquire a software package of a virtual scene; acquire an acquisition tag configuration, and acquire an acquisition engine configuration, wherein the acquisition tag configuration records a tag of memory data to be acquired, and the acquisition engine configuration records an acquisition engine for acquiring the memory data to be acquired; A processing module, configured to allocate memory to the software package and run the software package based on the memory; parse the memory data to be parsed to obtain a parsing result of the memory data to be parsed; A collection module, used to collect performance data from the memory; collect memory data with the label from the memory hotspot through the collection engine as memory data to be parsed; A determination module is used to determine the distribution of the performance data in the memory based on the performance data; and to determine the memory hotspot corresponding to the performance data in the memory based on the distribution.

13. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions; A processor is used to implement the memory parsing method of the virtual scene according to any one of claims 1 to 11 when executing the computer executable instructions stored in the memory.

14. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the memory parsing method of the virtual scene according to any one of claims 1 to 11 is implemented.

15. A computer program product comprising computer executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the memory parsing method of the virtual scene described in any one of claims 1 to 11 is implemented.