Memory allocation analysis method and device and electronic equipment

By turning on the target application when the memory allocation stack recording function of the target system is enabled and memory allocation processing is performed based on the preset memory allocation dimension, the problem of inaccurate memory analysis in the prior art is solved, and the accurate acquisition and display of the memory allocation situation of the target application is achieved.

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

Patent Information

Application Number
CN202311556461.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-21
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

The memory data statistics of existing memory analysis tools are based on the estimated value of the preset engine and are not the physical memory used in actual use, resulting in inaccurate analysis and inability to obtain resource allocators, which increases the difficulty of analysis optimization.

Method used

When the memory allocation stack recording function of the target system is enabled, the target application is enabled, and based on the preset memory allocation dimension, multiple allocation objects in the target application are allocated, and memory allocation data is obtained at the target runtime, and allocation analysis is performed to obtain the accurate memory allocation situation.

Benefits of technology

It realizes accurate acquisition of memory allocation status of multiple target allocation objects during the target application operation, and improves the accuracy and readability of memory analysis results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029745A_ABST
    Figure CN120029745A_ABST
Patent Text Reader

Abstract

The invention relates to a memory allocation analysis method and device and electronic equipment, and relates to the technical field of computers.The method comprises the steps that in response to a memory allocation test instruction for a target application, the target application is started under the condition that a stack recording function of memory allocation of a target system is started; in the running process of the target application, based on a preset memory allocation dimension, performing memory allocation processing on multiple allocation objects in the target application; memory allocation data of a plurality of target allocation objects corresponding to the target operation moment are obtained, and the memory allocation data are memory space data allocated to each target allocation object by the target system at the target operation moment; and performing distribution analysis on the memory distribution data to obtain a target distribution analysis result corresponding to the target operation moment. According to the embodiment of the invention, full-amount memory allocation and capture can be realized, and the accuracy and readability of a memory analysis result are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a memory allocation analysis method, device and electronic device. Background Art

[0002] During the application performance acceptance, various memory problems often occur, such as excessive memory or memory leaks. Specifically, a memory analysis tool can be used to perform a rough memory allocation analysis; if the memory is too high, the memory allocation will be split to see which component has excessive memory allocation and caused a memory bottleneck; then the next round of performance acceptance will be entered until the performance meets the standard. For example, taking the target application as a game application, the total memory usage, memory usage, etc. can be counted based on the preset memory analysis tool in the preset engine.

[0003] However, the memory data statistics in the above-mentioned preset memory analysis tool are based on the estimated value of the preset engine, not PSS (Proportional Set Size, the actual physical memory used); if the statistical value of a resource on the preset memory analysis tool is large, its PSS value in the memory will also tend to be large. This trend-based analysis will be very inaccurate. Some resources may have a relatively large value estimated by the preset engine, but the proportion in PSS is very small, which will seriously affect the optimization analysis direction. In addition, the memory analysis based on the preset memory analysis tool can only see how much memory a certain resource occupies, but it is impossible to obtain who allocated this resource, which increases the difficulty of analysis and optimization. Therefore, the memory analysis results of the above method are less accurate and less readable. Summary of the invention

[0004] In view of the above-mentioned technical problems, the present disclosure proposes a memory allocation analysis method, device and electronic device.

[0005] According to one aspect of an embodiment of the present disclosure, a memory allocation analysis method is provided, including:

[0006] In response to a memory allocation test instruction for a target application, the target application is started when a stack recording function of memory allocation of a target system is started; the target application runs on the target system;

[0007] During the operation of the target application, memory allocation processing is performed on a plurality of allocation objects in the target application based on a preset memory allocation dimension, wherein the preset allocation dimension is used to instruct the target system to perform memory allocation based on a local heap system of the target terminal;

[0008] Obtain memory allocation data of multiple target allocation objects corresponding to the target runtime; the memory allocation data is memory space data allocated by the target system to each target allocation object at the target runtime; the memory space data corresponding to each target allocation object represents the memory space occupation of the target storage data corresponding to each target allocation object in the local heap system;

[0009] Performing allocation analysis on the memory allocation data to obtain a target allocation analysis result corresponding to the target runtime.

[0010] According to another aspect of an embodiment of the present disclosure, a memory allocation analysis device is provided, comprising:

[0011] A first execution module is used for, in response to a memory allocation test instruction for a target application, starting the target application when a stack recording function of memory allocation of a target system is already started; the target application runs on the target system;

[0012] an allocation processing module, used for performing memory allocation processing on a plurality of allocation objects in the target application based on a preset memory allocation dimension during the operation of the target application, wherein the preset allocation dimension is used to instruct the target system to perform memory allocation based on a local heap system of the target terminal;

[0013] An allocation data acquisition module is used to acquire memory allocation data of multiple target allocation objects corresponding to the target runtime; the memory allocation data is memory space data allocated by the target system to each target allocation object at the target runtime; the memory space data corresponding to each target allocation object represents the memory space occupation of the target storage data corresponding to each target allocation object in the local heap system;

[0014] The allocation analysis module is used to perform allocation analysis on the memory allocation data to obtain a target allocation analysis result corresponding to the target runtime.

[0015] Optionally, the first execution module includes:

[0016] A first configuration update module, configured to update preset engine configuration information in the target application in response to a memory allocation test instruction for the target application, so that the memory allocation dimension of the target application is updated to the preset allocation dimension;

[0017] A second execution module, used for enabling the stack recording function;

[0018] The third execution module is configured to enable the target application when the stack recording function is enabled.

[0019] Optionally, the configuration update module includes:

[0020] The second configuration update module is used to update the first preset configuration information in the preset engine configuration information to the second preset configuration information, so that the memory allocation dimension is updated to the preset allocation dimension; the first preset configuration information is used to instruct the target system to perform memory allocation based on the box-type memory allocator.

[0021] Optionally, the second execution module includes:

