Data processing method and device, electronic equipment, storage medium and program product

By allocating the target memory space for the memory space in the shared memory pool of asynchronous services, the problem of memory cannot be shared between asynchronous services is solved, and efficient utilization of memory space is achieved, and memory waste and resource conservation are avoided.

CN119025294APending Publication Date: 2024-11-26TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310601140.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-25
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

In the prior art, memory cannot be shared between asynchronous services, resulting in low memory space utilization and huge memory waste.

Method used

By sharing the memory space in the memory pool for multiple types of asynchronous services, the target memory space is allocated to store the data of asynchronous services, and the effective utilization of the memory space is achieved.

Benefits of technology

Make full use of memory space, avoid memory waste, improve memory space utilization, and save storage resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025294A_ABST
    Figure CN119025294A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method and device, electronic equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: for any asynchronous service in multiple types of asynchronous services, executing the following processing: in response to an object creation request of the asynchronous service, creating an asynchronous service object, the asynchronous service object comprising object data; a memory pool shared by the multiple types of asynchronous services is obtained, the memory pool comprises at least one memory space, and any memory space is used for storing object data corresponding to any type of asynchronous services; distributing a target memory space for the object data in at least one memory space in the memory pool; and storing the object data in the target memory space. According to the method and the device, the memory space in the memory pool is shared among different types of asynchronous services, and the memory space is fully and effectively utilized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to data processing technology, and in particular to a data processing method, device, electronic device, computer-readable storage medium and computer program product. Background Art

[0002] The backend architecture of the application is a distributed server cluster consisting of servers with various functions. The operation of the application is realized by different types of asynchronous services. Taking the mobile game application as an example, most of the game services outside the game, such as login, matching, payment, social networking, ranking title settlement and other asynchronous services, need to access multiple servers in the game backend to complete the entire asynchronous business process.

[0003] During the running of the application, it is necessary to allocate memory space for the data generated by the asynchronous business running, and store the data in the allocated memory space.

[0004] Related technology utilizes the inheritance characteristics of object-oriented technology to derive object data of different types of asynchronous services from the same base class, and sets a total upper limit of shared memory for each type of asynchronous service. Only corresponding shared memory can be allocated for each type of asynchronous service. This solution leads to waste of some shared memory. Summary of the invention

[0005] The embodiments of the present application provide a data processing method, device, electronic device, computer-readable storage medium and computer program product, which can realize sharing of memory space in a memory pool between different types of asynchronous services, fully and effectively utilize memory space, and save storage resources.

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

[0007] The present application provides a data processing method, including:

[0008] The following processing is performed for any of the asynchronous services of multiple types:

[0009] In response to the object creation request of the asynchronous service, creating an asynchronous service object, wherein the asynchronous service object includes object data;

[0010] Acquire a memory pool shared by the multiple types of asynchronous services, wherein the memory pool includes at least one memory space, and any of the memory spaces is used to store object data corresponding to any type of the asynchronous services;

[0011] Allocating a target memory space for the object data in at least one memory space in the memory pool;

[0012] The object data is stored in the target memory space.

[0013] The present application provides a data processing device, including:

[0014] A module is created, which is used to perform the following processing for any of the asynchronous services of multiple types:

[0015] In response to the object creation request of the asynchronous service, creating an asynchronous service object, wherein the asynchronous service object includes object data;

[0016] An allocation module, configured to obtain a memory pool shared by the multiple types of asynchronous services, wherein the memory pool includes at least one memory space, and any of the memory spaces is used to store object data corresponding to any type of the asynchronous services;

[0017] Allocating a target memory space for the object data in at least one memory space in the memory pool;

[0018] A storage module is used to store the object data in the target memory space.

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

[0020] Memory for storing computer programs or computer executable instructions;

[0021] The processor is used to implement the data processing method provided in the embodiment of the present application when executing the computer program or 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, which, when executed by a processor, can implement the data processing method provided in the embodiment of the present application.

[0023] An embodiment of the present application provides a computer program product, including a computer program or computer executable instructions, which, when executed by a processor, implements the data processing method provided in the embodiment of the present application.

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

[0025] By allocating a target memory space for storing object data of any type of asynchronous business object from the memory space shared by multiple types of asynchronous services, the memory space in the memory pool is shared by different types of asynchronous services. Compared with the solution of allocating corresponding shared memory to each type of asynchronous business in the related art, the embodiment of the present application can fully and effectively utilize the memory space, avoid memory waste, improve the utilization rate of the memory space, and save storage resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 is a schematic diagram of basic data and object data provided by an embodiment of the present application;

[0027] Figure 2 It is a schematic diagram of the architecture of the data processing system provided in the embodiment of the present application;

[0028] Figure 3 is a schematic diagram of the structure of an electronic device for data processing provided in an embodiment of the present application;

[0029] Figure 4A-4E It is a flowchart of a data processing method provided in an embodiment of the present application;

[0030] Figure 5A This is a product diagram of the mobile game login service provided in the embodiment of the present application;

[0031] Figure 5B This is a product diagram of a matching game service provided in an embodiment of the present application;

[0032] Figure 5C It is a product diagram of the skin purchase service provided in the embodiment of the present application;

[0033] Figure 6 It is a schematic diagram of the execution flow of the asynchronous service provided in the embodiment of the present application;

[0034] Figure 7 It is a unified modeling language diagram of the data structure of the memory pool of object data of the asynchronous service provided in the embodiment of the present application;

[0035] Figure 8 This is a schematic diagram of the memory structure after the memory pool of object data of the asynchronous service provided in the embodiment of the present application is initialized;

[0036] Fig. 9 This is a schematic diagram of the memory structure of the memory pool of the object data of the asynchronous service provided in the embodiment of the present application when it is running;

[0037] Fig.10 It is a schematic diagram of the algorithm flow of memory allocation of object data of an asynchronous service provided in an embodiment of the present application;

[0038] Fig.11is a schematic diagram of allocation from a free list of a preferred allocator provided in an embodiment of the present application;

[0039] Fig.12 is a schematic diagram of allocation from a public free area provided in an embodiment of the present application;

[0040] Fig.13 is a schematic diagram of allocation from a free list of a next hierarchical allocator provided in an embodiment of the present application;

[0041] Fig.14 It is a schematic diagram of an algorithm flow for releasing memory of object data of an asynchronous service provided in an embodiment of the present application;

[0042] Fig.15 It is a schematic diagram of releasing object data memory to a common free area provided by an embodiment of the present application;

[0043] Fig.16 It is a schematic diagram of releasing object data memory to a free list of a corresponding hierarchical allocator provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] 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.

[0045] In the following description, the terms "first\second" 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" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0046] 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.

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

[0048] 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.

[0049] 1) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed may be in real time or have a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed may be executed.

[0050] 2) Asynchronous business: In the distributed architecture of the application background, many businesses (such as login, matching, payment, social networking, etc.) are not completed independently by a single server (one server corresponds to one type of business), and often require multiple servers to communicate and interact to complete the entire business process. In the process of executing the business, unlike the synchronous mode of getting the processing results of the business immediately, an asynchronous mode (a mode of waiting for other servers to reply to the message of the business operation results) is required to determine whether to continue the entire business process. This kind of business that needs to wait for other servers to reply to the business operation results in an asynchronous mode to complete is an asynchronous business.

[0051] 3) Asynchronous business framework: The basic module in the background code that supports asynchronous business development. Its main functions are to be responsible for resource creation and resource recovery of asynchronous business objects, driving asynchronous business processes, and timeout checking of asynchronous businesses.

[0052] 4) Basic data: refers to the common data that each asynchronous business object (also known as asynchronous business instance) needs to use during the operation process and is independent of the type of specific asynchronous business, such as the start time of the asynchronous business object, the current execution step, the timeout time, and the need to use a custom data size.

[0053] 5) Object data: also known as asynchronous business context object. In the asynchronous business execution process, in addition to maintaining the basic data of the asynchronous business execution process, the asynchronous business customized data is also needed in multiple steps. These customized data are object data. These customized data are often cached in the memory of the asynchronous business process. The handle or pointer of this data memory can be obtained in multiple steps to read or update the data.

[0054] 6) Handle: An identifier used to identify an object (including modules, application instances, windows, controls, bitmaps, resources, files, etc.) or an item. In programming, a handle is not a specific, fixed data type or entity, but a special smart pointer, which refers to a method of obtaining another object. Its specific form may be an integer, an object, or a real pointer, and its purpose is to establish a unique connection with the object being accessed. When an application wants to reference a memory block or object managed by other systems (such as databases and operating systems), it must use a handle.

[0055] 7) Object-oriented: In object-oriented design, the type that is defined as containing the common features of all objects is called the base class. In the process of building a new class, the newly established class is called a derived class, and the inherited class containing the same features is called the base class. The derived class inherits all members of the base class and can add data members and member functions that the base class does not have to meet the needs of describing new objects.

