A memory management method and system

By initializing the data management class in the financial transaction software and deleting expired data regularly, the problem of invalid data occupies system capacity is solved, and the system storage efficiency is improved and performance overhead is reduced.

CN114185947BActive Publication Date: 2025-05-27SHANGHAI FINANCIAL FUTURES INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111542324.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-16
Publication Date
2025-05-27
Estimated Expiration
2041-12-16

AI Technical Summary

Technical Problem

In high-performance financial transaction software, the system capacity is reduced by the operating data occupies memory, and the existing technology is difficult to effectively solve the problem of invalid data occupies system capacity.

Method used

By initializing the data management class in the main process, timely checking and deleting expired data, and synchronizingly deleting expired data in other processes through inter-process communication.

Benefits of technology

Dynamic deletion of invalid business data is realized, which reduces the system's memory footprint, improves the system's storage efficiency, and reduces the memory management performance overhead of business data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114185947B_ABST
    Figure CN114185947B_ABST
Patent Text Reader

Abstract

The present invention discloses a memory management method and system, which solves the problem of invalid data occupying system capacity and improves the efficiency of system storage. The technical solution is as follows: by periodically checking the data in the main process, deleting the invalid service data (such as expired data) in the memory, and synchronizing the deletion action to other processes through inter-process communication, ensuring that the invalid data in the entire system (process group) is synchronously deleted in the memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a memory management method for large-capacity service data, and more particularly to a memory management method for large-capacity service data applied in the field of financial trading software. Background Art

[0002] In high-performance financial trading software, in order to improve the access speed of service data, the data is usually stored and retrieved in memory. For some service data, such as order data, the memory occupation will increase linearly with the increase in the number of order records. However, due to their own business reasons, after these service data become a certain state, they will no longer be accessed by the program, but they will still be stored in memory and occupy resources, which will cause a reduction in system capacity.

[0003] How to solve the problem of invalid data occupying system capacity is what the industry needs at present. Summary of the Invention

[0004] The following gives a brief overview of one or more aspects to provide a basic understanding of these aspects. This overview is not an exhaustive survey of all contemplated aspects, and is neither intended to identify key or decisive elements of all aspects nor to define the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to a more detailed description to follow.

[0005] The object of the present invention is to solve the above problems, and provides a memory management method and system to solve the problem of invalid data occupying system capacity and improve the storage efficiency of the system.

[0006] The technical solution of the present invention is as follows: The present invention discloses a memory management method applied to the scenario of data synchronization deletion in multiple processes. The method includes data deletion processing in the main process and synchronization processing of deleted data in other processes, where:

[0007] The data deletion processing in the main process includes:

[0008] When the main process starts, it performs an initialization operation, initializes the data management class based on the pointer of the memory database maintained by the main process, so that the data management class maintains the memory addresses of newly added data. The data management class is used to manage the classes that need to dynamically delete data;

[0009] The main process initializes a timer according to the set time, and regularly checks for expired memory data;

[0010] In the main process, the expired memory data checked is deleted, and other processes are notified through the data management class of the need to synchronize the deletion operation of the expired data;

[0011] The synchronous processing of deleted data in other processes includes:

[0012] When a current process in other processes starts, it performs initialization. Based on the pointer of the in-memory database of this current process, it initializes the data management class so that the data management class maintains the memory addresses of newly added business data.

[0013] During the running of the current process, it receives the value of the deleted data field sent by the main process and processes the synchronous deletion of expired data in the current process by calling the data management class.

[0014] According to an embodiment of the memory management method of the present invention, an initialization interface is set in the data management class. The process of initializing the data management class based on the pointer of the in-memory database maintained by the main process further includes: passing the pointer of the in-memory database maintained by the main process into the initialization interface of the data management class to initialize the data management class.

[0015] According to an embodiment of the memory management method of the present invention, the process of initializing the timer to periodically check data according to the set time further includes:

[0016] The main process calls the data acquisition interface of the data management class to obtain the memory addresses of all data from the cached data of the data management class. Then, by traversing all the obtained data, it checks for expired data according to the size relationship between the duration of the data existing in memory and the duration set by the timer.