[0022] A tool library acquisition module, used to add a preset recording function tool library to a target operating system library corresponding to the target system;

[0023] A service closing module, used to close a plurality of preset system services corresponding to the target system;

[0024] A function activation module, used for activating the stack recording function;

[0025] A service restart module, used to restart the plurality of preset system services corresponding to the target system to load the preset recording function tool library;

[0026] Correspondingly, the allocation data acquisition module includes:

[0027] The target data acquisition module is used to acquire the memory allocation data of the multiple target allocation objects corresponding to the target running time based on the preset recording function tool library.

[0028] Optionally, the memory allocation data of the multiple target allocation objects include call address sequences corresponding to each of the multiple target allocation objects and sequence allocation data corresponding to each of the multiple call address sequences, the call address sequence corresponding to any target allocation object represents the logical call relationship of any target allocation object, and the target allocation analysis result is used to indicate the hierarchical relationship between the multiple target allocation objects and the memory space data corresponding to each target allocation object; the allocation analysis module includes:

[0029] A tree structure construction module, configured to construct a target tree structure based on the call address sequences corresponding to the multiple target allocation objects, wherein the target tree structure is a tree structure having the multiple target allocation objects as nodes and the hierarchical relationships between the multiple target allocation objects as edges;

[0030] The first result generating module is used to generate the target allocation analysis result based on the target tree structure and the sequence allocation data corresponding to each of the plurality of call address sequences.

[0031] Optionally, the first result generating module includes:

[0032] A proportion data acquisition module is used to determine the memory proportion index data corresponding to each target allocation object based on the sequence allocation data corresponding to each of the multiple call address sequences; the memory proportion index data corresponding to each target allocation object represents the proportion of the target storage data corresponding to each target allocation object relative to the storage data corresponding to the multiple target allocation objects;

[0033] A target identification acquisition module, used to determine the target object identification information corresponding to each target allocation object based on a preset address mapping relationship;

[0034] The second result generating module is used to generate the target allocation analysis result based on the memory usage index data corresponding to each target allocation object, the target object identification information corresponding to each target allocation object and the target tree structure.

[0035] Optionally, the device further comprises:

[0036] A calling address acquisition module, used for determining a plurality of calling addresses based on the calling address sequences corresponding to the plurality of target allocation objects;

[0037] A first identification acquisition module, used to acquire first object identification information corresponding to each calling address;

[0038] A second identification acquisition module, used for decoding the first object identification information corresponding to each calling address to obtain the second object identification information corresponding to each calling address;

[0039] A mapping relationship building module is used to build the preset address mapping relationship based on the multiple calling addresses and the second object identification information corresponding to each calling address.

[0040] Optionally, the device further comprises:

[0041] a fourth execution module, configured to execute a preset business operation in response to a first business operation instruction for the target application, so as to perform memory allocation processing on the multiple allocation objects based on the preset memory allocation dimension;

[0042] A moment memory acquisition module is used to acquire moment memory data corresponding to a plurality of running moments during the execution of the preset business operation; the moment memory data corresponding to any running moment represents the memory occupancy at any running moment;

[0043] A target time acquisition module, configured to determine the target running time from the multiple running times based on the time memory data corresponding to the multiple running times;

[0044] Accordingly, the allocation processing module includes:

[0045] A fifth execution module is used to execute the preset business operation in response to the secondary business operation instruction for the target application, so as to perform memory allocation processing on the multiple allocation objects based on the preset memory allocation dimension.

[0046] Optionally, the allocation processing module includes:

[0047] A memory allocation module is used to respond to a preset allocation request instruction of any allocation object in the target application, perform memory allocation processing on any allocation object based on the preset memory allocation dimension, and obtain the memory space of any allocation object in the local heap system.

[0048] According to another aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the above-mentioned memory allocation analysis method.

[0049] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the above-mentioned memory allocation analysis method.

[0050] According to another aspect of an embodiment of the present disclosure, a computer program product including instructions is provided, which, when executed on a computer, enables the computer to execute the above-mentioned memory allocation analysis method.

[0051] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0052] In response to a memory allocation test instruction for a target application, when the stack recording function of the memory allocation of the target system has been turned on, the target application is turned on, so that stack recording during the operation of the target application can be realized. Then, during the operation of the target application, memory allocation processing is performed on multiple allocation objects in the target application based on a preset memory allocation dimension, and the preset allocation dimension is used to instruct the target system to perform memory allocation based on the native heap system of the target terminal, and memory allocation data of multiple target allocation objects corresponding to the target runtime are obtained, wherein the memory allocation data is the memory space data allocated by the target system for each target allocation object at the target runtime, and the memory space data corresponding to each target allocation object represents the memory space occupancy of the target storage data corresponding to each target allocation object in the native heap system, so that the memory allocation status of multiple target allocation objects at the target runtime during the operation of the target application can be accurately obtained. Then, the memory allocation data is allocated and analyzed to obtain the target allocation analysis result corresponding to the target runtime, so that the full amount of memory allocation can be captured, and the accuracy of the memory analysis result can be improved. The specific allocation stack can be displayed through the target allocation analysis result, and the readability of the memory analysis result can be improved.

[0053] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0055] Figure 1 is a schematic diagram of an application system according to an exemplary embodiment;

[0056] Figure 2 is a flow chart of a memory allocation analysis method according to an exemplary embodiment;

[0057] Figure 3 is a schematic diagram showing memory allocation data of multiple target allocation objects corresponding to a target runtime according to an exemplary embodiment;

[0058] Figure 4 is a schematic diagram showing a target allocation analysis result according to an exemplary embodiment;

[0059] Figure 5 is a block diagram of a memory allocation analysis device according to an exemplary embodiment;

[0060] Figure 6is a block diagram of an electronic device for generating a target allocation analysis result according to an exemplary embodiment;