[0056] It should be noted that the embodiments of the present application can be applied to various applications, such as shopping applications, game applications, etc.

[0057] The following uses a game application as an example to explain basic data and object data. Figure 1 As shown in the figure, the basic data of asynchronous business objects are executed, such as unique identifier (ID), type (Type), creation time (StartTime), execution steps (Step), etc.; the object data of login business (AsyncLogin), such as player identifier (PlayId), login state (LoginState), etc.; the object data of team business (AsyncTeam), such as team identifier (TeamId), captain identifier (CaptainId), member list (MemberList), etc.; the object data of payment business (AsyncPay), such as order identifier (OrderId), payment amount (Amount), associated player identifier (PlayId), purchase product identifier (ProductId), purchase product quantity (ProductNum), order state (OrderState), etc. It can be seen that the size of object data required by different asynchronous businesses may be different, but the size of basic data is the same.

[0058] In the related art, the object data of different types of asynchronous services are derived from the same base class by utilizing the object-oriented inheritance feature. The base class stores and maintains the basic data of the asynchronous service execution process, and the derived class representing a certain asynchronous service stores and maintains the object data of the asynchronous service of this type. The basic data and object data of the asynchronous service are combined in the memory of a derived class instance and are inseparable. Different types of asynchronous service objects are created according to the asynchronous service type through the factory method. Asynchronous service objects stored in shared memory need to have an upper limit set in advance to calculate the total amount of shared memory space occupied by this type of asynchronous service objects.

[0059] Therefore, the memory of different types of asynchronous services cannot be shared, and an upper limit on the total number needs to be set for each asynchronous service type, which limits the utilization of memory space and causes huge memory waste.

[0060] In order to solve the above problems, the embodiments of the present application provide a data processing method, device, electronic device, computer-readable storage medium and computer program product, which can realize sharing of memory space in a memory pool between different types of asynchronous services, fully and effectively utilize memory space, and save storage resources.

[0061] The data processing method provided in the embodiment of the present application can be implemented by the terminal alone; it can also be implemented by the terminal and the server in collaboration. For example, the terminal alone undertakes the data processing method described below, or the terminal sends an object creation request for an asynchronous service to the server, and the server allocates a target memory space for the object data of the asynchronous service object based on the received object creation request for the asynchronous service, and stores the object data in the target memory space.

[0062] The following describes an exemplary application of the electronic device provided by the embodiment of the present application. The electronic device provided by the embodiment 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 (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices, vehicle-mounted devices), smart phones, smart speakers, smart watches, smart TVs, and vehicle-mounted terminals. The following describes an exemplary application when the electronic device is implemented as a terminal.

[0063] See also Figure 2 , Figure 2 It is a schematic diagram of the architecture of the data processing system 10 provided in an embodiment of the present application, wherein the terminal 200 is connected to the server 100 via a network 300, wherein the network 300 may be a wide area network or a local area network, or a combination of the two.

[0064] In some embodiments, taking the electronic device as a terminal as an example, the data processing method provided in the embodiment of the present application can be implemented by the terminal. For example, the terminal 200 creates an asynchronous business object in response to an object creation request of an asynchronous business, wherein the asynchronous business object includes object data, obtains a memory pool shared by multiple types of asynchronous businesses, wherein the memory pool includes at least one memory space, and any memory space is used to store object data corresponding to any type of asynchronous business, and in at least one memory space in the memory pool, a target memory space is allocated for the object data, and the object data is stored in the target memory space.

[0065] Taking the asynchronous service as a game login service as an example, when the player logs in to the game application in the terminal 200, the terminal 200 automatically obtains the object creation request of the asynchronous service (including the player identification), responds to the object creation request of the asynchronous service, creates an asynchronous service object (i.e., a player login instance), obtains a memory pool shared by multiple types of asynchronous services, allocates a target memory space for the object data in at least one memory space in the memory pool, and stores the object data in the target memory space.

[0066] In some embodiments, the data processing method provided in the embodiments of the present application can also be implemented by the server and the terminal in collaboration. For example, the terminal 200 obtains an object creation request for an asynchronous service, and sends an object creation request for the asynchronous service to the server 100. The server 100 creates an asynchronous service object according to the received object creation request for the asynchronous service, wherein the asynchronous service object includes object data, obtains a memory pool shared by multiple types of asynchronous services, wherein the memory pool includes at least one memory space, and any memory space is used to store object data corresponding to any type of asynchronous service, allocates a target memory space for the object data in at least one memory space in the memory pool, stores the object data in the target memory space, and returns the object data to the terminal 200 to run the asynchronous service.

[0067] Taking the asynchronous business as the ranking title settlement business as an example, when the player logs in to the game application in the terminal 200, the terminal 200 automatically obtains the object creation request of the asynchronous business (including the player identification), and sends the object creation request of the asynchronous business to the server 100. The server 100 responds to the object creation request of the asynchronous business, creates an asynchronous business object (that is, a player ranking title settlement instance), obtains a memory pool shared by multiple types of asynchronous businesses, allocates a target memory space for the object data in at least one memory space in the memory pool, stores the object data in the target memory space, and returns the object data to the terminal 200 to run the ranking title settlement business.

[0068] In some embodiments, the terminal or server can implement the data processing method 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 (APP, Application), that is, a program that needs to be installed in the operating system to run, such as a live broadcast application or an instant messaging application; it can also be a small program embedded in any APP, that is, a program that can be run only by downloading it to a browser environment. 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.