[0017] According to an embodiment of the memory management method of the present invention, the process of the main process notifying other processes of the need to synchronize the deletion operation of expired data through the data management class further includes:

[0018] The main process updates the value of the time interval of the deleted data field set in the data management class, and then sends the deleted data field to other processes to notify other processes of the need to synchronize the deletion operation of expired data.

[0019] According to an embodiment of the memory management method of the present invention, when a current process in other processes starts, it performs initialization. The process of initializing the data management class based on the pointer of the in-memory database of this current process further includes:

[0020] This current process passes its in-memory database address as a pointer into the initialization interface of the data management class to initialize the data management class.

[0021] According to an embodiment of the memory management method of the present invention, when the current process receives the value of the deleted data field sent by the main process and processes the synchronous deletion of expired data in the current process by calling the data management class, it further includes:

[0022] The current process receives the value of the data deletion field sent by the main process and calls the data deletion interface of the data management class. The data deletion field is the data structure used by the main process to publish deletion information to other processes. The data deletion interface of the data management class is used in processes other than the main process to traverse the cache in the current process and delete all data within the deletable range to handle the synchronous deletion of expired data in the current process.

[0023] The present invention also discloses a memory management system applied to the scenario of data synchronous deletion in multiple processes. The system includes a main process data deletion module and a process synchronization module, where:

[0024] The main process data deletion module is configured as follows:

[0025] When the main process starts, it performs an initialization operation, initializes the data management class based on the pointer of the memory database maintained by the main process, so that the data management class maintains the memory addresses of newly added data. The data management class is used to manage classes that require dynamic data deletion;

[0026] The main process initializes a timer according to the set time and regularly checks for expired memory data;

[0027] In the main process, the detected expired memory data is deleted, and other processes are notified through the data management class of the need to synchronize the deletion operation of expired data;

[0028] The process synchronization module is configured as follows:

[0029] When a current process in other processes starts, it performs an initialization, initializes the data management class based on the pointer of the memory database of the current process, so that the data management class maintains the memory addresses of newly added business data;

[0030] During the operation of the current process, it receives the value of the data deletion field sent by the main process and processes the synchronous deletion of expired data in the current process by calling the data management class.

[0031] According to an embodiment of the memory management system of the present invention, in the configuration of the main process data deletion module, the process of initializing the data management class based on the pointer of the memory database maintained by the main process further includes: passing the pointer of the memory database maintained by the main process into the initialization interface of the data management class to initialize the data management class, where the initialization interface is the interface set by the data management class.

[0032] According to an embodiment of the memory management system of the present invention, in the configuration of the main process data deletion module, the regular data check of the main process initializing the timer according to the set time further includes:

[0033] The main process calls the data acquisition interface of the data management class to obtain the memory addresses of all data from the cached data of the data management class, and then checks for expired data by traversing all the obtained data and comparing the duration of the data's existence in memory with the duration set by the timer.

[0034] According to an embodiment of the memory management system of the present invention, in the configuration of the main process data deletion module, the process by which the main process notifies other processes through the data management class that they need to synchronize the deletion operation of expired data further includes:

[0035] The main process updates the value of the time interval of the data deletion field set in the data management class, and then sends the data deletion field to other processes to notify other processes that they need to synchronize the deletion operation of expired data.

[0036] According to an embodiment of the memory management system of the present invention, in the configuration of the process synchronization module, when a current process among other processes starts, it performs initialization, and the process of initializing the data management class based on the pointer of the memory database of the current process further includes:

[0037] The current process passes its memory database address as a pointer into the initialization interface of the data management class to initialize the data management class.

[0038] According to an embodiment of the memory management system of the present invention, in the configuration of the process synchronization module, when the current process receives the value of the data deletion field sent by the main process, and processes the synchronous deletion of expired data in the current process by calling the data management class, it further includes:

[0039] The current process receives the value of the data deletion field sent by the main process and calls the data deletion interface of the data management class. The data deletion field is the data structure used by the main process to publish deletion information to other processes. The data deletion interface of the data management class is used in processes other than the main process to traverse the cache in the current process and delete all data within the deletable range to handle the synchronous deletion of expired data in the current process.

[0040] The present invention has the following beneficial effects compared with the prior art: By regularly checking the data in the main process, the present invention deletes invalid business data (such as expired data) in memory and synchronizes the deletion action to other processes through inter-process communication, ensuring that the invalid data in the entire system (process group) is synchronously deleted in memory.

[0041] Specifically, the present invention has strong versatility and can be applied not only to the memory management of large-capacity service data in a single process, but also to the memory data management in multiple processes. The present invention can minimize the performance overhead brought by the memory management of service data and will not allocate additional memory except for the communication of inter-process synchronous deletion operations. In addition, the algorithm of the present invention is highly understandable, and developers can design a specific and implementable large-capacity service data memory management method in their own application scenarios based on the algorithm of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] After reading the detailed description of the embodiments of the present disclosure in conjunction with the following drawings, the above features and advantages of the present invention can be better understood. In the drawings, the components are not necessarily drawn to scale, and components with similar related characteristics or features may have the same or similar reference numerals.

[0043] Figure 1 The class diagram showing the classes for managing data in the present invention is shown.

[0044] Figure 2 Shows Figure 1 The internal structure, i.e., the workflow diagram, of the class for managing data shown.

[0045] Figure 3 The flowchart showing the main process for data deletion in an embodiment of the memory management method of the present invention is shown.

[0046] Figure 4 The flowchart showing the synchronization of other processes to delete data in an embodiment of the memory management method of the present invention is shown.

[0047] Figure 5 The schematic diagram of an embodiment of the memory management system of the present invention is shown. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0048] The present invention will be described in detail below in conjunction with the drawings and specific embodiments. Note that the aspects described below in conjunction with the drawings and specific embodiments are merely exemplary and should not be construed as imposing any limitation on the protection scope of the present invention.

[0049] The memory management method of the present invention mainly focuses on the synchronous deletion of service data in multiple processes, including data deletion processing in the main process and synchronous processing of the deleted data in other processes.

[0050] The data processing in the main process is as Figure 3 shown. The following describes each processing step of the main process.

[0051] Step 11: When the main process starts, it performs initialization operations, passes the pointer of the in-memory database maintained by the main process into the init interface (i.e., the initialization interface) of the delete_helper class to initialize the delete_helper class, so that the delete_helper class can maintain the memory addresses of the newly added business data.

[0052] The delete_helper class is a class that manages business data that needs to be dynamically deleted. It can also be called a data management class and is used in each process that needs to dynamically delete business data.

[0053] The class diagram of the delete_helper class is Figure 1 , which introduces the interfaces of the delete_helper class and describes the scenarios where the main process and other processes use the interfaces of this class. It can be seen from this that the delete_helper class provides three interfaces for the program to call, namely the init interface, the get_biz_data interface (i.e., the data acquisition interface), and the delete_biz_data interface (i.e., the data deletion interface). In actual business scenarios, the business data structures are different. Therefore, in this embodiment, the business data that needs to be dynamically deleted is abstractly expressed as biz_field (i.e., the business data structure, abbreviated as biz). When actually applying this embodiment, biz_field can be replaced with the specific business data structure that needs to be deleted in the system.

[0054] Figure 2 shows the structure of the delete_helper class, that is, the working process of the class, and explains the core data structure of the delete_helper class - the cache component that caches the memory addresses of business data. The following description should be referred to simultaneously with Figure 1 and Figure 2 as shown.

[0055] In this Step 11, the init interface is involved. The input parameter of the init interface is the pointer of the in-memory database (MDB, Memory Data Base). Tplmdb is a high-performance templated in-memory database and can be a trigger function customized for business data. The role of the Init interface is to register the customized trigger function into the in-memory database. When business data is inserted into the in-memory database, the trigger fires a callback to obtain the memory address where the newly inserted business data is located, and stores the obtained memory address in the cache of the delete_helper class.