[0061] Figure 7 It is a block diagram of another electronic device for generating target allocation analysis results according to an exemplary embodiment. DETAILED DESCRIPTION

[0062] Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0063] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0064] In addition, in order to better illustrate the present application, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present application can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present application.

[0065] See also Figure 1 , Figure 1 01 is a schematic diagram of an application system according to an exemplary embodiment. The application system can be used in the memory allocation analysis method of the present application. The application system can at least include a server 01 and a terminal 02.

[0066] In the embodiment of the present application, the server 01 can be used to generate a memory allocation test instruction. Specifically, the server 01 can 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, CDN, and big data and artificial intelligence platforms.

[0067] In the embodiment of the present application, the terminal 02 can be used to generate the target allocation analysis result. The terminal 02 may include physical devices such as smart phones, desktop computers, tablet computers, laptops, smart speakers, vehicle terminals, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, etc., and may also include software running in physical devices, such as applications. The operating system running on the terminal 02 in the embodiment of the present application may include but is not limited to Android system, GNU / Linux system, Windows system, etc.

[0068] In addition, it should be noted that Figure 1 What is shown is only one application environment provided by the present disclosure. In actual application, other application environments may also be included. For example, the generation process of the memory allocation test instruction for the target application may also be implemented on the terminal 02.

[0069] In the embodiments of this specification, the terminal 02 and the server 01 may be directly or indirectly connected via wired or wireless communication, which is not limited in this application.

[0070] It should be noted that the following figure shows a possible sequence of steps, which is not actually limited to strictly following this sequence. Some steps can be executed in parallel without relying on each other.

[0071] Specifically, Figure 2 FIG. 1 is a flowchart of a memory allocation analysis method according to an exemplary embodiment. Figure 2 As shown, the memory allocation analysis method can be used in electronic devices such as target terminals, and can specifically include the following steps:

[0072] S201: In response to a memory allocation test instruction for a target application, when a stack recording function of memory allocation of a target system is enabled, enable the target application.

[0073] In a specific embodiment, the target application may refer to an application that needs to be tested for memory allocation. The target application may run on a target system. The target system may refer to an operating system on a target terminal. Specifically, the target application may include a game application, a graphics processing application, or a video processing application.

[0074] In a specific embodiment, the memory allocation test instruction can be used to instruct the target terminal to test the memory allocation status during the operation of the target application. Specifically, the memory allocation test instruction can be triggered by the application tester performing a test start operation on the target terminal; or the memory allocation test instruction can also be triggered by the application tester performing a test start operation on the test terminal, and can be sent to the target terminal based on the test terminal.

[0075] In a specific embodiment, the memory allocation stack recording function can be used to record the memory allocation stack during the running process of the target application.

[0076] In a specific embodiment, the above step S201 may include:

[0077] In response to a memory allocation test instruction for a target application, updating preset engine configuration information in the target application so that the memory allocation dimension of the target application is updated to a preset allocation dimension;

[0078] Enable the stack logging function;

[0079] With the stack trace feature enabled, open the target application.

[0080] In a specific embodiment, the preset engine configuration information may refer to the engine configuration information of the preset engine. The preset engine configuration information may be used to indicate the memory allocation dimension of the target application. Among them, the preset engine may refer to the application development engine of the target application. Exemplarily, taking the game application scenario as an example, the preset engine may be a game development engine.

[0081] In a specific embodiment, the preset allocation dimension may be used to instruct the target system to perform memory allocation based on the native heap system of the target terminal. Specifically, the native heap system may refer to the Native Heap system in the target terminal.

[0082] In a specific embodiment, updating the preset engine configuration information in the target application so as to update the memory allocation dimension of the target application to the preset allocation dimension may include:

[0083] The first preset configuration information in the preset engine configuration information is updated to the second preset configuration information, so that the memory allocation dimension is updated to the preset allocation dimension.

[0084] In a specific embodiment, the first preset configuration information may be used to instruct the target system to perform memory allocation based on a box-type memory allocator.

[0085] Exemplarily, the first preset configuration information may be “#ifPLATFORM_ANDROID_ARM64

[0086] return new FMallocAnsi(); / *If the current platform is android64-bit, return an allocator capable of ansi memory allocation* /

[0087] #else

[0088] return new FMallocBinned(MemoryConstants.PageSize, MemoryLimit); / *Otherwise returns the allocator BaseAllocator that can perform FMallocBinned memory allocation* /

[0089] #endif".

[0090] In a specific embodiment, the second preset configuration information may be used to instruct the target system to perform memory allocation based on the native heap system of the target terminal. Exemplarily, the second preset configuration information may be "return newFMallocAnsi();".

[0091] In a specific embodiment, updating the first preset configuration information in the preset engine configuration information to the second preset configuration information can change the memory allocation method of the preset engine from FmallocBinned method to Ansi method allocation, and can enable the target system to allocate memory based on the native heap system of the target terminal.

[0092] In the above embodiment, by updating the first preset configuration information in the preset engine configuration information to the second preset configuration information, it can be avoided that part of the memory allocation stack cannot be traced back by the system, thereby facilitating the capture of full memory allocation.

[0093] In a specific embodiment, the above-mentioned enabling of the stack recording function may include:

[0094] Add the preset recording function tool library to the target operating system library corresponding to the target system;

[0095] Shut down multiple preset system services corresponding to the target system;

[0096] Activate stack logging;

[0097] Restart multiple preset system services corresponding to the target system to load the preset recording function tool library;

[0098] Accordingly, the above-mentioned acquisition of memory allocation data of multiple target allocation objects corresponding to the target runtime may include:

[0099] Based on the preset recording function tool library, memory allocation data of multiple target allocation objects corresponding to the target runtime are obtained.

[0100] In a specific embodiment, the preset recording function tool library may refer to a dynamic link library of libc_malloc_debug_leak.so.