[0069] In some embodiments, server 100 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, content delivery networks (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms. Among them, cloud services can be data processing services for terminals to call.

[0070] In some embodiments, multiple servers may form a blockchain, and server 100 is a node on the blockchain. Information connections may exist between each node in the blockchain, and information may be transmitted between nodes through the above information connections. Among them, data related to the data processing method provided in the embodiment of the present application (such as data processing logic, target memory space) may be stored on the blockchain.

[0071] The structure of the electronic device for data processing provided by the embodiment of the present application is described below. Figure 3 , Figure 3 1 is a schematic diagram of the structure of an electronic device 500 for data processing provided in an embodiment of the present application. Taking the electronic device 500 as a terminal as an example, Figure 3 The electronic device 500 for data processing shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 3 Various buses are labeled as bus system 540 .

[0072] The processor 510 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.

[0073] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiment of the present application is intended to include any suitable type of memory. The memory 550 optionally includes one or more storage devices that are physically far away from the processor 510.

[0074] In some embodiments, the memory 550 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.

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

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

[0077] In some embodiments, the data processing device provided in the embodiments of the present application can be implemented in software. The data processing device provided in the embodiments of the present application can be provided as various software embodiments, including various forms including applications, software, software modules, scripts or codes.

[0078] Figure 3 A data processing device 555 stored in a memory 550 is shown, which may be software in the form of a program or plug-in, and includes a series of modules, including a creation module 5551, an allocation module 5552, and a storage module 5553. These modules are logical, and therefore may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.

[0079] As mentioned above, the data processing method provided in the embodiment of the present application can be implemented by various types of electronic devices, such as a terminal, a server, or a combination of the two. Therefore, the execution subject of each step will not be repeatedly described below. Figure 4A , Figure 4A is a flow chart of the data processing method provided in the embodiment of the present application, combined with Figure 4A The steps shown are explained.

[0080] The following processing is performed for any asynchronous service among multiple types of asynchronous services:

[0081] In step 101, in response to an object creation request of an asynchronous service, an asynchronous service object is created, wherein the asynchronous service object includes object data.

[0082] Taking the asynchronous service as the login service as an example, when the player logs in to the game application in the terminal, the terminal automatically obtains the object creation request of the asynchronous service (including the player ID), responds to the object creation request of the asynchronous service, and creates an asynchronous service object (that is, an instance of the player login).

[0083] It should be noted that the asynchronous business object includes object data and basic data. Since the size of the object data of different types of asynchronous business may be different, a memory pool (i.e., the memory pool shared by the object data) can be allocated for the object data, and the memory size of the memory space (also known as the memory block) in the memory pool (i.e., the memory pool shared by the object data) can be different; since the size of the basic data of different types of asynchronous business is the same, another memory pool (i.e., the memory pool shared by the basic data) can be allocated for the basic data, and the memory size of the memory space (also known as the memory block) in the other memory pool is the same. Of course, the basic data can be merged with the object data to obtain the merged data of the asynchronous business object, and a memory pool (i.e., the memory pool shared by the merged data) can be allocated for the merged data, and the memory size of the memory space (also known as the memory block) in the memory pool (i.e., the memory pool shared by the merged data) can be different.

[0084] In step 102, a memory pool shared by multiple types of asynchronous services is obtained, wherein the memory pool includes at least one memory space, and any memory space is used to store object data corresponding to any type of asynchronous service.

[0085] The memory pool shared by various types of asynchronous services is a memory pool shared by object data.

[0086] In step 103, a target memory space is allocated for the object data in at least one memory space in the memory pool.

[0087] By allocating a target memory space for storing object data of any type of asynchronous business object from the memory space shared by multiple types of asynchronous services, the memory space in the memory pool is shared by different types of asynchronous services. Compared with the solution of allocating corresponding shared memory to each type of asynchronous business in the related art, the embodiment of the present application can fully and effectively utilize the memory space, avoid memory waste, improve the utilization rate of the memory space, and save storage resources.

[0088] See also Figure 4B , Figure 4B It is another flowchart of the data processing method provided in the embodiment of the present application, and different memory spaces have different priorities; Figure 4A Step 103 in the above process can be implemented through steps 1031-1032: in step 1031, memory space is allocated to the object data in order of priority of multiple memory spaces from high to low; in step 1032, when the allocated memory space meets the allocation condition of the corresponding priority, the allocated memory space is used as the target memory space.

[0089] It should be noted that there are three priorities for memory space, namely, the highest priority, the second highest priority, and the lowest priority. The memory space with the highest priority is the idle node corresponding to the target hierarchical allocator, which is the first hierarchical allocator in the allocator list whose data size is greater than or equal to the object data, and the multiple hierarchical allocators in the allocator list are arranged from low to high according to the memory allocation size; the memory space with the second highest priority is the public idle area; the memory space with the lowest priority is the idle node corresponding to other hierarchical allocators, and the other hierarchical allocators are the hierarchical allocators other than the target hierarchical allocator among the multiple hierarchical allocators; among them, the memory allocation sizes corresponding to different hierarchical allocators are different, and the idle nodes corresponding to the hierarchical allocators are allocated from the public idle area (for example, when part of the memory is allocated from the public idle area to store the object data, when the object data is released, the allocated part of the memory is not returned to the public idle area, but is used as the idle node of the hierarchical allocator), the idle nodes in the hierarchical allocator are connected through a linked list, and the memory size of the public idle area is not fixed.

[0090] See also Figure 4C , Figure 4C is another flow chart of the data processing method provided in the embodiment of the present application. Figure 4C Show Figure 4B Step 1032 in can be implemented by steps 10321-10323:

[0091] In step 10321, when the allocated memory space with the highest priority meets the allocation condition of the corresponding priority, the allocated memory space with the highest priority is used as the target memory space.

[0092] In some embodiments, step 10321 can be implemented in the following manner: when there are free nodes in the free list of the target hierarchical allocator, determine that the allocated memory space with the highest priority meets the allocation conditions of the corresponding priority; and use the first node in the free list of the target hierarchical allocator as the target memory space.

[0093] like Fig.11 As shown in the figure, the size of the object data is 10 Bytes. The first hierarchical allocator (i.e., the target hierarchical allocator) whose index is greater than or equal to size in the binary search in the allocator list is 0, i.e., the first hierarchical allocator in the allocator list. The allocated memory size of the first hierarchical allocator is 16 Bytes. Since the free list of the first hierarchical allocator has free nodes, the first node ( Fig.11 The middle node 1101) is used as the target memory space (also called object data memory).

[0094] It should be noted that when the value of the node count parameter of the free list of the target hierarchical allocator is greater than zero, it is determined that there are free nodes in the free list of the target hierarchical allocator, and when there are multiple free nodes in the free list of the target hierarchical allocator, the multiple free nodes are connected through a linked list. After determining that there are free nodes in the free list of the target hierarchical allocator, remove the first node from the free list of the target hierarchical allocator (the first node is the first free node in the free list of the target hierarchical allocator), use the first node in the free list of the target hierarchical allocator as the target memory space, and reduce the value of the node count parameter of the free list of the target hierarchical allocator.

[0095] Taking the node count parameter of the free list of the target hierarchical allocator (referred to as the free list count field) as FreeCnt=2 as an example, it is determined that there are two free nodes in the free list of the target hierarchical allocator, the first free node is removed from the free list of the target hierarchical allocator, the first free node in the free list of the target hierarchical allocator is used as the target memory space, and FreeCnt is decremented, that is, FreeCnt=1, and the free list of the target hierarchical allocator has only one free node.

[0096] In step 10322, when the allocated memory space with the highest priority does not meet the allocation conditions of the corresponding priority and the allocated memory space with the second highest priority meets the allocation conditions of the corresponding priority, at least part of the allocated memory space with the second highest priority is used as the target memory space.

[0097] In some embodiments, step 10322 can be implemented in the following ways: when there are no free nodes in the free list of the target hierarchical allocator, determining that the allocated memory space with the highest priority does not meet the allocation condition of the corresponding priority; when the memory size of the common free area is greater than or equal to the memory allocation size of the target hierarchical allocator, determining that the allocated memory space with the second highest priority meets the allocation condition of the corresponding priority; allocating a memory block of the memory allocation size of the target hierarchical allocator from the head in the common free area, and using the memory block as the target memory space.

[0098] like Fig.12 As shown, the size of the object data is 30Byte. The first hierarchical allocator (i.e., the target hierarchical allocator) whose index is greater than or equal to size in the binary search in the allocator list is 1, i.e., the second hierarchical allocator in the allocator list. The allocated memory size of the second hierarchical allocator is 32Byte. Since there is no free node in the free list of the second hierarchical allocator, it is determined whether there is still unused space of Size (Size = 32Byte) in the public free area. Since the memory size of the public free area is ≥ Size, it means that there is still unused space of Size in the public free area. Therefore, memory of Size is allocated from the head of the public free area ( Fig.12 The memory block 1201 in (memory block 1201 is 32Byte) is used as the target memory space.

[0099] In step 10323, when the allocated memory space with the highest priority does not meet the allocation conditions of the corresponding priority, the allocated memory space with the second highest priority does not meet the allocation conditions of the corresponding priority, and the allocated memory space with the lowest priority meets the allocation conditions of the corresponding priority, at least part of the allocated memory space with the lowest priority is used as the target memory space.

[0100] In some embodiments, step 10323 can be implemented in the following ways: when there are no free nodes in the free list of the target hierarchical allocator, determining that the allocated memory space with the highest priority does not meet the allocation condition of the corresponding priority; when the memory size of the common free area is smaller than the memory allocation size of the target hierarchical allocator, determining that the allocated memory space with the second highest priority does not meet the allocation condition of the corresponding priority; traversing other hierarchical allocators in order of their memory allocation sizes from low to high; when the free node corresponding to the traversed hierarchical allocator meets the allocation condition of the corresponding priority, using at least part of the allocated memory space with the lowest priority as the target memory space.

[0101] Among them, whether the idle nodes corresponding to the traversed hierarchical allocator meet the allocation conditions of the corresponding priorities can be determined by following the steps 31-35: When there are idle nodes in the free list of the traversed hierarchical allocator, the following iterative processing is performed on the second node of the free list of the traversed hierarchical allocator: In step 31, the second node of the free list of the traversed hierarchical allocator is split to obtain two child nodes corresponding to the second node, wherein the sum of the memory sizes of the two child nodes is equal to the memory size of the second node; in step 32, when the memory sizes of the two child nodes are not equal to the memory allocation size of the target hierarchical allocator, the child node with the larger memory size of the two child nodes is used as the new second node; in step 33, when the memory size of any of the two child nodes is equal to the memory allocation size of the target hierarchical allocator, it is determined that the idle nodes corresponding to the traversed hierarchical allocator meet the allocation conditions of the corresponding priorities.

[0102] The second first node is the first free node in the free list of the traversed hierarchical allocator. It is determined that the free node corresponding to the traversed hierarchical allocator meets the allocation condition of the corresponding priority, and any child node is used as the target memory space, and the iterative processing ends.

[0103] In some embodiments, before step 31, when the node count parameter of the free list of the traversed hierarchical allocator is greater than zero, it means that there are free nodes in the free list of the traversed hierarchical allocator, the second first node is removed from the free list of the traversed hierarchical allocator, and the value of the node count parameter of the free list of the traversed hierarchical allocator is reduced. In step 33, when the memory size of any child node of the two child nodes is equal to the memory allocation size of the target hierarchical allocator, the other child node of the two child nodes is also added to the free list of the corresponding hierarchical allocator, wherein the allocated memory size of the corresponding hierarchical allocator is equal to the memory size of the other child node.

[0104] For example, the second first node is removed from the free list of the traversed hierarchical allocator, the FreeCnt (i.e., the node count parameter) of the traversed hierarchical allocator is decremented, and the first node is split downward into two child nodes (NodeIndex-1 and Nodeindex-2) according to the Fibonacci sequence rule. If the memory size of one of the two child nodes is the allocated memory size of the preferred allocator Index, the child node is used as the object data memory, and the other child node is added to the free list of the corresponding hierarchical allocator, the FreeCnt of the corresponding hierarchical allocator is incremented, and the process goes to step 311; if the sizes of both child nodes are not the allocated memory size of the preferred allocator Index, the child node with the larger memory continues to perform the above-mentioned splitting operation, and the child node with the smaller memory is added to the free list of the corresponding hierarchical allocator.

[0105] like Fig.13 As shown, the size of the object data is 30Byte. The first hierarchical allocator (i.e., the target hierarchical allocator) whose index is greater than or equal to size in the binary search in the allocator list is 1, i.e., the second hierarchical allocator in the allocator list, wherein the allocated memory size of the second hierarchical allocator is 32Byte. Since the free list of the second hierarchical allocator has no free nodes, it is determined whether there is still unused space of Size (Size = 32Byte) in the public free area. Since the memory size of the public free area is less than Size, it means that there is no unused space of Size in the public free area. Then, it is determined whether there is any free node in the free list of the next hierarchical allocator traversed (i.e., the third hierarchical allocator, whose allocated memory size is 48Byte). If there is any free node in the free list of the next hierarchical allocator, remove the first node ( Fig.13 The free node 1301 in , i.e., the second first node), and splits the first node downward into two child nodes (child node 1302 and child node 1303) according to the Fibonacci sequence rule. Since the memory size of child node 1303 is the memory size of the free node corresponding to the target hierarchical allocator, the child node 1303 is used as the target memory space, and the other child node 1302 is added to the free list of the corresponding hierarchical allocator (i.e., the first hierarchical allocator).

[0106] It should be noted that by allocating the memory space in the memory pool in a hierarchical manner through steps 10321 to 10323, discrete idle nodes can be allocated first, avoiding the priority allocation of continuous public idle areas, thereby ensuring the memory size of the public idle areas as much as possible.

[0107] In step 104, the object data is stored in the target memory space.

[0108] The memory size of the target memory space is greater than or equal to the data size of the object data.

[0109] See also Figure 4D , Figure 4D is another flow chart of the data processing method provided in the embodiment of the present application. Figure 4D Show Figure 4A It also includes steps 105 and 106:

[0110] In step 105, in response to the release request of the asynchronous service object, the target memory space corresponding to the object data is released.

[0111] It should be noted that when object data is stored in the memory space of a memory pool (i.e., the memory pool shared by the object data) and the basic data is allocated and stored in the memory space of another memory pool (i.e., the memory pool shared by the basic data), in response to the release request of the asynchronous business object, the target memory space corresponding to the object data is released first, and then the memory space corresponding to the basic data is released to release the asynchronous business object; when the basic data and the object data are merged to obtain the merged data of the asynchronous business object, and the merged data is stored in the memory space in a memory pool (i.e., the memory pool shared by the merged data), the target memory space corresponding to the object data is released to release the asynchronous business object.

[0112] In step 106 , the released target memory space is integrated into a memory pool.

[0113] The memory size of the memory pool is expanded by integrating the released target memory space into the memory pool.

[0114] See also Figure 4E , Figure 4E is another flow chart of the data processing method provided in the embodiment of the present application. Figure 4E Show Figure 4D Step 106 in the above method can be implemented by step 1061: in step 1061, when the released target memory space is adjacent to the common free area in the memory pool, the released target memory space is merged into the head of the common free area.

[0115] like Fig.15 As shown, if the released target memory space 1501 coincides with the common free area in the memory pool, the released target memory space 1501 is merged into the common free area to update the first address of the common free area.

[0116] In some embodiments, after step 1061, the common free area merged with the target memory space is used as a new common free area; when the memory size of the new common free area is less than the first threshold, the hierarchical allocators in the allocator list are traversed; when the free nodes corresponding to the traversed hierarchical allocators are adjacent to the new common free area, the free nodes corresponding to the traversed hierarchical allocators are merged into the new common free area until the memory size of the latest common free area is greater than the second threshold.

[0117] Among them, the first threshold and the second threshold are preset. When the memory size of the common free area merged with the target memory space is less than the preset first threshold, it means that the memory of the common free area merged with the target memory space is too small, and it is necessary to expand the common free area by merging memory blocks (such as free nodes), then the hierarchical allocator is traversed in a loop, and the free nodes in the free list of the hierarchical allocator are traversed. When the free nodes corresponding to the traversed hierarchical allocator are adjacent to the new common free area, the free nodes corresponding to the traversed hierarchical allocator are merged into the new common free area until the memory size of the latest common free area is greater than the second threshold.

[0118] In some embodiments, when the released target memory space is not adjacent to the common free area in the memory pool, the released target memory space is used as the free node corresponding to the corresponding hierarchical allocator in the memory pool, and the free node is added to the tail of the free list of the corresponding hierarchical allocator, wherein the memory allocation size of the corresponding hierarchical allocator is the same as the memory size of the released target memory space; and the value of the node count parameter of the free list of the corresponding hierarchical allocator is increased.

[0119] like Fig.16 As shown, the released target memory space 1601 is not adjacent to the common free area in the memory pool, that is, the memory at the tail of the allocated memory area is in use, then the released target memory space 1601 is added to the free list of the corresponding hierarchical allocator, that is, the memory size of the released target memory space 1601 is 32Byte, then the released target memory space 1601 is added to the free list of the second hierarchical allocator.

[0120] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0121] The embodiments of the present application can be applied to various applications, such as shopping applications, game applications, etc. The following description will be given by taking a game application as an example.

[0122] The backend architecture of a game application is a distributed server cluster consisting of servers with different functions. Most of the game services outside of the game, such as login (such as Figure 5A The login mobile game business product diagram shown), matching (such as Figure 5B Matching business product diagram shown), payment (such as Figure 5C The asynchronous services such as skin purchase business product diagram shown in the figure), social networking, ranking title settlement, etc. require access to multiple servers in the game background to complete the entire business process. Figure 6 Describe the execution process of asynchronous business.

[0123] Step 201: The client sends a ranking title settlement request (request for short) to the lobby server, wherein the ranking title settlement request is used to request the player's title data.

[0124] Step 202: The lobby server reads the player's score data on the leaderboard from the database (DB) server through the database (DB) proxy server according to the leaderboard title settlement request.

[0125] Step 203: The lobby server caches the score data to the object data memory, and reads the player's ranking data on the leaderboard from the component server through the component proxy server.

[0126] Among them, the object data memory is a memory for storing object data, and the object data of the ranking title settlement asynchronous business includes score data and title data. At this time, the title data in the object data memory with score data cached is the default value.

[0127] Among them, the component server refers to a ranking server used to store and update player ranking data, and can provide the game application server with functions such as reporting ranking scores, querying current rankings, and querying overall ranking data.

[0128] Step 204, the lobby server calculates the title data obtained by the player this week according to the read ranking results and score data, updates the title data in the object data memory to the calculated title data, and writes the calculated title data to the DB server.

[0129] Step 205: The lobby server synchronizes the calculated title data to the client.

[0130] from Figure 6 It can be seen that during the execution of an asynchronous service, it is often necessary to cache a portion of the data that needs to be processed and updated by the service, which is called object data. Different types of asynchronous services have object data of different sizes, and these object data also need to be stored in shared memory, so that in the event of an unexpected exit of the server process, the server data can be quickly restored to prevent the player's game data (such as object data) from being destroyed and the virtual property from being lost. In this regard, an embodiment of the present application proposes a shared memory allocation algorithm for adaptive object data lengths of multiple types of asynchronous services. All types of asynchronous services share a section of shared memory, which serves as a memory pool for object data, effectively improving the utilization of shared memory and the number of asynchronous services running simultaneously. It should be noted that the shared memory is used for disaster recovery, that is, the data in the shared memory will not be erased, and the relative address (i.e., offset) of the data in the shared memory will not change.

[0131] In the related art, the basic data and object data of asynchronous services are combined in the memory of a derived class instance and cannot be separated. Different types of asynchronous service objects are created according to the type of asynchronous service through the factory method. Asynchronous service objects stored in shared memory need to set an upper limit in advance to calculate the total amount of shared memory space occupied by asynchronous service objects of this type.

[0132] However, the related technology has the following problems: 1) Object data memory of different types of asynchronous services cannot be shared. For example, the number of login asynchronous services running in the current server process has reached the upper limit Login Num, and the object data memory of the team asynchronous service is still free. The object data memory space can meet the needs of the login service, but due to type restrictions, it does not support the allocation of idle team asynchronous service object data memory for use as login asynchronous service objects, resulting in huge memory waste; 2) It is necessary to set a total upper limit for each type of asynchronous service, which limits the utilization of memory space and thereby reduces the concurrency of asynchronous services. The total upper limit of each asynchronous service is the concurrency upper limit of this type of asynchronous service.