[0056] In the cache, the addresses are sorted in ascending order according to the create_time field of the business data. The create_time field is a field added for the data that needs to be dynamically deleted. The create_time field is used to record the insertion time of this piece of business data in memory. Its function is to sort the addresses of the business data in the cache for subsequent operations.

[0057] Step 12: Initialize a timer according to the set time, and regularly check for expired memory data.

[0058] Each time of checking, call the get_biz_data interface of the delete_helper class to obtain the internally maintained cache. Since the memory addresses of the business data are maintained in the delet_helper cache in ascending order according to the create_time field, when traversing the cache to find expired data, if there is expired data, there is at least one time interval of the expired data.

[0059] In this Step 12, it involves the get_biz_data interface of the delete_helper class, and this interface is used in the main process. The main process obtains the memory addresses of all business data through the get_biz_data interface, and then the main process traverses these data to check for expired business data according to whether the existence duration of these data in memory exceeds the duration set by the timer.

[0060] Step 13: Delete the checked expired memory data in the main process, update the values of the begin_time and end_time of the delete_biz_field field, and then send the delete_biz_field field to other processes to notify other processes that they need to synchronize the deletion operation of the expired data.

[0061] This data structure of the delete_biz_field field (i.e., the data deletion field) is used to notify other processes which business data need to be deleted in memory. This data structure consists of three fields. type represents the type of business data, and time_begin and time_end combine to form a time interval [time_begin, time_end], indicating the deletion range of this type of business data, that is, the business data whose creation time is within this interval needs to be deleted.

[0062] The synchronization processing of data in other processes is as Figure 4 shown below. The following describes each processing step of other processes.

[0063] Step 21: When the current process starts, it performs initialization and passes the memory database address of the current process into the init interface of the delete_helper class to initialize the delete_helper class, so that the delete_helper class can maintain the memory addresses of the newly added business data.

[0064] Step 22: During the running of the current process, it receives the delete_biz_field sent by the main process and realizes the synchronous deletion of expired data in the current process by calling the delete_biz_data interface.

[0065] delete_biz_field is the data structure used by the main process to publish deletion information to other processes. The interface of the delete_helper class called by other processes after receiving the information is delete_biz_data, and the parameter passed to the delete_biz_data interface is: delete_biz_field&f.

[0066] The delete_biz_data interface of the delete_helper class is used in other processes except the main process. When the current process of one of the other processes receives the message of synchronous deletion published by the main process, it calls the delete_biz_data interface, traverses the cache in the current process, and deletes all business data within the deletable range to realize the synchronous deletion of expired data in the current process.

[0067] Figure 5 Illustrates the principle of an embodiment of the memory management system of the present invention. Please refer to Figure 5 , The system of this embodiment is applied to the scenario of data synchronous deletion in multiple processes, including: a main process data deletion module and a process synchronization module.

[0068] The main process data deletion module is configured as follows: When the main process starts, it performs initialization operations, initializes the data management class based on the pointer of the memory database maintained by the main process, so that the data management class maintains the memory addresses of the newly added data. The data management class is used to manage the classes that need to dynamically delete data; The main process initializes a timer according to the set time, regularly checks for expired memory data; Deletes the checked expired memory data in the main process, and notifies other processes through the data management class that they need to synchronize the deletion operation of the expired data.

[0069] The process synchronization module is configured such that a current process among other processes performs initialization when starting up, initializes a data management class based on the pointer of the in-memory database of the current process, so that the data management class maintains the memory addresses of newly added business data; during the operation of the current process, it receives the value of the data deletion field sent by the main process, and processes the synchronous deletion of expired data in the current process by calling the data management class.

[0070] In the configuration of the main process data deletion module, the main process performs an initialization operation when starting up, passes the pointer of the in-memory database maintained by the main process into the init interface of the delete_helper class, and initializes the delete_helper class, so that the delete_helper class can maintain the memory addresses of newly added business data.