[0101] In a specific embodiment, the target operating system library may refer to an operating system library of a target terminal.

[0102] In a specific embodiment, the multiple preset system services may refer to multiple system services included in the target system.

[0103] In a specific embodiment, super permissions can be enabled through a preset permission enable command (such as adb root command); multiple preset system services in the target system can be disabled through a preset service shutdown instruction (such as adb shell stop), so that a soft shutdown of the target system can be achieved without power failure.

[0104] In a specific embodiment, the memory allocation stack recording function may be activated by a preset function activation instruction (such as the instruction adb shell setproplibc.debug.malloc.options backtrace).

[0105] In a specific embodiment, multiple preset system services of the target terminal may be restarted through a preset service restart instruction (adb shell start), and a soft start after the configuration is modified may be implemented to load a preset recording function tool library.

[0106] In a specific embodiment, the target runtime may refer to a time when memory allocation analysis needs to be performed during the target application running process. The target runtime may include at least one runtime. Any runtime may refer to any time during the target running process.

[0107] In a specific embodiment, when the target application runs to the target running time, the memory allocation data of multiple target allocation objects can be obtained based on a preset recording function tool library.

[0108] In the above embodiment, in response to a memory allocation test instruction for a target application, the preset engine configuration information in the target application is updated so that the memory allocation dimension of the target application is updated to the preset allocation dimension, and the stack recording function is turned on. When the stack recording function is turned on, the target application is turned on to avoid the situation where some memory allocation stacks cannot be traced back by the system, so as to facilitate the capture of full memory allocation.

[0109] S203: During the running of the target application, memory allocation processing is performed on multiple allocation objects in the target application based on a preset memory allocation dimension.

[0110] In a specific embodiment, the multiple allocation objects may refer to objects that apply for memory space allocation for storing data required by the target application during its operation. Specifically, any allocation object may include a calling function.

[0111] In a specific embodiment, the above step S203 may include:

[0112] In response to a preset allocation request instruction of any allocation object in the target application, memory allocation processing is performed on any allocation object based on a preset memory allocation dimension to obtain a memory space of any allocation object in the native heap system.

[0113] In a specific embodiment, the preset allocation request instruction of any allocation object can be used to request the target system to allocate memory space for the storage data of any of the above allocation objects.

[0114] In a specific embodiment, during the running process of the target application, preset allocation request instructions for multiple allocation objects may be received; when a preset allocation request instruction for any allocation object in the target application is received, the target system may allocate corresponding memory space for any of the above allocation objects in the native heap system from a preset memory allocation dimension to store storage data corresponding to any of the above allocation objects.

[0115] In a specific embodiment, after the above step S201, the above method may further include:

[0116] In response to a first business operation instruction for a target application, a preset business operation is executed to perform memory allocation processing on a plurality of allocation objects based on a preset memory allocation dimension;

[0117] During the execution of the preset business operation, the instant memory data corresponding to multiple running times is obtained;

[0118] Determine a target running time from the multiple running times based on the time memory data corresponding to the multiple running times;

[0119] Accordingly, the above step S203 may include:

[0120] In response to the secondary business operation instruction for the target application, a preset business operation is executed to perform memory allocation processing on a plurality of allocation objects based on a preset memory allocation dimension.

[0121] In a specific embodiment, the first service operation instruction may be used to instruct the target terminal to perform a preset service operation. Specifically, the preset service operation may be set according to actual service needs, and the present disclosure does not limit this.

[0122] In a specific embodiment, the moment memory data corresponding to any running moment can represent the memory occupancy at any running moment.

[0123] In a specific embodiment, when the target application runs in sequence to each running time, a preset allocation acquisition instruction (such as the instruction adb shell am dumpheap -n <pid> / data / local / tmp / native_heap.txt) uses the DumpHeap tool to obtain memory allocation and obtain the memory data corresponding to multiple running times. Among them, pid can be the application thread identifier; specifically, the application thread identifier pid can be obtained through a preset identifier acquisition instruction (such as the instruction adb shellps); / data / local / tmp / native_heap.txt can refer to the storage path of the memory data corresponding to multiple running times. It can be understood that the memory data corresponding to the above multiple running times can be read based on the storage path of the memory data corresponding to the above multiple running times.

[0124] In a specific embodiment, memory allocation can be obtained through the DDMS tool to obtain the memory data corresponding to multiple running times.

[0125] In a specific embodiment, the target running time may be a running time whose corresponding time memory data among the time memory data corresponding to the multiple running times is greater than or equal to the preset memory data. Specifically, the preset memory data may be set according to actual application needs, and the present disclosure does not limit this.

[0126] In a specific embodiment, the running time corresponding to the largest time memory data among the time memory data corresponding to multiple running times may be used as the target running time.

[0127] In a specific embodiment, the same preset service operation may be performed on the target terminal so as to obtain the memory allocation data of multiple target allocation objects corresponding to the target running time during a non-first running process of the target application.

[0128] In the above embodiment, by responding to the first business operation instruction for the target application, executing the preset business operation, based on the preset memory allocation dimension, memory allocation processing is performed on multiple allocation objects; during the execution of the preset business operation, the moment memory data corresponding to the multiple running moments are obtained; based on the moment memory data corresponding to the multiple running moments, the target running moment is determined from the multiple running moments; and in response to the secondary business operation instruction for the target application, the preset business operation is executed to perform memory allocation processing on multiple allocation objects based on the preset memory allocation dimension. The acquisition of memory allocation data for the target running moment can be achieved, making the memory allocation analysis more targeted, avoiding the waste of system resources caused by allocation analysis at moments with smaller memory occupancy, and improving the efficiency of memory allocation analysis.

[0129] S205: Obtain memory allocation data of multiple target allocation objects corresponding to the target runtime.