[0133] In order to solve the above problems, the embodiment of the present application separates the basic data and object data of the asynchronous business object, so as to facilitate the sharing of the memory space of the object data between different asynchronous businesses, and uses a shared memory space as the memory pool of the object data of all asynchronous business objects, and splits a part of the memory pool into linked list memory blocks of different sizes by length classification (i.e., Fibonacci sequence) to adapt to the different requirements of different types of asynchronous businesses for the size of the object data space. Among them, since the size of the basic data of different asynchronous businesses is the same, another memory pool can be allocated for the basic data, and the memory size of the memory blocks in the other memory pool is the same. The following is a detailed description of the overall solution through the data structure and interface of the memory pool, the initialization of the memory pool, the allocation process of the object data, and the release process of the object data:

[0134] 1. The data structure and interface of the memory pool of object data of asynchronous business (referred to as the data structure and interface of the memory pool):

[0135] First, the following data structure is used in the embodiment of the present application:

[0136] a. AsyncMemMgr, a data structure of management data of the memory pool of object data of asynchronous services, wherein the fields and descriptions in AsyncMemMgr are as follows:

[0137] a)TotalSize, which indicates the total size of memory that can be allocated by the memory pool;

[0138] b) MaxAllocSize, which indicates the maximum upper limit (e.g. 1 MB) of the object data memory (memory space used to store object data) that can be allocated by the memory pool at one time;