[0071] The delete_helper class is a class that manages business data that needs to be dynamically deleted, and can also be called a data management class, which is used in each process that needs to dynamically delete business data.

[0072] The class diagram of the delete_helper class is Figure 1 , which introduces the interfaces of the delete_helper class and describes the scenarios where the main process and other processes use the interfaces of this class. It can be seen from this that the delete_helper class provides three interfaces for the program to call, namely the init interface, the get_biz_data interface (i.e., the data acquisition interface), and the delete_biz_data interface (i.e., the data deletion interface). In actual business scenarios, the business data structures are different. Therefore, in this embodiment, the business data that needs to be dynamically deleted is abstractly expressed as biz_field (i.e., the business data structure, abbreviated as biz). When actually applying this embodiment, biz_field can be replaced with the specific business data structure that needs to be deleted in the system.

[0073] Figure 2 shows the structure of the delete_helper class, that is, the working process of the class, and explains the core data structure of the delete_helper class - the cache component that caches the memory addresses of business data. The following description should be referred to simultaneously with Figure 1 and Figure 2 as shown.

[0074] The input parameter of the init interface is a pointer to a memory database (MDB, Memory Data Base). Tplmdb is a high-performance templatized memory database, and it can be a trigger function customized for business data. The role of the Init interface is to register the customized trigger function into the memory database. When business data is inserted into the memory database, the trigger fires a callback, obtains the memory address where the newly inserted business data is located, and stores the obtained memory address in the cache of the delete_helper class.

[0075] In the cache, the addresses are sorted in ascending order according to the create_time field of the business data. The create_time field is a field added for data that needs to be dynamically deleted. The create_time field is used to record the insertion time of this piece of business data in memory, and its role is to sort the addresses of business data in the cache for subsequent operations.

[0076] In the configuration of the main process data deletion module, a timer is initialized according to the set time to periodically check for expired memory data.

[0077] Each time it is checked, the get_biz_data interface of the delete_helper class is called to obtain the internally maintained cache. Since the memory addresses of business data are maintained in the delet_helper cache in ascending order according to the create_time field, when traversing the cache to find expired data, if there is expired data, there is at least one time interval of expired data.

[0078] The get_biz_data interface of the delete_helper class is used in the main process. The main process obtains the memory addresses of all business data through the get_biz_data interface, and then the main process traverses these data to check for expired business data according to whether the existence duration of these data in memory exceeds the duration set by the timer.

[0079] In the configuration of the main process data deletion module, expired memory data detected is deleted in the main process, and the values of begin_time and end_time in the delete_biz_field field are updated. Then, the delete_biz_field field is sent to other processes to notify them that they need to synchronize the deletion operation of expired data. This data structure of the delete_biz_field field (i.e., the data deletion field) is used to notify other processes which business data needs to be deleted in memory. This data structure consists of three fields. type represents the type of business data, and time_begin and time_end form a time interval [time_begin, time_end], indicating the deletion range of business data of this type, that is, business data with a creation time within this interval needs to be deleted.

[0080] In the configuration of the process synchronization module, when the current process starts, it performs initialization and passes the memory database address of the current process into the init interface of the delete_helper class to initialize the delete_helper class, so that the delete_helper class can maintain the memory addresses of newly added business data.

[0081] In the configuration of the process synchronization module, when the current process is running and receives the delete_biz_field sent by the main process, it calls the delete_biz_data interface to synchronously delete expired data in the current process. The delete_biz_field is the data structure used by the main process to publish deletion information to other processes. The interface of the delete_helper class called by other processes after receiving the information is delete_biz_data, and the parameter passed to the delete_biz_data interface is: delete_biz_field&f. The delete_biz_data interface of the delete_helper class is used in other processes except the main process. When the current process of one of the other processes receives the message of synchronous deletion published by the main process, it calls the delete_biz_data interface, traverses the cache in the current process, and deletes all business data within the deletable range to achieve the synchronous deletion of expired data in the current process.