[0130] In a specific embodiment, the multiple target allocation objects may refer to allocation objects for applying for allocation of memory space when the target application runs to the target runtime. The multiple target allocation objects may be allocation objects corresponding to the target runtime among the multiple allocation objects.

[0131] In a specific embodiment, the memory allocation data of multiple target allocation objects can be the memory space data allocated by the target system for each target allocation object at the target runtime. The memory space data corresponding to each target allocation object can represent the memory space occupation of the target storage data corresponding to each target allocation object in the local heap system.

[0132] In a specific embodiment, when the target application runs to the target running time, the memory allocation data of each of the plurality of target allocation objects may be obtained based on a preset recording function tool library.

[0133] In a specific embodiment, when the target application runs to the target runtime, memory allocation acquisition can be performed through a preset allocation acquisition instruction to obtain memory allocation data of multiple target allocation objects corresponding to the target runtime.

[0134] S207: Perform allocation analysis on the memory allocation data to obtain a target allocation analysis result corresponding to the target runtime.

[0135] In a specific embodiment, the memory allocation data of multiple target allocation objects may include call address sequences corresponding to each of the multiple target allocation objects and sequence allocation data corresponding to each of the multiple call address sequences. The call address sequence corresponding to any target allocation object may characterize the logical call relationship of any target allocation object. The call address sequence corresponding to any target allocation object may include multiple sequence element addresses. The sequence allocation data corresponding to any call address sequence may be the memory space data of the target allocation object corresponding to any of the above call address sequences. Exemplarily, the call address sequence may be "ca7e3886,ca6d4f74,c9492e44,c949398c,c94921a8,c94920e4,c94d9892".

[0136] In a specific embodiment, the target allocation analysis result may be used to indicate the hierarchical relationship between multiple target allocation objects and the memory space data corresponding to each target allocation object.

[0137] In a specific embodiment, the above step S207 may include:

[0138] Building a target tree structure based on the call address sequences corresponding to the multiple target allocation objects;

[0139] Generate a target allocation analysis result based on the target tree structure and the sequence allocation data corresponding to each of the multiple call address sequences.

[0140] In a specific embodiment, the target tree structure can be a tree structure with multiple target allocation objects as nodes and the hierarchical relationships between the multiple target allocation objects as edges. Specifically, the target tree structure can be constructed based on the hierarchical relationships between the call addresses corresponding to the multiple target allocation objects.

[0141] In a specific embodiment, a target tree structure can be constructed with the call addresses corresponding to the multiple target allocation objects in the above call address sequence as nodes and the hierarchical relationships between the call addresses corresponding to the multiple target allocation objects in the above call address sequence as edges.

[0142] In a specific embodiment, the above generation of the target allocation analysis result based on the target tree structure and the sequence allocation data corresponding to each of the multiple call address sequences can include:

[0143] Determine the memory occupancy ratio index data corresponding to each target allocation object based on the sequence allocation data corresponding to each of the multiple call address sequences;

[0144] Determine the target object identification information corresponding to each target allocation object based on a preset address mapping relationship;

[0145] Generate a target allocation analysis result based on the memory occupancy ratio index data corresponding to each target allocation object, the target object identification information corresponding to each target allocation object, and the target tree structure.

[0146] In a specific embodiment, the memory occupancy ratio index data corresponding to each target allocation object can represent the ratio of the target storage data corresponding to each target allocation object to the storage data corresponding to the multiple target allocation objects.

[0147] In a specific embodiment, the target memory data corresponding to the multiple target allocation objects can be obtained; based on the target memory data, a ratio analysis is performed on the sequence allocation data corresponding to each of the above target allocation objects, and the memory occupancy ratio index data corresponding to each target allocation object can be obtained. Specifically, the target memory data corresponding to the target running moment can be obtained based on a preset record function tool library; alternatively, the sequence allocation data corresponding to the multiple target allocation objects can be subjected to a superposition process to obtain the target memory data. The target memory data can refer to the memory space data allocated by the target system for the above multiple target allocation objects at the target running moment.

[0148] In a specific embodiment, the preset address mapping relationship can refer to the mapping relationship between the call addresses of multiple allocation objects and the object identification information.

[0149] In a specific embodiment, the above preset address mapping relationship may be obtained in the following manner:

[0150] Determine multiple call addresses based on call address sequences corresponding to the multiple target allocation objects;

[0151] Obtaining first object identification information corresponding to each calling address;

[0152] Decoding the first object identification information corresponding to each calling address to obtain the second object identification information corresponding to each calling address;

[0153] A preset address mapping relationship is constructed based on the multiple calling addresses and the second object identification information corresponding to each calling address.

[0154] In a specific embodiment, the above-mentioned multiple calling addresses may refer to calling addresses corresponding to multiple target allocation objects respectively.

[0155] In a specific embodiment, the call address sequences corresponding to the above-mentioned multiple target allocation objects are subjected to sequence splitting processing to obtain multiple call addresses corresponding to the above-mentioned multiple call address sequences; the multiple call addresses corresponding to the above-mentioned multiple call address sequences are subjected to deduplication processing to obtain the above-mentioned multiple call addresses.

[0156] In a specific embodiment, the first object identification information corresponding to each call address may refer to the low-level decoded object identification information corresponding to each call address. Specifically, a call address acquisition function (such as a dladdr function) may be used to acquire the first object identification information corresponding to each call address; specifically, the dladdr function may return a dl_info structure according to the call address, wherein the pointer dli_sname in the dl_info structure may point to the object identification information closest to the specified call address as the first object identification information.

[0157] In a specific embodiment, the second object identification information corresponding to each call address may refer to the user-level object identification information corresponding to each call address. Specifically, when any target allocation object is a call function, the second object identification information corresponding to any of the target allocation objects may be the user-level call function name corresponding to any of the target allocation objects.

[0158] In a specific embodiment, the second object identification information corresponding to each calling address may be obtained by performing unsentence processing on the first object identification information corresponding to each calling address.