[0139] c) FreePosition, which indicates the offset of the starting address of the public free space of the memory pool (i.e., the public free area where no memory is allocated) (when no memory has been allocated, FreePosition = 0, pointing to the end of the last hierarchical allocator, at which point FreeSpace = TotalSize);

[0140] d)AllocNum, indicating the number of memory pool hierarchical allocators;

[0141] e) AllocList, which represents an array of pointers to the memory pool hierarchical allocator;

[0142] f) Data, indicating the starting address of the allocated memory area of ​​the memory pool (pointing to the end of the last hierarchical allocator).

[0143] b. The data structure AsyncMemAlloc of the hierarchical allocator of the object data of the asynchronous service, wherein the fields and descriptions in AsyncMemAlloc are as follows:

[0144] a) Size, indicating the allocated memory size of the hierarchical allocator;

[0145] b) FreeCnt, which indicates the number of free lists of the hierarchical allocator;

[0146] c) Head, which represents the head node of the doubly linked list of the free list of the hierarchical allocator (the nodes in the free list are used to store pointers. When the nodes are needed to store object data, the pointers are erased and written into the object data).

[0147] c. The data structure AsyncMemHead of the node in the free list of the memory pool, where the fields and descriptions in AsyncMemHead are as follows:

[0148] a) Next, which indicates the offset of the next node based on the starting address of the allocated memory area;

[0149] b)Prev, represents the offset of the previous node based on the starting address of the allocated memory area.

[0150] d. AsyncMemHandle, the handle structure of the object data memory of the asynchronous service, wherein the fields and descriptions in AsyncMemHandle are as follows:

[0151] a) Size, indicating the object data memory size allocated by the memory pool;

[0152] b) Index, which represents the index of the memory hierarchical allocator;

[0153] c) Offset, which indicates the offset of the object data memory based on the starting address of the allocated memory area.

[0154] e. Asynchronous business object AysncBase, where the fields and descriptions related to AysncBase and object data memory are as follows:

[0155] a) UDSize, indicating the size of the required object data;

[0156] b) UDHandle, which indicates the handle data allocated to the object data memory.

[0157] like Figure 7 In the Unified Modeling Language (UML) diagram of the data structure shown, AllocList in AsyncMemMgr is associated with AsyncMemAlloc, Head in AsyncMemAlloc is associated with AsyncMemHead, and UDHandle in AysncBase is associated with AsyncMemHandle.

[0158] Then, the following interfaces are used in the embodiment of the present application:

[0159] a. Initialization interface of memory pool:

[0160] int init_async_mem(AsyncMemMgr*pstAsyncMemMgr,uint64_t ullSize,intiMaxAllocSize);

[0161] The parameters and return values ​​of the initialization interface are described as follows:

[0162] a) pstAsyncMemMgr, indicating the management data pointer of the memory pool of the object data of the globally unique asynchronous service;

[0163] b) ullSize, which indicates the available memory space of the memory pool for the object data of the entire asynchronous service set by the system (i.e., ullSize = TotalSize + management data (AsyncMemMgr) + hierarchical allocator (AsyncMemAlloc));

[0164] c) iMaxAllocSize, which indicates the maximum length of the object data that can be applied for by the asynchronous service set by the system;

[0165] d) Returns 0 if initialization is successful, otherwise returns an error code.

[0166] b. Object data memory allocation interface:

[0167] Void*async_mem_alloc(AsyncMemMgr*pstAsyncMemMgr,int iSize,AsyncMemHandle*pstHandle);

[0168] The parameters and return values ​​of the allocation interface are described as follows:

[0169] a) pstAsyncMemMgr, indicating the management data pointer of the memory pool of the object data of the globally unique asynchronous service;

[0170] b) iSize, indicating the memory size of the object data requested by the asynchronous service;

[0171] c) pstHandle, which indicates the handle pointer of the object data memory held by the asynchronous business object, and is used to record the information of allocated memory;

[0172] d) Returns the starting address of the object data memory if successful, otherwise returns NULL.

[0173] c. Object data memory acquisition interface:

[0174] void*async_mem_get_by_handle(AsyncMemMgr*pstAsyncMemMgr,AsyncMemHandle*pstHandle);

[0175] The parameters and return values ​​of the acquisition interface are described as follows:

[0176] a) pstAsyncMemMgr, indicating the management data pointer of the memory pool of the object data of the globally unique asynchronous service;

[0177] b) pstHandle, indicating the handle pointer of the object data memory held by the asynchronous business object;

[0178] c) Returns the starting address of the object data memory if successful, otherwise returns NULL.

[0179] d. Object data memory release interface:

[0180] int async_mem_free(AsyncMemMgr*pstAsyncMemMgr,AsyncMemHandle*pstHandle);

[0181] The parameters and return values ​​of the release interface are described as follows:

[0182] a) pstAsyncMemMgr, indicating the management data pointer of the memory pool of the object data of the globally unique asynchronous service;

[0183] b) pstHandle, indicating the handle pointer of the object data memory held by the asynchronous business object;

[0184] c) Returns 0 if successful, otherwise returns an error code.

[0185] 2. Initialization of the memory pool of object data of asynchronous business (referred to as initialization of memory pool):

[0186] In the asynchronous service framework, a shared memory is initialized according to the system configuration data as the memory space of the memory pool for the object data of the asynchronous service. The init_async_mem interface (the initialization interface of the memory pool) needs to be executed to initialize the management data and hierarchical distributor of this shared memory.

[0187] The initialization steps performed are as follows:

[0188] a. Initialize the pstAsyncMemMgr data to 0 through the memset function (the memset function is a C and C++ language initialization function in the computer. Its function is to set all the contents in a certain memory block to the specified value. This function initializes the newly applied memory);

[0189] b. The allocated memory size of the hierarchical allocator is initialized from 16 bytes and grows in the form of the Fibonacci sequence (the Fibonacci sequence is an increasing sequence, which is mathematically defined as the growth rate of the sequence: each number is equal to the sum of the previous two numbers), that is, the allocated memory size of the first hierarchical allocator is 16 bytes, the allocated memory size of the second hierarchical allocator is 32 bytes, the allocated memory size of the third hierarchical allocator is 48 bytes, and so on, until the specified maximum length MaxAllocSize is exceeded, and the AllocNum count data and AllocList of pstAsyncMemMgr are updated through the initialized hierarchical allocator;

[0190] c. Calculate the memory size used by the management data and the hierarchical allocator list (referred to as the allocator list), record it as offset, initialize the TotalSize of pstAsyncMemMgr = ullSize-offset; initialize the Data of pstAsyncMemMgr = (char*)pstAsyncMemMgr+offset.