[0082] The technical solution of the present invention has been applied to an actual financial derivatives trading software. The trading software has high requirements for system capacity. The components of the present invention can complete the dynamic deletion of business data with extremely low self-overhead, thereby expanding the system capacity. For example, the dynamic deletion of order and quote data. During a day's trading process, the number of orders and quotes is constantly increasing. Of course, the memory occupation of these business data also increases linearly.

[0083]

[0084] The above table is an example of the statistical situation of the relationship between the order quantity and the occupied memory size in each process of the market maker background of the trading software.

[0085] In a specific application example as shown in the above table, the orders stored in the memory, after several state changes, finally become the final state orders, that is, the order state no longer changes. This type of data is no longer accessed by the process and there is no need to store it in the memory. Therefore, the business data memory management method described in the present invention can be used. The main process for background management of order information is the trading module. It traverses the order information in the memory, finds the final state orders whose storage time exceeds the configured time, deletes them, and synchronizes the deletion action to other processes to complete a complete deletion action.

[0086] Although the above methods are illustrated and described as a series of actions for simplicity of explanation, it should be understood and appreciated that these methods are not limited by the order of the actions. Because according to one or more embodiments, some actions may occur in a different order and / or concurrently with other actions not illustrated and described herein but understood by those skilled in the art.

[0087] Those skilled in the art will further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the embodiments disclosed herein can be implemented as electronic hardware, computer software, or a combination of both. To clearly illustrate this interchangeability of hardware and software, the various illustrative components, boxes, modules, circuits, and steps are described above in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the particular application and the design constraints imposed on the overall system. Skilled artisans may implement the described functionality in different ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.

[0088] The various illustrative logical blocks, modules, and circuits described in connection with the embodiments disclosed herein can be implemented or performed with a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration.

[0089] The steps of a method or algorithm described in connection with the embodiments disclosed herein can be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such that the processor can read from, and write to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In the alternative, the processor and the storage medium may reside as discrete components in a user terminal.

[0090] In one or more exemplary embodiments, the described functionality may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software as a computer program product, the functions may be stored on or transmitted via a computer-readable medium as one or more instructions or code. The computer-readable medium includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. The storage media may be any available media that can be accessed by a computer. By way of example and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. Any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a web site, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. As used herein, disk and disc include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk, and Blu-ray disc where disks typically reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0091] The foregoing description of the disclosure has been provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other variations without departing from the spirit or scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A memory management method, characterized in that, it is applied to the scenario of data synchronization deletion in multiple processes. The method includes data deletion processing in the main process and synchronization processing of deleted data in other processes, where: The data deletion processing in the main process includes: When the main process starts, it performs an initialization operation, initializes the data management class based on the pointer of the memory database maintained by the main process, so that the data management class maintains the memory addresses of newly added data. The data management class is used to manage classes that need to dynamically delete data; The main process initializes a timer according to the set time, and regularly checks for expired memory data; In the main process, the detected expired memory data is deleted, and the data management class is used to notify other processes of the need to synchronize the deletion operation of expired data; The synchronization processing of deleted data in other processes includes: When a current process among other processes starts, it performs an initialization. Based on the pointer of the memory database of this current process, the data management class is initialized, so that the data management class maintains the memory addresses of newly added business data; During the operation of the current process, it receives the value of the deleted data field sent by the main process, and processes the synchronous deletion of expired data in the current process by calling the data management class.

2. The memory management method according to claim 1, characterized in that, An initialization interface is set in the data management class. The process of initializing the data management class based on the pointer of the memory database maintained by the main process further includes: passing the pointer of the memory database maintained by the main process into the initialization interface of the data management class to initialize the data management class.

3. The memory management method according to claim 1, characterized in that, The step of initializing a timer according to the set time and regularly checking for expired memory data further includes: The main process calls the data acquisition interface of the data management class to obtain the memory addresses of all data from the cached data of the data management class, and then by traversing all the obtained data, according to the size relationship between the duration of the data existing in the memory and the duration set by the timer, the expired data is checked.