[0159] In a specific embodiment, a preset address mapping relationship may be constructed based on the correspondence between each calling address and its corresponding second object identification information.

[0160] In the above embodiment, based on the call address sequences corresponding to each of the multiple target allocation objects, multiple call addresses are determined, the first object identification information corresponding to each call address is obtained, the first object identification information corresponding to each call address is decoded, and the second object identification information corresponding to each call address is obtained. Based on the multiple call addresses and the second object identification information corresponding to each call address, a preset address mapping relationship is constructed, which can facilitate the symbolic processing of the call address, and further, based on the above preset address mapping relationship, the readability of the target allocation analysis results can be improved.

[0161] In a specific embodiment, the target object identification information may refer to object identification information corresponding to any target allocation object.

[0162] In a specific embodiment, the object identification information corresponding to any target allocation object may be searched based on a preset address mapping relationship, and the object identification information may be used as the target object identification information corresponding to any of the above target allocation objects.

[0163] In a specific embodiment, the memory share index data corresponding to each target allocation object, the sequence allocation data corresponding to each target allocation object, and the target object identification information corresponding to each target allocation object can be added to the node corresponding to each target allocation object in the target tree structure as the node additional information in the node corresponding to each target allocation object, and the added target tree structure can be obtained; accordingly, the above-mentioned added target tree structure can be used as the target allocation analysis result. Specifically, multiple nodes belonging to the same call address in the added target tree structure can be merged to obtain a merged target tree structure; accordingly, the above-mentioned merged target tree structure can be used as the target allocation analysis result. Further, in the process of node merging, multiple memory share index data corresponding to the same call address can be superimposed to obtain cumulative share index data, and multiple sequence allocation data corresponding to the same call address can be superimposed to obtain cumulative allocation data, and based on the number of nodes corresponding to each call address, the cumulative number of calls can be obtained; accordingly, the corresponding additional information of the merged node can be updated based on the corresponding cumulative share index data, cumulative allocation data and cumulative number of calls.

[0164] In the above embodiment, a target tree structure is constructed based on the call address sequences corresponding to each of the multiple target allocation objects, and a target allocation analysis result is generated based on the target tree structure and the sequence allocation data corresponding to each of the multiple call address sequences. The target allocation analysis result can be displayed in combination with the hierarchical relationship of the target tree structure, thereby further improving the readability of the target allocation analysis result.

[0165] In a specific embodiment, the target allocation analysis results may be serialized and compressed to obtain a target recording file and stored in a memory; correspondingly, the application tester may view the memory allocation analysis results of the target application at the target runtime by reading the target recording file.

[0166] In the above embodiment, in response to a memory allocation test instruction for a target application, when the stack recording function of the memory allocation of the target system has been turned on, the target application is turned on, so that stack recording during the operation of the target application can be realized. Then, during the operation of the target application, memory allocation processing is performed on multiple allocation objects in the target application based on a preset memory allocation dimension, and the preset allocation dimension is used to instruct the target system to perform memory allocation based on the native heap system of the target terminal, and memory allocation data of multiple target allocation objects corresponding to the target runtime are obtained, wherein the memory allocation data is the memory space data allocated by the target system to each target allocation object at the target runtime, and the memory space data corresponding to each target allocation object represents the memory space occupancy of the target storage data corresponding to each target allocation object in the native heap system, so that the memory allocation status of multiple target allocation objects at the target runtime during the operation of the target application can be accurately obtained. Then, the memory allocation data is allocated and analyzed to obtain the target allocation analysis result corresponding to the target runtime, so that the full amount of memory allocation can be captured, and the accuracy of the memory analysis result can be improved. The specific allocation stack can be displayed through the target allocation analysis result, and the readability of the memory analysis result can be improved.

[0167] Figure 3 is a schematic diagram showing memory allocation data of multiple target allocation objects corresponding to a target runtime according to an exemplary embodiment. Figure 4 is a schematic diagram of a target allocation analysis result according to an exemplary embodiment. Specifically, in response to a memory allocation test instruction for a target application, the target application can be started when the stack recording function of the memory allocation of the target system is turned on; during the operation of the target application, memory allocation processing can be performed on multiple allocation objects in the target application based on a preset memory allocation dimension; accordingly, memory allocation data of multiple target allocation objects corresponding to the target runtime can be obtained, and the specific memory allocation data can be as follows: Figure 3 As shown; perform allocation analysis on the memory allocation data to obtain the target allocation analysis result corresponding to the target runtime. The specific target allocation analysis result can be shown as Figure 4 shown.

[0168] Figure 5 FIG. 1 is a block diagram of a memory allocation analysis device according to an exemplary embodiment. Figure 5 As shown, the device may include:

[0169] The first execution module 510 may be used to respond to a memory allocation test instruction for a target application, and to start the target application when a stack recording function of memory allocation of the target system is already started; the target application runs on the target system;

[0170] The allocation processing module 520 may be used to perform memory allocation processing on multiple allocation objects in the target application based on a preset memory allocation dimension during the operation of the target application, wherein the preset allocation dimension is used to instruct the target system to perform memory allocation based on the local heap system of the target terminal;

[0171] The allocation data acquisition module 530 can be used to obtain memory allocation data of multiple target allocation objects corresponding to the target runtime; the memory allocation data is the memory space data allocated by the target system for each target allocation object at the target runtime; the memory space data corresponding to each target allocation object represents the memory space occupation of the target storage data corresponding to each target allocation object in the local heap system;

[0172] The allocation analysis module 540 may be used to perform allocation analysis on the memory allocation data to obtain a target allocation analysis result corresponding to the target runtime.

[0173] In a specific embodiment, the first execution module 510 may include:

[0174] A first configuration update module may be used to update preset engine configuration information in the target application in response to a memory allocation test instruction for the target application, so that the memory allocation dimension of the target application is updated to a preset allocation dimension;