[0191] After the initialization is completed, the memory structure of the memory pool is as follows: Figure 8 As shown, the shared memory of the entire memory pool can be divided into three parts: the memory area for managing data (i.e. Figure 8 AsyncMemMgr in the hierarchical allocator (i.e. Figure 8 AsyncNum AsyncMemAlloc) and the public free area (ie Figure 8 in FreeSpace).

[0192] like Fig. 9 As shown in the figure, during the operation of the memory pool, the shared memory of the entire memory pool can be divided into four parts, namely: the memory area for managing data (i.e. Fig. 9 AsyncMemMgr in the hierarchical allocator (i.e. Fig. 9 AsyncNum AsyncMemAlloc in), allocated memory area (ie Fig. 9 Allocated) and public free area (i.e. Fig. 9 The allocated memory area includes the node data of the object data in use and the node data in the free list of the hierarchical allocator.

[0193] It should be noted that Fig. 9 The starting address of the allocated memory area is identified by the Data field in AsyncMemMgr, the starting address of the common free area is identified by the addition of the Data field and the FreePosition field in AsyncMemMgr, and the end address of the common free area is identified by the addition of the Data field and the TotalSize field in AsyncMemMgr.

[0194] 3. Object data allocation process for asynchronous services:

[0195] When creating an asynchronous service instance object, the object data memory size iSize=size specified by the asynchronous service type is used to apply for memory space from the asynchronous service framework and execute the async_mem_alloc interface to allocate memory.

[0196] like Fig.10 The algorithm flow of the allocation shown in the figure, the allocation steps are described as follows:

[0197] Step 301. According to the iSize parameter, binary search is performed in the AllocList pointer array for the first hierarchical allocator (referred to as the preferred allocator) index (Index) that is greater than or equal to size. If the first hierarchical allocator Index that is greater than or equal to size is found, go to step 302; if the first hierarchical allocator Index that is greater than or equal to size is not found, the allocation of object data memory fails.

[0198] Step 302: According to the hierarchical allocator Index, obtain the corresponding hierarchical allocator (the corresponding allocated memory size is Size).

[0199] Step 303, determine whether there are free nodes in the free list of the corresponding hierarchical allocator, that is, when the count FreeCnt of the free list of the corresponding hierarchical allocator is greater than 0 (if FreeCnt is greater than 0, it means that there are free nodes returned), it means that the free list of the corresponding hierarchical allocator has free nodes, and go to step 304; when the count FreeCnt of the free list of the corresponding hierarchical allocator is equal to 0, it means that the free list of the corresponding hierarchical allocator has no free nodes, and go to step 305.

[0200] Step 304: remove the first node from the Head bidirectional linked list of the hierarchical distributor, and use the first node as the object data memory (used to store object data and marked as in use by the asynchronous service). The FreeCnt of the hierarchical distributor is decremented, and the process goes to step 308.

[0201] Step 305, determine whether there is still unused space of Size in the public free area, that is, when TotalSize-FreePosition≥Size, it means that there is still unused space of Size in the public free area, and go to step 306; when TotalSize-FreePosition<applied Size, it means that there is no unused space of Size in the public free area, and go to step 307.

[0202] Step 306 , allocate a memory of Size size from the header of the common free area as the object data memory, and add Size to the FreePosition of AsyncMemMgr, and go to step 308 .

[0203] Step 307 , loop and self-increment the hierarchical distributor Index to obtain the next hierarchical distributor Index, and proceed to step 308 .

[0204] Step 308 : According to the next hierarchical distributor Index, obtain the corresponding next hierarchical distributor, and proceed to step 309 .

[0205] Step 309, determine whether there are free nodes in the free list of the next hierarchical allocator, that is, when the count FreeCnt of the free list of the next hierarchical allocator is greater than 0 (if FreeCnt is greater than 0, it means that there are free nodes returned), it means that the free list of the next hierarchical allocator has free nodes, and go to step 310; when the count FreeCnt of the free list of the next hierarchical allocator is equal to 0, it means that the free list of the next hierarchical allocator has no free nodes, and go to step 307 until Index is equal to AllocNum, and the allocation of object data memory fails.

[0206] Step 310, remove the head node from the next hierarchical allocator Head bidirectional linked list, decrement the FreeCnt of the next hierarchical allocator, and split the head node downward into two child nodes (NodeIndex-1 and Nodeindex-2) according to the Fibonacci sequence rule. If the memory size of one of the two child nodes is the allocated memory size of the preferred allocator Index, use the child node as the object data memory, add the other child node to the free list of the corresponding hierarchical allocator, increment the FreeCnt of the corresponding hierarchical allocator, and proceed to step 311; if the sizes of both child nodes are not the allocated memory size of the preferred allocator Index, continue to perform the above splitting operation on the child node with larger memory, and add the child node with smaller memory to the free list of the corresponding hierarchical allocator.

[0207] Step 311, according to the address of the allocated object data memory, set the parameter pstHandle, that is, set the index (Index) of the hierarchical allocator in Handle, the object data memory size (Size) and the offset (Offset).

[0208] according to Fig.10 From the allocation algorithm flow shown, we can see that there are three scenarios for successfully allocating object data memory, namely:

[0209] Scenario 1: Allocate from the free list of the preferred allocator.

[0210] like Fig.11 As shown in the figure, the requested size is 10Byte. The first hierarchical allocator (i.e., the preferred allocator) with a binary search greater than or equal to size in the AllocList pointer array has an Index of 0, i.e., the first hierarchical allocator. The allocated memory size of the first hierarchical allocator is 16Byte. Since there are free nodes in the free list of the first hierarchical allocator, the first node is removed from the Head bidirectional linked list of the first hierarchical allocator ( Fig.11 The first node is used as the object data memory (used to store 10 Byte of object data and is marked as in use by the asynchronous service).

[0211] Scenario 2: When the free list of the preferred allocator is empty, allocate from the public free area.

[0212] like Fig.12 As shown, the requested size is 30Byte. The first hierarchical allocator (i.e., the preferred allocator) with a binary search greater than or equal to size in the AllocList pointer array has an Index of 1, i.e., the second hierarchical allocator. The allocated memory size of the second hierarchical allocator is 32Byte. Since there are no free nodes in the free list of the second hierarchical allocator, it is determined whether there is still unused space of Size (Size = 32Byte) in the public free area. Since TotalSize-FreePosition≥Size, it means that there is still unused space of Size in the public free area. Therefore, memory of Size is allocated from the head of the public free area ( Fig.12 The memory space 1201 in the memory is 32Byte) as the object data memory.

[0213] Scenario 3: When the free list of the preferred allocator is empty and there is insufficient space in the public free area, allocation is made from the free list of the next hierarchical allocator.

[0214] like Fig.13 As shown, the requested size is 30Byte. The first hierarchical allocator (i.e., the preferred allocator) with a binary search greater than or equal to size in the AllocList pointer array has an Index of 1, i.e., the second hierarchical allocator, where the allocated memory size of the second hierarchical allocator is 32Byte. Since the free list of the second hierarchical allocator has no free nodes, it is determined whether there is still unused space of Size (Size = 32Byte) in the public free area. Since TotalSize-FreePosition is less than Size, it means that there is no unused space of Size in the public free area. It is then determined whether there is a free node in the free list of the next hierarchical allocator (i.e., the third hierarchical allocator, whose allocated memory size is 48Byte). If there is a free node in the free list of the next hierarchical allocator, remove the first node ( Fig.13 ), and split the first node downward into two child nodes (child node 1302 and child node 1303) according to the Fibonacci sequence rule. Since the memory size of child node 1303 is the allocated memory size of the preferred allocator Index, the child node 1303 is used as the object data memory, and the other child node 1302 is added to the free list of the corresponding hierarchical allocator (i.e., the first hierarchical allocator).

[0215] 4. Release process of object data of asynchronous business:

[0216] After the asynchronous business object is executed, in its destruction function, it is necessary to return the requested resources to the system, including releasing the requested object data memory and executing the async_mem_free interface to release the object data memory.

[0217] like Fig.14 The release algorithm flow shown in the figure, the release steps are described as follows:

[0218] Step 401. Determine, based on the Offset field in Handle, whether the released object data memory is the last memory block of the allocated memory area (i.e., whether the released object data memory is located at the end of the allocated memory area). That is, when Offset+Size is equal to FreePosition in AsyncMemMgr, it indicates that the released object data memory is the last memory block of the allocated memory area, and go to step 402; when Offset+Size is not equal to FreePosition in AsyncMemMgr, it indicates that the released object data memory is not the last memory block of the allocated memory area, and go to step 409.

[0219] Step 402 : merge the memory blocks into the common free area, that is, subtract Size from FreePosition in AsyncMemMgr, and proceed to step 403 .

[0220] Step 403 , when the memory size of the common free area is less than the preset first threshold, it means that the memory of the common free area is too small and the common free area needs to be expanded by merging memory blocks, then the hierarchical allocator is traversed in a loop and the process goes to step 404 .

[0221] Step 404 , traverse the idle nodes in the idle list of the hierarchical distributor, and proceed to step 405 .

[0222] Step 405, determine whether the idle node is the last memory block of the allocated memory area (i.e., whether the idle node is located at the end of the allocated memory area). When the idle node is the last memory block of the allocated memory area, proceed to step 406; when the idle node is not the last memory block of the allocated memory area, proceed to step 411.

[0223] Step 406 , remove the idle node from the Head bidirectional linked list of the hierarchical distributor, merge the idle nodes into the public idle area, and go to step 407 .

[0224] Step 407, determine whether the memory size of the common free area exceeds the preset second threshold. When the memory size of the common free area does not exceed the preset second threshold, proceed to step 408; when the memory size of the common free area exceeds the preset second threshold, proceed to step 411.

[0225] Step 408 , determining whether the traversal of the idle nodes of the current hierarchical distributor is complete. If the traversal of the idle nodes of the current hierarchical distributor is complete, proceed to step 403 ; if the traversal of the idle nodes of the current hierarchical distributor is not complete, proceed to step 404 .

[0226] Step 409 , according to the Index field in Handle, obtain the corresponding hierarchical distributor, and proceed to step 410 .

[0227] Step 410: Add the released object data memory to the free list of the corresponding hierarchical allocator, and increment the FreeCnt of the hierarchical allocator, and proceed to step 411.

[0228] Step 411: reset the Handle data, that is, reset the AsyncMemHandle in AysncBase to 0.

[0229] according to Fig.14 From the release algorithm flow shown, we can see that there are two scenarios for releasing object data memory:

[0230] Scenario 1: Release the object data memory to the public free area.

[0231] like Fig.15 As shown, if the released object data memory 1501 is located at the tail of the allocated memory area, the object data memory 1501 is merged into the common free area to update the first address of the common free area. The free list of the hierarchical allocator can also be traversed to merge other space nodes located in the allocated memory area into the common free area until the set second threshold is met.

[0232] Scenario 2: Release the object data memory to the free list of the corresponding hierarchical allocator.

[0233] like Fig.16 As shown, the released object data memory 1601 is not located at the end of the allocated memory area, that is, the memory located at the end of the allocated memory area is in use, then the object data memory 1601 is added to the free list of the corresponding hierarchical allocator, that is, the memory size of the released object data memory 1601 is 32Byte, then the object data memory 1601 is added to the free list of the second hierarchical allocator.

[0234] By applying this solution on the background server of the mobile game, a shared memory of 1G memory can support more than 1,600 asynchronous businesses, and can run up to 200,000 asynchronous business objects in parallel, widely supporting a variety of game businesses, and having a concurrent effect of tens of thousands of queries per second (QPS).

[0235] In summary, the embodiments of the present application separate the basic data and object data of asynchronous services. Through the allocation algorithm and release algorithm of the hierarchical memory pool, the object data memory can be shared between different types of asynchronous services, thereby reducing the waste of shared memory and improving the single-type concurrency and overall concurrency of asynchronous services.

[0236] So far, the data processing method provided by the embodiment of the present application has been described in combination with the exemplary application and implementation of the electronic device provided by the embodiment of the present application. The following will continue to describe the cooperation of various modules in the data processing device 555 provided by the embodiment of the present application to implement the data processing solution.

[0237] A creation module 5551 is used to perform the following processing for any asynchronous service among multiple types of asynchronous services: in response to an object creation request of the asynchronous service, create an asynchronous service object, wherein the asynchronous service object includes object data; an allocation module 5552 is used to obtain a memory pool shared by the multiple types of asynchronous services, wherein the memory pool includes at least one memory space, and any of the memory spaces is used to store object data corresponding to any type of the asynchronous service; in at least one memory space in the memory pool, allocate a target memory space for the object data; a storage module 5553 is used to store the object data in the target memory space.

[0238] In some embodiments, different memory spaces have different priorities; the allocation module 5552 is also used to allocate the memory space to the object data in order of the priorities of the multiple memory spaces from high to low; when the allocated memory space meets the allocation conditions of the corresponding priority, the allocated memory space is used as the target memory space.

[0239] In some embodiments, the memory space with the highest priority is an idle node corresponding to a target hierarchical allocator, the target hierarchical allocator is the first hierarchical allocator in the allocator list whose data size is greater than or equal to the object data, and the multiple hierarchical allocators in the allocator list are arranged from low to high according to the memory allocation size; the memory space with the second highest priority is a common idle area; the memory space with the lowest priority is an idle node corresponding to other hierarchical allocators, and the other hierarchical allocators are hierarchical allocators other than the target hierarchical allocator among the multiple hierarchical allocators; the allocation module 5552 is also used to allocate the memory space with the highest priority when it meets the allocation condition of the corresponding priority. The memory space with the highest allocated priority is used as the target memory space; when the memory space with the highest allocated priority does not satisfy the allocation condition of the corresponding priority and the memory space with the second highest allocated priority satisfies the allocation condition of the corresponding priority, at least part of the memory space with the second highest allocated priority is used as the target memory space; when the memory space with the highest allocated priority does not satisfy the allocation condition of the corresponding priority, the memory space with the second highest allocated priority does not satisfy the allocation condition of the corresponding priority and the memory space with the lowest allocated priority satisfies the allocation condition of the corresponding priority, at least part of the memory space with the lowest allocated priority is used as the target memory space.

[0240] In some embodiments, the allocation module 5552 is also used to determine that the memory space with the highest allocated priority meets the allocation conditions of the corresponding priority when the free node exists in the free list of the target hierarchical allocator; and use the first node in the free list of the target hierarchical allocator as the target memory space.

[0241] In some embodiments, before determining that the memory space with the highest allocated priority meets the allocation condition of the corresponding priority, the allocation module 5552 is also used to determine that the free node exists in the free list of the target hierarchical allocator when the value of the node count parameter of the free list of the target hierarchical allocator is greater than zero; after determining that the memory space with the highest allocated priority meets the allocation condition of the corresponding priority, the allocation module 5552 is also used to remove the first node from the free list of the target hierarchical allocator and reduce the value of the node count parameter of the free list of the target hierarchical allocator.

[0242] In some embodiments, the allocation module 5552 is also used to determine that the memory space with the highest allocated priority does not meet the allocation conditions of the corresponding priority when the free node does not exist in the free list of the target hierarchical allocator; when the memory size of the common free area is greater than or equal to the memory allocation size of the target hierarchical allocator, determine that the memory space with the second highest allocated priority meets the allocation conditions of the corresponding priority; allocate a memory block of the memory allocation size of the target hierarchical allocator from the head in the common free area, and use the memory block as the target memory space.

[0243] In some embodiments, the allocation module 5552 is also used to determine that the memory space with the highest allocated priority does not meet the allocation condition of the corresponding priority when the free node does not exist in the free list of the target hierarchical allocator; when the memory size of the common free area is smaller than the memory allocation size of the target hierarchical allocator, determine that the memory space with the second highest allocated priority does not meet the allocation condition of the corresponding priority; traverse the other hierarchical allocators in order of the memory allocation size of the other hierarchical allocators from low to high; when the free node corresponding to the traversed hierarchical allocator meets the allocation condition of the corresponding priority, use at least part of the memory space with the lowest allocated priority as the target memory space.

[0244] In some embodiments, the allocation module 5552 is also used to perform the following iterative processing on the second first node of the free list of the traversed hierarchical allocator when the free node exists in the free list of the traversed hierarchical allocator: split the second first node of the free list of the traversed hierarchical allocator to obtain two child nodes corresponding to the second first node, wherein the sum of the memory sizes of the two child nodes is equal to the memory size of the second first node; when the memory sizes of the two child nodes are not equal to the memory allocation size of the target hierarchical allocator, use the child node with the larger memory size of the two child nodes as the new second first node; when the memory size of any of the two child nodes is equal to the memory allocation size of the target hierarchical allocator, determine that the free node corresponding to the traversed hierarchical allocator meets the allocation condition of the corresponding priority, use any of the child nodes as the target memory space, and end the iterative processing.

[0245] In some embodiments, before splitting the second first node of the free list of the traversed hierarchical allocator, the allocation module 5552 is also used to remove the second first node from the free list of the traversed hierarchical allocator; when the memory size of any one of the two child nodes is equal to the memory allocation size of the target hierarchical allocator, the allocation module 5552 is also used to add the other of the two child nodes to the free list of the corresponding hierarchical allocator, wherein the allocated memory size of the corresponding hierarchical allocator is equal to the memory size of the other child node.

[0246] In some embodiments, the storage module 5553 is further used to release the target memory space corresponding to the object data in response to a release request of the asynchronous business object; and integrate the released target memory space into the memory pool.

[0247] In some embodiments, the storage module 5553 is further configured to merge the released target memory space into the head of the common free area when the released target memory space is adjacent to the common free area in the memory pool.

[0248] In some embodiments, the storage module 5553 is also used to use the common free area merged with the target memory space as the new common free area; when the memory size of the new common free area is less than a first threshold, traverse the hierarchical allocators in the allocator list; when the idle nodes corresponding to the traversed hierarchical allocators are adjacent to the new common free area, merge the idle nodes corresponding to the traversed hierarchical allocators into the new common free area until the latest memory size of the common free area is greater than a second threshold.

[0249] In some embodiments, the storage module 5553 is also used to, when the released target memory space is not adjacent to the common free area in the memory pool, use the released target memory space as the free node corresponding to the corresponding hierarchical allocator in the memory pool, and add the free node to the tail of the free list of the corresponding hierarchical allocator, wherein the memory allocation size of the corresponding hierarchical allocator is the same as the memory size of the released target memory space; and increase the value of the node count parameter of the free list of the corresponding hierarchical allocator.

[0250] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer program or the computer executable instruction from the computer-readable storage medium, and the processor executes the computer program or the computer executable instruction, so that the electronic device executes the data processing method described in the embodiment of the present application.

[0251] The present application embodiment 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 be caused to execute the data processing method provided by the present application embodiment, for example, Figure 4A-4E The data processing method is shown.

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

[0253] 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.

[0254] 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 storing 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).

[0255] 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.

[0256] It is understandable that in the embodiments of the present application, related data such as user information is involved. When the embodiments of the present 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.

[0257] 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 data processing method, characterized in that: The method comprises: The following processing is performed for any of the asynchronous services of multiple types: In response to the object creation request of the asynchronous service, creating an asynchronous service object, wherein the asynchronous service object includes object data; Acquire a memory pool shared by the multiple types of asynchronous services, wherein the memory pool includes at least one memory space, and any of the memory spaces is used to store object data corresponding to any type of the asynchronous services; In at least one memory space in the memory pool, allocating a target memory space for the object data; The object data is stored in the target memory space.

2. The method according to claim 1, characterized in that Different memory spaces have different priorities; The allocating a target memory space for the object data in at least one memory space in the memory pool includes: Allocating the memory spaces to the object data in order of priority of the plurality of memory spaces from high to low; When the allocated memory space meets the allocation condition of the corresponding priority, the allocated memory space is used as the target memory space.

3. The method according to claim 2, characterized in that The memory space with the highest priority is an idle node corresponding to a target hierarchical allocator, the target hierarchical allocator is the first hierarchical allocator in the allocator list whose data size is greater than or equal to the object data, and the multiple hierarchical allocators in the allocator list are arranged from low to high according to the memory allocation size; The memory space with the second highest priority is a public free area; The memory space with the lowest priority is an idle node corresponding to other hierarchical allocators, and the other hierarchical allocators are hierarchical allocators other than the target hierarchical allocator among the multiple hierarchical allocators; When the allocated memory space satisfies the allocation condition of the corresponding priority, using the allocated memory space as the target memory space comprises: When the memory space with the highest allocated priority meets the allocation condition of the corresponding priority, the memory space with the highest allocated priority is used as the target memory space; When the memory space with the highest allocated priority does not satisfy the allocation condition of the corresponding priority and the memory space with the second highest allocated priority satisfies the allocation condition of the corresponding priority, at least a part of the memory space with the second highest allocated priority is used as the target memory space; When the memory space with the highest allocated priority does not meet the allocation conditions of the corresponding priority, the memory space with the second highest allocated priority does not meet the allocation conditions of the corresponding priority, and the memory space with the lowest allocated priority meets the allocation conditions of the corresponding priority, at least a portion of the memory space with the lowest allocated priority is used as the target memory space.

4. The method according to claim 3, characterized in that When the memory space with the highest allocated priority meets the allocation condition of the corresponding priority, the memory space with the highest allocated priority is used as the target memory space, including: When the idle node exists in the idle list of the target hierarchical allocator, determining that the memory space with the highest allocation priority satisfies the allocation condition of the corresponding priority; The first node in the free list of the target hierarchical allocator is used as the target memory space.

5. The method according to claim 4, characterized in that Before determining that the memory space with the highest allocation priority meets the allocation condition of the corresponding priority, the method further includes: When the value of the node count parameter of the free list of the target hierarchical distributor is greater than zero, determining that the free list of the target hierarchical distributor has the free node; After determining that the memory space with the highest allocation priority meets the allocation condition of the corresponding priority, the method further includes: The first node is removed from the free list of the target hierarchical distributor, and the value of the node count parameter of the free list of the target hierarchical distributor is reduced.

6. The method according to claim 3, characterized in that When the allocated memory space with the highest priority does not satisfy the allocation condition of the corresponding priority and the allocated memory space with the second highest priority satisfies the allocation condition of the corresponding priority, at least part of the allocated memory space with the second highest priority is used as the target memory space, including: When the idle node does not exist in the idle list of the target hierarchical allocator, determining that the memory space with the highest allocation priority does not meet the allocation condition of the corresponding priority; When the memory size of the common free area is greater than or equal to the memory allocation size of the target hierarchical allocator, determining that the memory space with the second highest allocation priority meets the allocation condition of the corresponding priority; A memory block of the memory allocation size of the target hierarchical allocator is allocated from the head in the common free area, and the memory block is used as the target memory space.

7. The method according to claim 3, characterized in that When the memory space with the highest allocated priority does not satisfy the allocation condition of the corresponding priority, the memory space with the second highest allocated priority does not satisfy the allocation condition of the corresponding priority, and the memory space with the lowest allocated priority satisfies the allocation condition of the corresponding priority, at least part of the memory space with the lowest allocated priority is used as the target memory space, including: When the idle node does not exist in the idle list of the target hierarchical allocator, determining that the memory space with the highest allocation priority does not meet the allocation condition of the corresponding priority; When the memory size of the common free area is smaller than the memory allocation size of the target hierarchical allocator, determining that the memory space with the second highest allocation priority does not meet the allocation condition of the corresponding priority; Traversing the other hierarchical allocators in order of memory allocation sizes of the other hierarchical allocators from low to high; When the idle nodes corresponding to the traversed hierarchical allocator meet the allocation conditions of the corresponding priorities, at least a portion of the memory space with the lowest allocated priority is used as the target memory space.

8. The method according to claim 7, characterized in that When the idle nodes corresponding to the traversed hierarchical allocator meet the allocation conditions of the corresponding priorities, at least part of the memory space with the lowest allocated priority is used as the target memory space, including: When the idle list of the traversed hierarchical distributor has the idle node, the following iterative processing is performed on the second first node of the traversed idle list of the hierarchical distributor: Splitting the second first node of the traversed free list of the hierarchical allocator to obtain two child nodes corresponding to the second first node, wherein the sum of the memory sizes of the two child nodes is equal to the memory size of the second first node; When the memory sizes of the two child nodes are not equal to the memory allocation size of the target hierarchical allocator, the child node with the larger memory size of the two child nodes is used as the new second first node; When the memory size of any of the two child nodes is equal to the memory allocation size of the target hierarchical allocator, determine that the idle node corresponding to the traversed hierarchical allocator meets the allocation condition of the corresponding priority, take any of the child nodes as the target memory space, and end the iterative processing.

9. The method according to claim 8, characterized in that Before splitting the second first node of the traversed free list of the hierarchical distributor, the method further includes: Remove the second node from the traversed free list of the hierarchical distributor; When the memory size of any of the two subnodes is equal to the memory allocation size of the target hierarchical allocator, the method further includes: Another of the two child nodes is added to a free list of a corresponding hierarchical allocator, wherein the allocated memory size of the corresponding hierarchical allocator is equal to the memory size of the other child node.

10. The method according to claim 1, characterized in that The method further comprises: In response to a release request of the asynchronous business object, releasing the target memory space corresponding to the object data; Integrate the released target memory space into the memory pool.

11. The method according to claim 10, characterized in that The step of integrating the released target memory space into the memory pool includes: When the released target memory space is adjacent to the common free area in the memory pool, the released target memory space is merged into the head of the common free area.

12. The method according to claim 11, characterized in that The method further comprises: Using the public free area merged with the target memory space as the new public free area; When the memory size of the new common free area is smaller than the first threshold, traversing the hierarchical allocators in the allocator list; When the idle nodes corresponding to the traversed hierarchical allocators are adjacent to the new common idle area, the idle nodes corresponding to the traversed hierarchical allocators are merged into the new common idle area until the memory size of the latest common idle area is greater than the second threshold.

13. The method according to claim 11 or 12, characterized in that: The method further comprises: When the released target memory space is not adjacent to the common free area in the memory pool, the released target memory space is used as a free node corresponding to the corresponding hierarchical allocator in the memory pool, and the free node is added to the tail of the free list of the corresponding hierarchical allocator, wherein the memory allocation size of the corresponding hierarchical allocator is the same as the memory size of the released target memory space; The value of the node count parameter of the free list of the corresponding hierarchical allocator is increased.

14. A data processing device, characterized in that: The device comprises: A module is created, which is used to perform the following processing for any of the asynchronous services of multiple types: In response to the object creation request of the asynchronous service, creating an asynchronous service object, wherein the asynchronous service object includes object data; An allocation module, configured to obtain a memory pool shared by the multiple types of asynchronous services, wherein the memory pool includes at least one memory space, and any of the memory spaces is used to store object data corresponding to any type of the asynchronous services; In at least one memory space in the memory pool, allocating a target memory space for the object data; A storage module is used to store the object data in the target memory space.

15. An electronic device, characterized in that: The electronic device comprises: Memory for storing computer programs or computer executable instructions; A processor, configured to implement the data processing method according to any one of claims 1 to 13 when executing a computer program or computer executable instructions stored in the memory.

16. A computer-readable storage medium, characterized in that: A computer program or a computer executable instruction is stored, and when the computer program or the computer executable instruction is executed by a processor, the data processing method according to any one of claims 1 to 13 is implemented.

17. A computer program product comprising a computer program or computer executable instructions, characterized in that When the computer program or computer executable instructions are executed by a processor, the data processing method according to any one of claims 1 to 13 is implemented.