4. The memory management method according to claim 1, characterized in that, The process of the main process notifying other processes of the need to synchronize the deletion operation of expired data through the data management class further includes: The main process updates the value of the time interval of the deleted data field set in the data management class, and then sends the deleted data field to other processes to notify other processes of the need to synchronize the deletion operation of expired data.

5. The memory management method according to claim 1, characterized in that, When a current process among other processes starts, it performs an initialization. The process of initializing the data management class based on the pointer of the memory database of this current process further includes: This current process passes its memory database address as a pointer into the initialization interface of the data management class to initialize the data management class.

6. The memory management method according to claim 1, characterized in that, When the current process receives the value of the deleted data field sent by the main process and processes the synchronous deletion of expired data in the current process by calling the data management class, it further includes: The current process receives the value of the data deletion field sent by the main process and calls the data deletion interface of the data management class. The data deletion field is the data structure used by the main process to publish deletion information to other processes. The data deletion interface of the data management class is used in other processes except the main process to traverse the cache in the current process and delete all data within the deletable range to handle the synchronous deletion of expired data in the current process.

7. A memory management system, characterized in that, it is applied to the scenario of data synchronous deletion in multiple processes. The system includes a main process data deletion module and a process synchronization module, where: The main process data deletion module is configured as: When the main process starts, it performs an initialization operation, initializes the data management class based on the pointer of the memory database maintained by the main process, so that the data management class maintains the memory addresses of newly added data. The data management class is used to manage classes that need to dynamically delete data; The main process initializes a timer according to the set time and regularly checks for expired memory data; In the main process, the detected expired memory data is deleted, and the data management class is used to notify other processes of the need to synchronize the deletion operation of expired data; The process synchronization module is configured as: When a current process in other processes starts, it performs an initialization, initializes the data management class based on the pointer of the memory database of the current process, so that the data management class maintains the memory addresses of newly added business data; During the operation of the current process, it receives the value of the data deletion field sent by the main process and processes the synchronous deletion of expired data in the current process by calling the data management class.

8. The memory management system according to claim 7, characterized in that, In the configuration of the main process data deletion module, the process of initializing the data management class based on the pointer of the memory database maintained by the main process further includes: passing the pointer of the memory database maintained by the main process into the initialization interface of the data management class to initialize the data management class, where the initialization interface is the interface set by the data management class.

9. The memory management system according to claim 7, characterized in that, In the configuration of the main process data deletion module, the main process initializes a timer according to the set time and regularly checks for expired memory data further includes: The main process calls the data acquisition interface of the data management class to obtain the memory addresses of all data from the cached data of the data management class, and then checks for expired data by traversing all the obtained data and comparing the duration of the data's existence in memory with the duration set by the timer.

10. The memory management system according to claim 7, characterized in that, In the configuration of the main process data deletion module, the process of the main process notifying other processes of the need to synchronize the deletion operation of expired data through the data management class further includes: The main process updates the value of the time interval of the data deletion field set in the data management class, and then sends the data deletion field to other processes to notify other processes of the need to synchronize the deletion operation of expired data.

11. The memory management system according to claim 7, characterized in that, In the configuration of the process synchronization module, when a current process in other processes starts, it performs initialization. The process of initializing the data management class based on the pointer of the in-memory database of the current process further includes: The current process passes its in-memory database address as a pointer to the initialization interface of the data management class to initialize the data management class.

12. The memory management system according to claim 7, characterized in that in the configuration of the process synchronization module, the current process receives the value of the data deletion field sent by the main process, and processes the synchronous deletion of expired data in the current process by calling the data management class, further including: The current process receives the value of the data deletion field sent by the main process and calls the data deletion interface of the data management class. The data deletion field is the data structure used by the main process to publish deletion information to other processes. The data deletion interface of the data management class is used in other processes except the main process to traverse the cache in the current process and delete all data within the deletable range to process the synchronous deletion of expired data in the current process.

Citation Information

Patent Citations

  • Method and system for data cleaning suitable for mass storage

    CN103353892A

  • Multiprocessor, cache synchronization control method and program therefor

    US20110047335A1