[0175] The second execution module can be used to enable the stack recording function;

[0176] The third execution module may be used to start the target application when the stack recording function is started.

[0177] In a specific embodiment, the configuration update module may include:

[0178] The second configuration update module can be used to update the first preset configuration information in the preset engine configuration information to the second preset configuration information, so that the memory allocation dimension is updated to the preset allocation dimension; the first preset configuration information is used to instruct the target system to perform memory allocation based on the box-type memory allocator.

[0179] In a specific embodiment, the second execution module may include:

[0180] A tool library acquisition module can be used to add a preset recording function tool library to a target operating system library corresponding to a target system;

[0181] The service shutdown module can be used to shut down multiple preset system services corresponding to the target system;

[0182] Function activation module, which can be used to activate the stack recording function;

[0183] The service restart module can be used to restart multiple preset system services corresponding to the target system to load the preset recording function tool library;

[0184] Accordingly, the allocation data acquisition module 530 may include:

[0185] The target data acquisition module can be used to acquire the memory allocation data of multiple target allocation objects corresponding to the target running time based on the preset recording function tool library.

[0186] In a specific embodiment, the allocation analysis module 540 may include:

[0187] A tree structure building module can be used to build a target tree structure based on the call address sequences corresponding to the multiple target allocation objects, wherein the target tree structure is a tree structure with the multiple target allocation objects as nodes and the hierarchical relationships between the multiple target allocation objects as edges;

[0188] The first result generating module may be used to generate a target allocation analysis result based on the target tree structure and the sequence allocation data corresponding to each of the plurality of call address sequences.

[0189] In a specific embodiment, the first result generating module may include:

[0190] The proportion data acquisition module can be used to determine the memory proportion index data corresponding to each target allocation object based on the sequence allocation data corresponding to each of the multiple call address sequences; the memory proportion index data corresponding to each target allocation object represents the proportion of the target storage data corresponding to each target allocation object relative to the storage data corresponding to the multiple target allocation objects;

[0191] The target identification acquisition module can be used to determine the target object identification information corresponding to each target allocation object based on a preset address mapping relationship;

[0192] The second result generation module can be used to generate a target allocation analysis result based on the memory usage indicator data corresponding to each target allocation object, the target object identification information corresponding to each target allocation object, and the target tree structure.

[0193] In a specific embodiment, the above device may further include:

[0194] A calling address acquisition module can be used to determine multiple calling addresses based on the calling address sequences corresponding to the multiple target allocation objects;

[0195] A first identification acquisition module can be used to obtain first object identification information corresponding to each calling address;

[0196] The second identification acquisition module can be used to decode the first object identification information corresponding to each calling address to obtain the second object identification information corresponding to each calling address;

[0197] The mapping relationship building module can be used to build a preset address mapping relationship based on multiple calling addresses and the second object identification information corresponding to each calling address.

[0198] In a specific embodiment, the above device may further include:

[0199] A fourth execution module may be used to execute a preset business operation in response to a first business operation instruction for a target application, so as to perform memory allocation processing on a plurality of allocation objects based on a preset memory allocation dimension;

[0200] The moment memory acquisition module can be used to obtain the moment memory data corresponding to multiple running moments during the execution of the preset business operation; the moment memory data corresponding to any running moment represents the memory occupancy at any running moment;

[0201] The target time acquisition module can be used to determine the target running time from multiple running times based on the time memory data corresponding to the multiple running times;

[0202] Accordingly, the allocation processing module 520 may include:

[0203] The fifth execution module may be configured to execute a preset business operation in response to a secondary business operation instruction for a target application, so as to perform memory allocation processing on a plurality of allocation objects based on a preset memory allocation dimension.

[0204] In a specific embodiment, the allocation processing module 520 may include:

[0205] The memory allocation module can be used to respond to a preset allocation request instruction of any allocation object in the target application, perform memory allocation processing on any allocation object based on a preset memory allocation dimension, and obtain the memory space of any allocation object in the local heap system.

[0206] Regarding the device in the above embodiment, the specific manner in which each module and unit performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0207] Figure 6 is a block diagram of an electronic device for generating target allocation analysis results according to an exemplary embodiment. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The electronic device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a memory allocation analysis method is implemented.

[0208] Figure 7 is a block diagram of another electronic device for generating target allocation analysis results according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a memory allocation analysis method is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0209] Those skilled in the art will understand that Figure 6 or Figure 7 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0210] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the memory allocation analysis method as in the embodiment of the present disclosure.

[0211] In an exemplary embodiment, a computer-readable storage medium is also provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the memory allocation analysis method in the embodiment of the present disclosure.

[0212] In an exemplary embodiment, a computer program product including instructions is also provided. When the computer program product is run on a computer, the computer is enabled to execute the memory allocation analysis method in the embodiment of the present disclosure.

[0213] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0214] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0215] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0216] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0217] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.< / pid>

Claims

1. A memory allocation analysis method, It is characterized in that The method comprises: In response to a memory allocation test instruction for a target application, the target application is started when a stack recording function of memory allocation of a target system is started; the target application runs on the target system; During the operation of the target application, memory allocation processing is performed on a plurality of allocation objects in the target application based on a preset memory allocation dimension, wherein the preset allocation dimension is used to instruct the target system to perform memory allocation based on a local heap system of the target terminal; Obtain memory allocation data of multiple target allocation objects corresponding to the target runtime; the memory allocation data is memory space data allocated by the target system to each target allocation object at the target runtime; the memory space data corresponding to each target allocation object represents the memory space occupation of the target storage data corresponding to each target allocation object in the local heap system; Performing allocation analysis on the memory allocation data to obtain a target allocation analysis result corresponding to the target runtime.

2. The method according to claim 1, It is characterized in that In response to the memory allocation test instruction for the target application, when the stack recording function of the memory allocation of the target system is already turned on, starting the target application includes: In response to a memory allocation test instruction for the target application, updating preset engine configuration information in the target application so that the memory allocation dimension of the target application is updated to the preset allocation dimension; Enable the stack recording function; When the stack recording function is enabled, the target application is enabled.

3. The method according to claim 2, It is characterized in that The updating of the preset engine configuration information in the target application so that the memory allocation dimension of the target application is updated to the preset allocation dimension includes: The first preset configuration information in the preset engine configuration information is updated to the second preset configuration information, so that the memory allocation dimension is updated to the preset allocation dimension; the first preset configuration information is used to instruct the target system to perform memory allocation based on a box-type memory allocator.

4. The method according to claim 2, It is characterized in that The enabling of the stack recording function includes: Adding a preset recording function tool library to a target operating system library corresponding to the target system; Shut down multiple preset system services corresponding to the target system; activating the stack recording function; Restarting the plurality of preset system services corresponding to the target system to load the preset recording function tool library; The step of obtaining memory allocation data of a plurality of target allocation objects corresponding to the target runtime includes: Based on the preset recording function tool library, memory allocation data of the multiple target allocation objects corresponding to the target running time are obtained.

5. The method according to claim 1, It is characterized in that The memory allocation data of the multiple target allocation objects include call address sequences corresponding to the multiple target allocation objects and sequence allocation data corresponding to the multiple call address sequences, the call address sequence corresponding to any target allocation object represents the logical call relationship of any target allocation object, and the target allocation analysis result is used to indicate the hierarchical relationship between the multiple target allocation objects and the memory space data corresponding to each target allocation object; The performing allocation analysis on the memory allocation data to obtain a target allocation analysis result corresponding to the target runtime includes: Based on the call address sequences corresponding to the multiple target allocation objects, respectively, a target tree structure is constructed, wherein the target tree structure is a tree structure with the multiple target allocation objects as nodes and the hierarchical relationships between the multiple target allocation objects as edges; The target allocation analysis result is generated based on the target tree structure and the sequence allocation data corresponding to each of the plurality of call address sequences.

6. The method according to claim 5, It is characterized in that The generating the target allocation analysis result based on the target tree structure and the sequence allocation data corresponding to each of the plurality of call address sequences comprises: Based on the sequence allocation data corresponding to each of the multiple call address sequences, memory proportion index data corresponding to each target allocation object is determined; the memory proportion index data corresponding to each target allocation object represents the proportion of the target storage data corresponding to each target allocation object relative to the storage data corresponding to the multiple target allocation objects; Based on the preset address mapping relationship, determine the target object identification information corresponding to each target allocation object; The target allocation analysis result is generated based on the memory usage indicator data corresponding to each target allocation object, the target object identification information corresponding to each target allocation object, and the target tree structure.

7. The method according to claim 6, It is characterized in that The preset address mapping relationship includes obtaining in the following manner: Determining a plurality of call addresses based on the call address sequences corresponding to the plurality of target allocation objects; Obtaining first object identification information corresponding to each calling address; Decoding the first object identification information corresponding to each calling address to obtain the second object identification information corresponding to each calling address; The preset address mapping relationship is constructed based on the multiple calling addresses and the second object identification information corresponding to each calling address.

8. The method according to claim 1, It is characterized in that In response to the memory allocation test instruction for the target application, when the stack recording function of the memory allocation of the target system is enabled, after enabling the target application, the method further includes: In response to a first business operation instruction for the target application, executing a preset business operation to perform memory allocation processing on the multiple allocation objects based on the preset memory allocation dimension; During the execution of the preset business operation, the memory data corresponding to multiple running moments are obtained; the memory data corresponding to any running moment represents the memory occupancy at any running moment; Determining the target running time from the multiple running times based on the time memory data corresponding to the multiple running times; During the running process of the target application, based on the preset memory allocation dimension, memory allocation processing is performed on multiple allocation objects in the target application, including: In response to the secondary business operation instruction for the target application, the preset business operation is executed to perform memory allocation processing on the multiple allocation objects based on the preset memory allocation dimension.

9. The method according to any one of claims 1 to 8, It is characterized in that During the running process of the target application, based on the preset memory allocation dimension, memory allocation processing is performed on multiple allocation objects in the target application, including: In response to a preset allocation request instruction of any allocation object in the target application, memory allocation processing is performed on any allocation object based on the preset memory allocation dimension to obtain the memory space of any allocation object in the native heap system.

10. A memory allocation analysis device, It is characterized in that The device comprises: A first execution module is used for, in response to a memory allocation test instruction for a target application, starting the target application when a stack recording function of memory allocation of a target system is already started; the target application runs on the target system; an allocation processing module, used for performing memory allocation processing on a plurality of allocation objects in the target application based on a preset memory allocation dimension during the operation of the target application, wherein the preset allocation dimension is used to instruct the target system to perform memory allocation based on a local heap system of the target terminal; An allocation data acquisition module is used to acquire memory allocation data of multiple target allocation objects corresponding to the target runtime; the memory allocation data is memory space data allocated by the target system to each target allocation object at the target runtime; the memory space data corresponding to each target allocation object represents the memory space occupation of the target storage data corresponding to each target allocation object in the local heap system; The allocation analysis module is used to perform allocation analysis on the memory allocation data to obtain a target allocation analysis result corresponding to the target runtime.

11. An electronic device, It is characterized in that include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to execute the executable instructions to implement the memory allocation analysis method described in any one of claims 1 to 9.

12. A non-volatile computer-readable storage medium having computer program instructions stored thereon, It is characterized in that When the computer program instructions are executed by a processor, the memory allocation analysis method described in any one of claims 1 to 9 is implemented.

13. A computer program product comprising computer instructions, It is characterized in that When the computer instructions are executed by a processor, the memory allocation analysis method described in any one of claims 1 to 9 is implemented.