WO2007109920A1 - A method for constructing and using a memory pool - Google Patents

A method for constructing and using a memory pool Download PDF

Info

Publication number
WO2007109920A1
WO2007109920A1 PCT/CN2006/000515 CN2006000515W WO2007109920A1 WO 2007109920 A1 WO2007109920 A1 WO 2007109920A1 CN 2006000515 W CN2006000515 W CN 2006000515W WO 2007109920 A1 WO2007109920 A1 WO 2007109920A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
memory block
free
block
pool
Prior art date
Application number
PCT/CN2006/000515
Other languages
French (fr)
Chinese (zh)
Inventor
Chuan Ye
Xinghua Li
Yuanqing Shi
Original Assignee
Zte Corporation
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zte Corporation filed Critical Zte Corporation
Priority to PCT/CN2006/000515 priority Critical patent/WO2007109920A1/en
Publication of WO2007109920A1 publication Critical patent/WO2007109920A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/04Addressing variable-length words or parts of words

Definitions

  • the present invention relates to memory pool construction and methods of use. Background technique
  • the current software system requires less memory copying, less memory loss and leakage, memory management and use to be more versatile, reduce software system development difficulty and development cost, and improve the efficiency and stability of the software system.
  • the Chinese patent publication CN03148892 proposes a memory management method in which a memory pool is created by an application, a memory pool is divided into a control domain for storing control information, a memory block storage area for placing data, and a usage state of each memory is indicated.
  • a chain of tokens that can be indexed by a memory block.
  • the application requests, returns, and modifies the information in the memory usage token chain from the memory pool based on the control information in the memory pool control domain.
  • This patent has a simple organization of the memory pool, and the structure of the memory block is single, which is likely to cause performance problems when the application uses the memory block.
  • the Chinese patent with the publication number CN02151120 also proposes a method of memory management.
  • the memory management method proposed by the patent includes the following steps:
  • Patent A does not mention the organization of the memory pool and how the application uses the memory block. It only describes the header information of the memory block and the construction of the data area. And when the method needs to increase the header information, the pointer is moved forward in the free area to increase the length of the header information, and then the header information is added. This invisibly reduces the available space in the data area, and the application may cause an exception such as memory out of bounds when using the memory block. Summary of the invention
  • the problem to be solved by the present invention is to propose a construction and use method of a memory pool to simplify memory management and avoid memory leaks and memory clutter.
  • the present invention provides a method of constructing and using a memory pool, including the following steps:
  • each memory pool includes one or more memory blocks of the same size, each memory pool has a management structure, and the memory blocks in the memory pool are saved and used.
  • Situation information and address information of the free memory block each memory block is divided into a data body and a memory header for marking the usage of the memory block;
  • the memory management module After receiving the memory request, uses the requested memory size plus the memory header size as the minimum memory block size to be allocated, and selects a memory pool that satisfies the requirements;
  • the memory management module receives the memory release request, indicating the memory block pointer to the data body to be returned, and biasing the pointer After shifting the length of a memory header, find the corresponding memory header;
  • the usage flag in the memory header is changed to idle, and the memory block usage information and the free memory block address information in the memory pool management structure to which the memory block belongs are updated, and the release ends.
  • the foregoing method may further have the following features: the free memory block in each memory pool adopts a queue structure of a unidirectional linked list or a doubly linked list, and the memory header of the free memory block records the memory of the next free memory block in the queue.
  • step (c) the free memory in the management structure is The free memory block pointed to by the block queue head pointer is allocated, and after the allocation, the free memory block queue head pointer is changed to the memory head of the next free memory block in the queue; when (f) the memory is released, the The free memory block queue tail pointer in the management structure is changed to point to the memory header of the newly added free memory block, and the last free memory block in the original queue is linked with the newly added free memory block.
  • the memory block size in each memory pool is 2 n bytes, and n is a positive integer.
  • the management structure of each memory pool is set in a specified area of the memory.
  • the foregoing method may further have the following features: in the step (b), selecting a memory in which the memory block is the smallest from a memory pool whose memory block size is larger than the minimum memory size to be allocated according to the minimum memory size to be allocated. If the pool is not selected, the application fails and ends.
  • the memory pool management structure further stores information about the number of reserved memory blocks, and the number of free memory blocks in the step (c) is greater than the number of reserved memory blocks. , it means there are free memory blocks that can be allocated. Otherwise, there are no free memory blocks available for allocation. .
  • the foregoing method may further have the following features: the step (e) further checks the validity of the memory block pointer to be returned, and after the memory pointer is offset by the length of the memory header, if the pointer is in the If the memory block to be returned is within the memory pool range, it is legal. Otherwise, it is illegal, and the error message is returned.
  • the foregoing method may further have the following features: In the process of applying for or releasing the memory, before the operation of the memory pool management structure or the memory block, the semaphore protection is added, and after the operation, the semaphore protection is released. .
  • the memory head is further configured to store information about a process or task that requests or returns a memory block in which the memory head is located.
  • the above method may further have the following features: In the step (f), first determining whether the usage flag in the memory header indicates that the memory block is "used", and if so, changing it to "Idle" and proceed with subsequent operations, otherwise, an error message is returned, ending. .
  • the method of the present invention details the organization of the memory pool and memory blocks and the steps by which the application uses the memory blocks. It simplifies the memory management requirements in the software system and can prevent memory leaks and memory clutter in the software system.
  • the header information of the memory block and the message data area are separated from each other, and the addition or subtraction of the header information does not affect the memory block message data area.
  • the method of the present invention can be used, for example, in mobile terminals, network side switching devices, and the like, particularly supporting subsystems. BRIEF abstract
  • FIG. 1 is a schematic structural diagram of a memory pool structure according to an embodiment of the present invention.
  • FIG. 2 is a flow chart of a user applying for a memory block according to an embodiment of the present invention.
  • FIG. 3 is a flowchart of a user releasing a memory block according to an embodiment of the present invention.
  • Each memory pool includes multiple memory blocks.
  • the memory block UB size UBBlockSize in the same memory pool TJJBPool is the same.
  • the size of the memory block in each memory pool increases from 16 bytes in multiples of 2, such as 16 bytes, 32 words. Section, 64 bytes, ..., 8192 bytes.
  • a memory pool management structure is set for each memory pool in the specified area of memory, which includes the following information:
  • UReserverCount The number of memory blocks reserved by the memory pool (UBReserverCount), a certain number of memory blocks can be reserved to warn in advance when there is a certain number of free memory blocks to prevent system errors. This information is optional.
  • Free memory block queue tail pointer (UBFreeTail), the memory header pointing to the last free memory block in the free memory block list (refer to the first address of the memory header, the same below);
  • Each memory pool contains a number of memory blocks in a contiguous memory space, each memory block consisting of a memory header (UBHead) and an adjacent data body (UserDataPtr), one memory block data area immediately following the next memory block Memory header.
  • the data body is a memory area that can be used by the user for application.
  • the user program obtains the allocated data body pointer (pointing to its first address) by calling the interface of the application memory block (ie, the API function provided by the memory management module), and can be in the memory area. In the middle of the operation.
  • the memory header (UBHead) of all memory blocks is the same size and contains the following information:
  • the index value of the memory pool where the memory block is located can be quickly located in the memory pool according to the index value when the memory block is returned, avoiding traversing the memory pool from beginning to end in the memory management module, thereby improving the operation efficiency;
  • the memory block uses the flag (MEM_BLOCKJJSED), which is used or idle; ..
  • next memory head pointer For a free memory block, the pointer should point to the memory head pointer of the next free memory block to form a singly linked list of free memory blocks. In another embodiment, a singly linked list of memory blocks that are already allocated by the application may be added.
  • the free memory blocks in the memory pool are organized by means of a singly linked list.
  • all the memory blocks are idle, and the pointers in the memory header of each memory block point downwards.
  • An adjacent memory block when allocating memory, is allocated from the first free memory block in the free memory block list, and the free memory block queue header pointer in the memory pool management structure is modified to point to the linked list.
  • the memory head of the next free memory block When the memory is released, it will be released
  • the memory block is added to the end of the free memory block, and the free memory block queue tail pointer in the memory pool management structure and the memory head pointer in the original free memory block memory header in the linked list are modified to point to the newly added memory block.
  • the memory header of a free memory block When the initial unallocated, all the memory blocks are idle, and the pointers in the memory header of each memory block point downwards.
  • An adjacent memory block when allocating memory, is allocated from the first free memory block in the free memory block list, and the free memory block queue header pointer in
  • two memory head pointers may also be set in the memory header of each memory block, so that the two pointers in the free memory block point to the memory block and the next memory block memory of the previous memory block respectively.
  • the header thus forming a doubly linked list of free memory blocks, is more flexible when allocating free memory blocks.
  • the memory management module implements the following processing flow. As shown in FIG. 2, the following steps are included:
  • Step 100 the user (referring to the application) makes a memory application request, and the input parameter indicates the size of the memory block to be used;
  • Step 110 After receiving the request for the memory, the memory management module determines the legality of the input parameter, and adds the requested memory size and the memory header size as the minimum memory size to be allocated, and determines whether the memory size is Greater than the size of the existing maximum memory block (8192 bytes), if yes, perform the next step, otherwise the allocation fails and ends;
  • Step 120 Select, according to the minimum memory size to be allocated, a memory pool in which the memory block is the smallest from a memory pool whose memory block size is larger than the minimum memory size to be allocated;
  • Step 130 adding semaphore protection to prevent other applications from simultaneously operating the memory;
  • Step 140 determining whether the number of free memory blocks in the selected memory pool management structure is too larger than the number of memory blocks reserved in the memory pool, if , the next step, otherwise, the allocation fails, the end; the reason for reserving the memory block is: a, for some operating systems without memory boundary checking, such as vxworks, threadx, etc., once the application uses the memory block out of bounds, you can write We reserve the memory block to prevent the system from crashing. b. Although the reserved memory block is not used, the reserved value can be used as the threshold used by the memory pool. Once the threshold is reached, the system can alert and not The system is running abnormally because the memory blocks in the memory pool are exhausted.
  • Step 150 Find a free memory block queue head pointer from the management structure of the memory pool, and locate a memory head start position of the first free memory block in the free memory block linked list.
  • Step 160 Fill in the information in the memory header, including the process (or task) information (GetUser) of applying for the memory block, and set the memory block usage flag (MEM_BLOCK_USED) to be used;
  • Step 170 update the memory.
  • the information in the pool management structure updates the free memory block queue head pointer in the management structure to the next memory head pointer in the memory block memory header, and decrements the number of free memory blocks, and the number of successfully allocated memory blocks is incremented. ; - Step 180, release semaphore protection;
  • Step 190 Return the allocated memory block address, which should be the data body pointer of the allocated free memory block, and end.
  • Step 200 the user proposes a memory release request, indicating a memory block pointer (pointing to the data body) to be returned, and the pointer points to the memory block data body;
  • Step 210 The memory management module checks the validity of the memory pointer to be returned, offsets the input memory pointer by a length of the memory header, and determines whether the memory head pointer is within the memory pool of the memory block to be returned. If yes, go to the next step, otherwise, return an error message and end;
  • Step 220 Find a corresponding memory head according to the offset memory head pointer.
  • Step 230 determining whether the memory block usage flag indicates that the memory block is available, and if yes, returning an error message, ending, otherwise, performing the next step;
  • step 240 calling the system semaphore call (VOS_Sema-P) to enter the semaphore protection of the memory management module;
  • Step 250 Set a memory block usage flag in the memory head pointer to be idle, and fill in the memory head pointer to fill in the process (or task) information of the memory block;
  • Step 260 Update the free memory block queue tail pointer in the corresponding memory pool management structure to the memory head pointer, add one to the number of free memory blocks in the management structure, and make the last free memory block memory in the original free memory block linked list.
  • the next memory head pointer in the header points to the memory header newly added to the free memory block, that is, the last free memory block in the original queue is linked with the newly added free memory block;
  • Step 270 calling the system semaphore call to release the semaphore protection, and ending.
  • the method of the present invention describes the organization structure of the memory pool and the memory block and the method of using the memory block by the application, which simplifies the memory management requirements in the software system, and can prevent memory leakage and memory confusion in the software system, and can be used, for example.
  • the network side switching device In the supporting subsystem of the mobile terminal, the network side switching device, and the like.

Abstract

A method for constructing and using a memory pool, divides the memory as several memory pools, the memory pools have several memory blocks with same size. Each memory pool has a management structure, each memory block is divided into a memory header and a data body. The memory header records the using information of the memory block. When the system receives a request for the memory, it chooses a proper memory pool based on the total size of the requested memory and the memory header. After the free memory block which can be assigned is chose, it updates the use-state of the memory head and the use-information of the memory block in the manage structure and the address information of the free memory block. Then it returns the data body pointer of the free memory block to the user and ends the application of the memory. When releasing the memory, it moves the pointer of the released memory block a memory header length, and points it to a corresponding memory header. Rewrites the use-state of the said memory header as free, and updates the use-state of the memory block and the address of the free memory block in the manage structure. The present invention can simplify the memory management, prevent the leak of the memory and the confusion of the memory.

Description

一种内存池的构造和使用方法  A memory pool construction and use method
技术领域 Technical field
本发明涉及内存池构造和使用方法。 背景技术  The present invention relates to memory pool construction and methods of use. Background technique
目前通信设备的软件系统的复杂日趋增加, 对内存使用和管理的要求也 水、涨船高。现在的软件系统对内存的使用要求减少内存拷贝次数, 减少内存 流失和泄漏, 内存管理和使用要做到通用性强, 降低软件系统开发难度和开 发成本, 提高软件系统的工作效率和稳定性。  At present, the complexity of the software system of communication equipment is increasing, and the requirements for memory usage and management are also high. The current software system requires less memory copying, less memory loss and leakage, memory management and use to be more versatile, reduce software system development difficulty and development cost, and improve the efficiency and stability of the software system.
公开号为 CN03148892的中国专利提出了一种内存管理方法, 由应用程 序创建内存池, 将内存池划分为存储控制信息的控制域、 放置数据的内存块 存储区、 标示每块内存的使用状态和可用内存块索引的标记链。 应用程序根 据内存池控制域中的控制信息向内存池申请、 归还内存块并修改内存使用标 记链中信息。 该专利对内存池的组织简陋, 内存块的结构单一, 容易造成应 用程序使用内存块时出现性能问题。  The Chinese patent publication CN03148892 proposes a memory management method in which a memory pool is created by an application, a memory pool is divided into a control domain for storing control information, a memory block storage area for placing data, and a usage state of each memory is indicated. A chain of tokens that can be indexed by a memory block. The application requests, returns, and modifies the information in the memory usage token chain from the memory pool based on the control information in the memory pool control domain. This patent has a simple organization of the memory pool, and the structure of the memory block is single, which is likely to cause performance problems when the application uses the memory block.
公开号为 CN02151120的中国专利也提出了一种内存管理的方法。 该专 利提出的内存管理方法包括如下步骤:  The Chinese patent with the publication number CN02151120 also proposes a method of memory management. The memory management method proposed by the patent includes the following steps:
a、 预先申请一块内存作为内存池, 划分内存块并进行初始化, 申请的 内存块从内存池头部取, 释放的内存块存放在内存池尾部;  a. Applying a block of memory as a memory pool in advance, dividing the memory block and initializing it, the applied memory block is taken from the memory pool header, and the released memory block is stored at the end of the memory pool;
b、 在所述内存块中设置一个空闲区, 用于添加头部信息使用, 消息区 设置在所述内存块的空闲区后;  b. setting a free area in the memory block for adding header information, and setting a message area after the free area of the memory block;
c、 当需要增加头部信息时, 在所述空闲区将指针前移需要增加的头部 信息长度, 然后添加头部信息;  c. When it is necessary to increase the header information, move the pointer forward in the free area to increase the length of the header information, and then add the header information;
d、 读取头部信息时, 将指针移动到空闲区的相应位置读取需要的信息。 专利 A没有提及内存池的组织结构和应用程序如何使用内存块,只是描 述了内存块的头部信息和数据区的构造。 并且该方法在需要增加头部信息 时,在所述空闲区将指针前移需要增加的头部信息长度,然后添加头部信息。 这无形中减少了数据区的可用空间, 应用程序在使用内存块时可能会造成内 存越界等的异常。 发明内容 d. When reading the header information, move the pointer to the corresponding position in the free area to read the required information. Patent A does not mention the organization of the memory pool and how the application uses the memory block. It only describes the header information of the memory block and the construction of the data area. And when the method needs to increase the header information, the pointer is moved forward in the free area to increase the length of the header information, and then the header information is added. This invisibly reduces the available space in the data area, and the application may cause an exception such as memory out of bounds when using the memory block. Summary of the invention
本发明要解决的问题是提出一种内存池的构造和使用方法, 以简化内存 管理, 避免发生内存泄漏和内存混乱。  The problem to be solved by the present invention is to propose a construction and use method of a memory pool to simplify memory management and avoid memory leaks and memory clutter.
为了解决以上问题, 本发明提供了一种内存池的构造和使用方法, 包括 以下步骤:  In order to solve the above problems, the present invention provides a method of constructing and using a memory pool, including the following steps:
(a) 将内存划分为若干个的内存池, 每个内存池中包括一个或多个大 小相同的内存块, 每一内存池设有一个管理结构, 保存了该内存池中内存块 及其使用情况信息以及空闲内存块的地址信息, 每个内存块划分为数据体和 用于标记该内存块使用情况的内存头;  (a) Divide memory into several memory pools, each memory pool includes one or more memory blocks of the same size, each memory pool has a management structure, and the memory blocks in the memory pool are saved and used. Situation information and address information of the free memory block, each memory block is divided into a data body and a memory header for marking the usage of the memory block;
(b) 内存管理模块收到内存申请后, 将申请的内存大小加上内存头大 小作为要分配的最小内存块大小, 选择一个可满足要求的内存池;  (b) After receiving the memory request, the memory management module uses the requested memory size plus the memory header size as the minimum memory block size to be allocated, and selects a memory pool that satisfies the requirements;
(c) 根据选定内存池管理结构中的内存块使用情况判断是否还有可分 配的空闲内存块, 如果有, 选择一个空闲内存块分配, 将该空闲内存块标记 为"已使用", 并更新该管理结构中内存块使用情况信息和空闲内存块的地址 信息;  (c) judging whether there are any free memory blocks that can be allocated according to the memory block usage in the selected memory pool management structure, if so, selecting a free memory block allocation, marking the free memory block as "used", and Updating memory block usage information and address information of the free memory block in the management structure;
(d)将分配的所述空闲内存块的数据体指针返回给用户, 申请结束; (e) 内存管理模块收到内存释放请求, 指明要归还的指向数据体的内 存块指针, 将该指针偏移一个内存头的长度后, 找到相应的内存头;  (d) returning the data body pointer of the allocated free memory block to the user, and the application ends; (e) the memory management module receives the memory release request, indicating the memory block pointer to the data body to be returned, and biasing the pointer After shifting the length of a memory header, find the corresponding memory header;
(0将该内存头中的使用标志改为空闲, 同时更新该内存块所属内存池 管理结构中的内存块使用情况信息和空闲内存块地址信息, 释放结束。  (0) The usage flag in the memory header is changed to idle, and the memory block usage information and the free memory block address information in the memory pool management structure to which the memory block belongs are updated, and the release ends.
进一步地, 上述方法还可具有以下特点: 所述每个内存池中的空闲内存 块采用单向链表或双向链表的队列结构, 空闲内存块的内存头记录了队列中 下一空闲内存块的内存头指针, 且在每个内存池管理结构中保留了该空闲内 存块队列头和队列尾的指针; 步骤 (c) 中, 是将所述管理结构中空闲内存 块队列头指针所指向的空闲内存块进行分配, 并在分配后将空闲内存块队列 头指针改为指向队列中下一空闲内存块的内存头; 步骤(f)释放内存时, 还 将所述管理结构中的空闲内存块队列尾指针改为指向该新加入的空闲内存 块的内存头, 并将原队列中最后一个空闲内存块与该新加入的空闲内存块相 链接。 Further, the foregoing method may further have the following features: the free memory block in each memory pool adopts a queue structure of a unidirectional linked list or a doubly linked list, and the memory header of the free memory block records the memory of the next free memory block in the queue. a head pointer, and a pointer of the free memory block queue header and the queue tail is retained in each memory pool management structure; in step (c), the free memory in the management structure is The free memory block pointed to by the block queue head pointer is allocated, and after the allocation, the free memory block queue head pointer is changed to the memory head of the next free memory block in the queue; when (f) the memory is released, the The free memory block queue tail pointer in the management structure is changed to point to the memory header of the newly added free memory block, and the last free memory block in the original queue is linked with the newly added free memory block.
进一步地, 上述方法还可具有以下特点: 所述各个内存池中的内存块大 小是 2n个字节, n为正整数。 Further, the foregoing method may further have the following features: The memory block size in each memory pool is 2 n bytes, and n is a positive integer.
进一步地, 上述方法还可具有以下特点: 所述各个内存池的管理结构集 中设置在内存的某一指定区域。  Further, the above method may further have the following features: The management structure of each memory pool is set in a specified area of the memory.
进一步地, 上述方法还可具有以下特点: 所述步骤(b) 中是根据要分 配的最小内存大小, 从内存块大小大于要分配的最小内存大小的内存池中选 择其中内存块最小的一个内存池, 如选择不到, 则申请失败, 结束。  Further, the foregoing method may further have the following features: in the step (b), selecting a memory in which the memory block is the smallest from a memory pool whose memory block size is larger than the minimum memory size to be allocated according to the minimum memory size to be allocated. If the pool is not selected, the application fails and ends.
进一步地, 上述方法还可具有以下特点: 所述内存池管理结构中还保存 了预留内存块个数的信息, 所述步骤 (c) 中如空闲内存块数目大于该预留 内存块个数, 则表示还有可分配的空闲内存块, 否则, 无可供分配的空闲内 存块。 .  Further, the foregoing method may further have the following features: the memory pool management structure further stores information about the number of reserved memory blocks, and the number of free memory blocks in the step (c) is greater than the number of reserved memory blocks. , it means there are free memory blocks that can be allocated. Otherwise, there are no free memory blocks available for allocation. .
进一步地, 上述方法还可具有以下特点: 所述步骤 (e) 中还对要归还 的内存块指针进行合法性检査, 将该内存指针偏移一个内存头的长度后, 如 该指针在该待归还的内存块所在的内存池范围内, 则合法, 否则, 不合法, 返回错误信息, 结束。  Further, the foregoing method may further have the following features: the step (e) further checks the validity of the memory block pointer to be returned, and after the memory pointer is offset by the length of the memory header, if the pointer is in the If the memory block to be returned is within the memory pool range, it is legal. Otherwise, it is illegal, and the error message is returned.
进一步地, 上述方法还可具有以下特点: 在申请或释放内存的过程中, 在对内存池的管理结构或者内存块进行操作之前, 都先加入信号量保护, 在 操作之后, 再释放信号量保护。  Further, the foregoing method may further have the following features: In the process of applying for or releasing the memory, before the operation of the memory pool management structure or the memory block, the semaphore protection is added, and after the operation, the semaphore protection is released. .
进一步地, 上述方法还可具有以下特点: 所述内存头还用于保存有申请 或归还该内存头所在内存块的进程或任务的信息。  Further, the foregoing method may further have the following features: The memory head is further configured to store information about a process or task that requests or returns a memory block in which the memory head is located.
进一步地, 上述方法还可具有以下特点: 所述步骤(f)中,.先判断所述 内存头中的使用标志是否指示该内存块为 "已使用",如果是,再将其改为"空 闲"和进行后续操作, 否则, 返回错误信息, 结束。 . 本发明方法详细描述了内存池和内存块的组织结构及应用程序使用内 存块的步骤。 简化了软件系统中有关内存管理方面需求, 可以预防软件系统 中的内存泄漏和内存混乱的情况。把内存块的头部信息和消息数据区相互独 立出来, 头部信息的增、 减不会影响内存块消息数据区。 本发明方法可用于 例如移动终端, 网络侧交换设备等场合中, 特别是支撑子系统。 附图概述 Further, the above method may further have the following features: In the step (f), first determining whether the usage flag in the memory header indicates that the memory block is "used", and if so, changing it to "Idle" and proceed with subsequent operations, otherwise, an error message is returned, ending. . The method of the present invention details the organization of the memory pool and memory blocks and the steps by which the application uses the memory blocks. It simplifies the memory management requirements in the software system and can prevent memory leaks and memory clutter in the software system. The header information of the memory block and the message data area are separated from each other, and the addition or subtraction of the header information does not affect the memory block message data area. The method of the present invention can be used, for example, in mobile terminals, network side switching devices, and the like, particularly supporting subsystems. BRIEF abstract
图 1是本发明实施例、内存池构造的结构示意图。  FIG. 1 is a schematic structural diagram of a memory pool structure according to an embodiment of the present invention.
图 2是本发明实施例用户申请内存块时的流程图。  2 is a flow chart of a user applying for a memory block according to an embodiment of the present invention.
图 3是本发明实施例用户释放内存块时的流程图。 本发明的最佳实施方式  FIG. 3 is a flowchart of a user releasing a memory block according to an embodiment of the present invention. BEST MODE FOR CARRYING OUT THE INVENTION
现提出本发明应用于支撑子系统的实施例, 但本发明不限 f此。  The embodiment of the present invention applied to the support subsystem is now proposed, but the present invention is not limited thereto.
将内存分为若干个内存池, 内存池的构造请参照图 1。 每个内存池包括 多个内存块, 同一个内存池 TJJBPool中的内存块 UB大小 UBBlockSize相 同,各个内存池中内存块的大小从 16字节起按照 2的倍数增长,如 16字节、 32字节、 64字节、 ......、 8192字节。  Divide the memory into several memory pools. For the structure of the memory pool, please refer to Figure 1. Each memory pool includes multiple memory blocks. The memory block UB size UBBlockSize in the same memory pool TJJBPool is the same. The size of the memory block in each memory pool increases from 16 bytes in multiples of 2, such as 16 bytes, 32 words. Section, 64 bytes, ..., 8192 bytes.
在内存的指定区域为每个内存池设置了一个内存池管理结构, 该结构中 包括以下信息:  A memory pool management structure is set for each memory pool in the specified area of memory, which includes the following information:
♦ 内存池预留的内存块个数 (UBReserverCount) , 预留一定数量的内 存块可以在还有一定数量的空闲内存块时提前进行告警, 防止系统出错, 该 信息是可选的;  ♦ The number of memory blocks reserved by the memory pool (UBReserverCount), a certain number of memory blocks can be reserved to warn in advance when there is a certain number of free memory blocks to prevent system errors. This information is optional.
♦ 内存池中内存块总数 (UBBlockCount) ;  ♦ The total number of memory blocks in the memory pool (UBBlockCount);
♦ 内存池中的内存块大小 (UBBlockSize);  ♦ Memory block size in the memory pool (UBBlockSize);
♦ 内存池中空闲内存块数目 (UBFree) ;  ♦ Number of free memory blocks in the memory pool (UBFree);
♦ 该内存池的物理地址(UBBlockAddr) , 该地址指向该内存池第一个 内存块; ♦ 空闲内存块队列头指针(UBFreeHead),指向空闲内存块链表中第一 个空闲内存块的内存头(指内存头的首址, 下同) ; ♦ The physical address of the memory pool (UBBlockAddr), which points to the first memory block of the memory pool; ♦ Free memory block queue header pointer (UBFreeHead), which points to the memory header of the first free memory block in the free memory block list (refer to the first address of the memory header, the same below);
♦ 空闲内存块队列尾指针 (UBFreeTail) , 指向空闲内存块链表中最后 一个空闲内存块的内存头 (指内存头的首址, 下同) ;  ♦ Free memory block queue tail pointer (UBFreeTail), the memory header pointing to the last free memory block in the free memory block list (refer to the first address of the memory header, the same below);
♦ 已经成功分配的内存块个数 (UBBlockAllocCount) ; 以及分配内存 失败计数(UBBlockErrCount) 。  ♦ The number of memory blocks that have been successfully allocated (UBBlockAllocCount); and the allocated memory failure count (UBBlockErrCount).
每个内存池包含的若干内存块在一片连续的内存空间内, 每个内存块由 内存头 (UBHead) 和相邻的数据体(UserDataPtr) 组成, 一个内存块数据 区紧接着下一个内存块的内存头。 数据体就是可以供用户申请使用的内存 区,用户程序通过调用申请内存块的接口(即内存管理模块提供的 API函数) 获得分配的数据体指针 (指向其首址) , 就可以在该内存区中进行操作。 Each memory pool contains a number of memory blocks in a contiguous memory space, each memory block consisting of a memory header (UBHead) and an adjacent data body (UserDataPtr), one memory block data area immediately following the next memory block Memory header. The data body is a memory area that can be used by the user for application. The user program obtains the allocated data body pointer (pointing to its first address) by calling the interface of the application memory block (ie, the API function provided by the memory management module), and can be in the memory area. In the middle of the operation.
所有内存块的内存头 (UBHead)大小是一样的, 包含有以下信息: The memory header (UBHead) of all memory blocks is the same size and contains the following information:
♦ 申请该内存块的进程信息 (GetUser)和归还该内存块的进程信息 (RetUser), 可以是任务或迸程的标识号, 用于在调试或运行时对内存使用情 况的监测; ♦ The process information (GetUser) for requesting the memory block and the process information (RetUser) for returning the memory block, which may be the identification number of the task or the process, for monitoring the memory usage during debugging or runtime;
♦ 内存块所在的内存池的索引值,在归还该内存块时能够根据该索引值 迅速定位到所在内存池, 避免在内存管理模块中从头到尾地遍历内存池, 提 高运行效率;  ♦ The index value of the memory pool where the memory block is located can be quickly located in the memory pool according to the index value when the memory block is returned, avoiding traversing the memory pool from beginning to end in the memory management module, thereby improving the operation efficiency;
♦该内存块使用标志 (MEM— BLOCKJJSED) , 即已使用或空闲; .. ♦ The memory block uses the flag (MEM_BLOCKJJSED), which is used or idle; ..
♦ 下一内存头指针, 对于空闲内存块, 该指针应指向下一空闲内存块的 内存头指针, 以形成空闲内存块的单向链表。 在另一实施例中, 可以增加一 个由已经分配了, 正在被应用程序的内存块组成使用内存块的单向链表。 ♦ The next memory head pointer. For a free memory block, the pointer should point to the memory head pointer of the next free memory block to form a singly linked list of free memory blocks. In another embodiment, a singly linked list of memory blocks that are already allocated by the application may be added.
可以看出, 内存池中的空闲内存块是用单向链表的方式组织起来的, 在 初始未分配时, 所有内存块都是空闲的, 此时每个内存块内存头中的指针都 指向下一个相邻内存块, 在分配内存时, 都是从空闲内存块链表中的第一个 空闲内存块分配, 同时修改该内存池管理结构中的空闲内存块队列头指针, 使其指向链表中的下一个空闲内存块的内存头。 而在释放内存时, 则将释放 的内存块加入到空闲内存块的队尾, 修改该内存池管理结构中的空闲内存块 队列尾指针和该链表中原最后一个空闲内存块内存头中的内存头指针, 使其 指向该新加入的空闲内存块的内存头。 It can be seen that the free memory blocks in the memory pool are organized by means of a singly linked list. When the initial unallocated, all the memory blocks are idle, and the pointers in the memory header of each memory block point downwards. An adjacent memory block, when allocating memory, is allocated from the first free memory block in the free memory block list, and the free memory block queue header pointer in the memory pool management structure is modified to point to the linked list. The memory head of the next free memory block. When the memory is released, it will be released The memory block is added to the end of the free memory block, and the free memory block queue tail pointer in the memory pool management structure and the memory head pointer in the original free memory block memory header in the linked list are modified to point to the newly added memory block. The memory header of a free memory block.
在另一实施例中, 也可以在每个内存块的内存头中设置两个内存头指 针, 使空闲内存块中的该两个指针分别指向其上一内存块内存头和下一内存 块内存头, 从而构成一个空闲内存块的双向链表, 该链表在分配空闲内存块 时更加灵活一些。  In another embodiment, two memory head pointers may also be set in the memory header of each memory block, so that the two pointers in the free memory block point to the memory block and the next memory block memory of the previous memory block respectively. The header, thus forming a doubly linked list of free memory blocks, is more flexible when allocating free memory blocks.
用户申请内存块时, 不使用操作系统平台提供的内存管理功能, 由内存 管理模块实现以下处理流程, 如图 2所示, 包括以下步骤: When the user applies for a memory block, the memory management function provided by the operating system platform is not used. The memory management module implements the following processing flow. As shown in FIG. 2, the following steps are included:
步骤 100, 用户 (指应用程序)提出内存申请请求, 输入参数中指明所 要使用的内存块大小;  Step 100, the user (referring to the application) makes a memory application request, and the input parameter indicates the size of the memory block to be used;
步骤 110, 内存管理模块在收到用户申请内存的请求后, 判断输入参数 的合法性, 即将申请的内存大小和内存头大小相加, 作为此次需要分配的最 小内存大小,判断该内存大小是否大于已有最大内存块的大小(8192字节), 如果是, 执行下一步, 否则分配失败, 结束;  Step 110: After receiving the request for the memory, the memory management module determines the legality of the input parameter, and adds the requested memory size and the memory header size as the minimum memory size to be allocated, and determines whether the memory size is Greater than the size of the existing maximum memory block (8192 bytes), if yes, perform the next step, otherwise the allocation fails and ends;
步骤 120, 根据要分配的最小内存大小, 从内存块大小大于要分配的最 小内存大小的内存池中选择其中内存块最小的一个内存池;  Step 120: Select, according to the minimum memory size to be allocated, a memory pool in which the memory block is the smallest from a memory pool whose memory block size is larger than the minimum memory size to be allocated;
步骤 130, 加入信号量保护, 以防止其它应用程序同时操作该内存; 步骤 140, 判断选定内存池管理结构中的空闲内存块数目是否太于该内 存池预留的内存块个数, 如果是, 执行下一步, 否则, 分配失败, 结束; 预留内存块的原因是: a、 对于一些没有内存边界检查的操作系统, 如 vxworks, threadx等, 一旦应用程序使用内存块越界后, 可以写到我们预留 的内存块上, 防止系统崩溃; b、 虽然没有使用预留的内存块, 但可以把预 留值作为内存池使用的门限值, 一旦到达该门限后系统可以告警, 同时不会 因为内存池中内存块的耗尽而系统运行异常。  Step 130, adding semaphore protection to prevent other applications from simultaneously operating the memory; Step 140, determining whether the number of free memory blocks in the selected memory pool management structure is too larger than the number of memory blocks reserved in the memory pool, if , the next step, otherwise, the allocation fails, the end; the reason for reserving the memory block is: a, for some operating systems without memory boundary checking, such as vxworks, threadx, etc., once the application uses the memory block out of bounds, you can write We reserve the memory block to prevent the system from crashing. b. Although the reserved memory block is not used, the reserved value can be used as the threshold used by the memory pool. Once the threshold is reached, the system can alert and not The system is running abnormally because the memory blocks in the memory pool are exhausted.
步骤 150, 从该内存池的管理结构中査找到空闲内存块队列头指针, 定 位到空闲内存块链表中的第一个空闲内存块的内存头起始位置; 步骤 160, 填写该内存头中的信息, 包括申请该内存块.的进程(或任务) 信息 (GetUser), 设置该内存块使用标志 (MEM一 BLOCK—USED) 为已使用; 步骤 170, 更新内存池管理结构中的信息, 将管理结构中的空闲内存块 队列头指针更新为该内存块内存头中的下一内存头指针, 将空闲内存块数目 递减, 已经成功分配的内存块个数递加; - 步骤 180, 释放信号量保护; Step 150: Find a free memory block queue head pointer from the management structure of the memory pool, and locate a memory head start position of the first free memory block in the free memory block linked list. Step 160: Fill in the information in the memory header, including the process (or task) information (GetUser) of applying for the memory block, and set the memory block usage flag (MEM_BLOCK_USED) to be used; Step 170, update the memory. The information in the pool management structure updates the free memory block queue head pointer in the management structure to the next memory head pointer in the memory block memory header, and decrements the number of free memory blocks, and the number of successfully allocated memory blocks is incremented. ; - Step 180, release semaphore protection;
步骤 190, 返回分配的内存块地址, 该地址应该是分配的所述空闲内存 块的数据体指针, 结束。  Step 190: Return the allocated memory block address, which should be the data body pointer of the allocated free memory block, and end.
用户释放内存时的处理流程如图 3所示, 包括以下步骤: . The processing flow when the user releases the memory is shown in Figure 3, including the following steps:
步骤 200, 用户提出内存释放请求, 指明要归还的内存块指针(指向数 据体) , 该指针指向该内存块数据体;  Step 200, the user proposes a memory release request, indicating a memory block pointer (pointing to the data body) to be returned, and the pointer points to the memory block data body;
步骤 210, 内存管理模块对要归还的内存指针进行合法性检査, 将输入 的内存指针偏移一个内存头的长度, 判断该内存头指针是否在该待归还的内 存块所在的内存池范围内, 如果是, 执行下一步, 否则, 返回错误信息, 结 束; .  Step 210: The memory management module checks the validity of the memory pointer to be returned, offsets the input memory pointer by a length of the memory header, and determines whether the memory head pointer is within the memory pool of the memory block to be returned. If yes, go to the next step, otherwise, return an error message and end;
步骤 220, 根据上述偏移后的内存头指针找到相应的内存头;  Step 220: Find a corresponding memory head according to the offset memory head pointer.
步骤 230, 判断其中的内存块使用标志是否指示该内存块是可用, 如果 是, 返回错误信息, 结束, 否则, 执行下一步;  Step 230, determining whether the memory block usage flag indicates that the memory block is available, and if yes, returning an error message, ending, otherwise, performing the next step;
, 步骤 240, 调用系统信号量调用 (VOS— Sema— P)进入内存管理模块的 信号量保护; , step 240, calling the system semaphore call (VOS_Sema-P) to enter the semaphore protection of the memory management module;
步骤 250, 设置内存头指针中内存块使用标志为空闲,.并在内存头指针 中填写归还该内存块的进程(或任务)信息;  Step 250: Set a memory block usage flag in the memory head pointer to be idle, and fill in the memory head pointer to fill in the process (or task) information of the memory block;
步骤 260, 将相应内存池管理结构中的空闲内存块队列尾指针更新为该 内存头指针, 将管理结构中的空闲内存块数目加一, 并令原空闲内存块链表 中最后一个空闲内存块内存头中的下一内存头指针指向该新加入空闲内存 块的内存头, 即将原队列中最后一个空闲内存块与新加入空闲内存块相链 接; 步骤 270, 调用系统信号量调用释放信号量保护, 结束。 Step 260: Update the free memory block queue tail pointer in the corresponding memory pool management structure to the memory head pointer, add one to the number of free memory blocks in the management structure, and make the last free memory block memory in the original free memory block linked list. The next memory head pointer in the header points to the memory header newly added to the free memory block, that is, the last free memory block in the original queue is linked with the newly added free memory block; Step 270, calling the system semaphore call to release the semaphore protection, and ending.
在上述实施例的基础上, 也可以有各种变换, 例如, 对于 S闲内存块的 管理,除了上面提到的单向链表和双向链表外,也可以采用其它方式,例如, 可以采用空闲内存块指针构成的 FIFO队列进行管理,该 FIFO队列可以放在 内存池的管理结构中。  On the basis of the foregoing embodiments, various transformations are also possible. For example, for the management of the S-free memory block, in addition to the unidirectional linked list and the doubly linked list mentioned above, other methods may be used, for example, free memory may be used. The FIFO queue formed by the block pointer is managed, and the FIFO queue can be placed in the management structure of the memory pool.
工业实用性 Industrial applicability
本发明方法描述了内存池和内存块的组织结构及应用程序使用内存块 的方法, 简化了软件系统中有关内存管理方面需求, 可以预防软件系统中的 内存泄漏和内存混乱的情况, 可用于例如移动终端、 网络侧交换设备等的支 撑子系统中。  The method of the present invention describes the organization structure of the memory pool and the memory block and the method of using the memory block by the application, which simplifies the memory management requirements in the software system, and can prevent memory leakage and memory confusion in the software system, and can be used, for example. In the supporting subsystem of the mobile terminal, the network side switching device, and the like.

Claims

权 利 要 求 书 Claim
1、 一种内存池的构造和使用方法, 包括以下步骤: 1. A method of constructing and using a memory pool, comprising the following steps:
(a) 将内存划分为若干个的内存池, 每个内存池中包括一个或多个大 小相同的内存块, 每一内存池设有一个管理结构, 保存了该内存池中内存块 及其使用情况信息以及空闲内存块的地址信息, 每个内存块划分为数据体和 用于标记该内存块使用情况的内存头;  (a) Divide memory into several memory pools, each memory pool includes one or more memory blocks of the same size, each memory pool has a management structure, and the memory blocks in the memory pool are saved and used. Situation information and address information of the free memory block, each memory block is divided into a data body and a memory header for marking the usage of the memory block;
(b) 内存管理模块收到内存申请后, 将申请的内存大小加上内存头大 小作为要分配的最小内存块大小, 选择一个可满足要求的内存池;  (b) After receiving the memory request, the memory management module uses the requested memory size plus the memory header size as the minimum memory block size to be allocated, and selects a memory pool that satisfies the requirements;
(c)根据选定内存池管理结构中的内存块使用情况判断是否还有可分 配的空闲内存块, 如果有, 选择一个空闲内存块分配, 将该空闲内存块标记 为"已使用", 并更新该管理结构中内存块使用情况信息和空闲内存块的地址 信息;  (c) judging whether there is any free memory block that can be allocated according to the memory block usage in the selected memory pool management structure, if so, selecting a free memory block allocation, marking the free memory block as "used", and Updating memory block usage information and address information of the free memory block in the management structure;
(d)将分配的所述空闲内存块的数据体指针返回给用户, 申请结束; (d) returning the data body pointer of the allocated free memory block to the user, and the application ends;
(e) 内存管理模块收到内存释放请求, 指明要归还的指向数据体的内 存块指针, 将该指针偏移一个内存头的长度后, 找到相应的内存头; (e) The memory management module receives the memory release request, indicates the memory block pointer to the data body to be returned, and offsets the pointer by a length of the memory header to find the corresponding memory header;
(f)将该内存头中的使用标志改为空闲, 同时更新该内存块所属内存池 管理结构中的内存块使用情况信息和空闲内存块地址信息, 释放结束。  (f) Change the usage flag in the memory header to idle, and update the memory block usage information and the free memory block address information in the memory pool management structure to which the memory block belongs, and the release ends.
2、 如权利要求 1所述的方法, 其特征在于, 所述每个内存池中的空闲 内存块采用单向链表或双向链表的队列结构, 空闲内存块的内存头记录 ΐ队 列中下一空闲内存块的内存头指针, 在每个内存池管理结构中保留了该空闲 内存块队列头和队列尾的指针; 步骤 (c) 中, 是将所述管理结构中空闲内 存块队列头指针所指向的空闲内存块进行分配, 并在分配后将空闲内存块队 列头指针改为指向队列中下一空闲内存块的内存头; 步骤(f)释放内存时, 还将所述管理结构中的空闲内存块队列尾指针改为指向该新加入的空闲内 存块的内存头, 并将原队列中最后一个空闲内存块与该新加入的空闲内存块 相链接。  2. The method according to claim 1, wherein the free memory block in each memory pool adopts a queue structure of a unidirectional linked list or a doubly linked list, and the memory header of the free memory block records the next idle in the queue. The memory head pointer of the memory block retains the pointer of the free memory block queue header and the queue tail in each memory pool management structure; in step (c), the pointer of the free memory block queue head pointer in the management structure is pointed The free memory block is allocated, and after the allocation, the free memory block queue head pointer is changed to the memory head of the next free memory block in the queue; when the memory is released in step (f), the free memory in the management structure is also The block queue tail pointer is changed to point to the memory header of the newly added free memory block, and the last free memory block in the original queue is linked with the newly added free memory block.
3、 如权利要求 1所述的方法, 其特征在于, 所述各个内存池中的内存 块大小是 2n个字节, n为正整数。 3. The method according to claim 1, wherein the memory block size in each memory pool is 2 n bytes, and n is a positive integer.
4、 如权利要求 1所述的方法, 其特征在于, 所述各个内存池的管理结 构集中设置在内存的某一指定区域。 4. The method according to claim 1, wherein the management structures of the respective memory pools are collectively set in a specified area of the memory.
5、 如权利要求 1所述的方法, 其特征在于, 所述步骤(b) 中是 t艮据要 分配的最小内存大小„, 从内存块大小大于要分配的最小内存大小的内存池中 选择其中内存块最小的一个内存池, 如选择不到, 则申请失败, 结束。  5. The method according to claim 1, wherein in the step (b), the minimum memory size to be allocated is selected from a memory pool whose memory block size is larger than a minimum memory size to be allocated. The memory pool with the smallest memory block, if not selected, the application fails and ends.
6、 如权利要求 1所述的方法, 其特征在于, 所述内存池管理结构中还 保存了预留内存块个数的信息, 所述步骤 (c) 中如空闲内存块数目大于该 预留内存块个数, 则表示还有可分配的空闲内存块, 否则, 无可供分配的空 闲内存块。  The method of claim 1, wherein the memory pool management structure further stores information about the number of reserved memory blocks, and the number of free memory blocks in the step (c) is greater than the reservation. The number of memory blocks indicates that there are free memory blocks that can be allocated. Otherwise, there are no free memory blocks available for allocation.
7、 如权利要求 1所述的方法, 其特征在于, 所述步骤(e) 中还对要归 还的内存块指针进行合法性检查, 将该内存指针偏移一个内存头的长度后, 如该指针在该待归还的内存块所在的内存池范围内,则合法,否则,不合法, 返回错误信息, 结束。  The method according to claim 1, wherein in the step (e), the memory block pointer to be returned is checked for validity, and the memory pointer is offset by a length of the memory header, such as The pointer is legal in the range of the memory pool where the memory block to be returned is located. Otherwise, it is illegal, and the error message is returned.
8、 如权利要求 1所述的方法, 其特征在于, 在申请或释放内存的过程 中,在对内存池的管理结构或者内存块进行操作之前,都先加入信号量保护, 在操作之后, 再释放信号量保护。 '  8. The method according to claim 1, wherein in the process of applying for or releasing the memory, before the operation of the memory pool management structure or the memory block, the semaphore protection is added, after the operation, Release semaphore protection. '
9、 如权利要求 1所述的方法, 其特征在于, 所述内存头还用于保存有 申请或归还该内存头所在内存块的进程或任务的信息。  9. The method of claim 1, wherein the memory head is further configured to store information of a process or task requesting or returning a memory block in which the memory head is located.
10、 如权利要求 1 所述的方法, 其特征在于, 所述步骤(f) 中, 先判 断所述内存头中的使用标志是否指示该内存块为 "已使用", 如果是, 再将其 改为"空闲"和进行后续操作, 否则, 返回错误信息, 结束。  10. The method according to claim 1, wherein in the step (f), determining whether the usage flag in the memory header indicates that the memory block is "used", and if so, Change to "Idle" and proceed with the subsequent operation, otherwise, return an error message and end.
PCT/CN2006/000515 2006-03-27 2006-03-27 A method for constructing and using a memory pool WO2007109920A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2006/000515 WO2007109920A1 (en) 2006-03-27 2006-03-27 A method for constructing and using a memory pool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2006/000515 WO2007109920A1 (en) 2006-03-27 2006-03-27 A method for constructing and using a memory pool

Publications (1)

Publication Number Publication Date
WO2007109920A1 true WO2007109920A1 (en) 2007-10-04

Family

ID=38540774

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2006/000515 WO2007109920A1 (en) 2006-03-27 2006-03-27 A method for constructing and using a memory pool

Country Status (1)

Country Link
WO (1) WO2007109920A1 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528439A (en) * 2016-10-20 2017-03-22 腾讯科技(深圳)有限公司 Method and device for managing memory pool
CN110413521A (en) * 2019-07-24 2019-11-05 杭州迪普信息技术有限公司 A kind of the write-overflow detection method and device of heap memory
CN111459417A (en) * 2020-04-26 2020-07-28 中国人民解放军国防科技大学 NVMeoF storage network-oriented lock-free transmission method and system
CN112214313A (en) * 2020-09-22 2021-01-12 深圳云天励飞技术股份有限公司 Memory allocation method and related equipment
CN112817766A (en) * 2021-02-22 2021-05-18 北京青云科技股份有限公司 Memory management method, electronic device and medium
CN112988609A (en) * 2019-12-02 2021-06-18 杭州海康机器人技术有限公司 Data processing method, device, storage medium and client

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1527206A (en) * 2003-03-03 2004-09-08 华为技术有限公司 Memory pool managing method
US6889288B2 (en) * 2002-12-02 2005-05-03 Emc Corporation Reducing data copy operations for writing data from a network to storage of a cached data storage system by organizing cache blocks as linked lists of data fragments
US20050283584A1 (en) * 2003-04-30 2005-12-22 Tianlong Chen Invariant memory page pool and implementation thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6889288B2 (en) * 2002-12-02 2005-05-03 Emc Corporation Reducing data copy operations for writing data from a network to storage of a cached data storage system by organizing cache blocks as linked lists of data fragments
CN1527206A (en) * 2003-03-03 2004-09-08 华为技术有限公司 Memory pool managing method
US20050283584A1 (en) * 2003-04-30 2005-12-22 Tianlong Chen Invariant memory page pool and implementation thereof

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528439A (en) * 2016-10-20 2017-03-22 腾讯科技(深圳)有限公司 Method and device for managing memory pool
CN106528439B (en) * 2016-10-20 2018-07-06 腾讯科技(深圳)有限公司 The method and device in managing internal memory pond
CN110413521A (en) * 2019-07-24 2019-11-05 杭州迪普信息技术有限公司 A kind of the write-overflow detection method and device of heap memory
CN110413521B (en) * 2019-07-24 2023-01-24 杭州迪普信息技术有限公司 Write-crossing detection method and device for heap memory
CN112988609A (en) * 2019-12-02 2021-06-18 杭州海康机器人技术有限公司 Data processing method, device, storage medium and client
CN112988609B (en) * 2019-12-02 2023-05-02 杭州海康机器人股份有限公司 Data processing method, device, storage medium and client
CN111459417A (en) * 2020-04-26 2020-07-28 中国人民解放军国防科技大学 NVMeoF storage network-oriented lock-free transmission method and system
CN111459417B (en) * 2020-04-26 2023-08-18 中国人民解放军国防科技大学 Non-lock transmission method and system for NVMeoF storage network
CN112214313A (en) * 2020-09-22 2021-01-12 深圳云天励飞技术股份有限公司 Memory allocation method and related equipment
CN112817766A (en) * 2021-02-22 2021-05-18 北京青云科技股份有限公司 Memory management method, electronic device and medium
CN112817766B (en) * 2021-02-22 2024-01-30 北京青云科技股份有限公司 Memory management method, electronic equipment and medium

Similar Documents

Publication Publication Date Title
KR101620773B1 (en) Data migration for composite non-volatile storage device
WO2007109920A1 (en) A method for constructing and using a memory pool
US8352681B2 (en) Storage system and a control method for accelerating the speed of copy processing
US7802070B2 (en) Approach for de-fragmenting physical memory by grouping kernel pages together based on large pages
JP4464378B2 (en) Computer system, storage system and control method for saving storage area by collecting the same data
CN106484311B (en) A kind of data processing method and device
CN109901798B (en) Data storage method and device
CN107066498B (en) Key value KV storage method and device
US20140351547A1 (en) Linked list for lock-free memory allocation
CN108874298B (en) Data storage method and device
CN110765076B (en) Data storage method, device, electronic equipment and storage medium
CN109995813A (en) A kind of partition extension method, date storage method and device
US20070156763A1 (en) Storage management system and method thereof
JP2007108981A (en) Data exchange method between storage device and volume
CN111949605A (en) Method, apparatus and computer program product for implementing a file system
CN107346265B (en) Method and device for realizing QoS
CN112214313A (en) Memory allocation method and related equipment
CN105138481A (en) Stored data processing method and apparatus and system
US20080162830A1 (en) Methods, systems, and computer program products for providing memory management with constant defragmentation time
JP2016533588A (en) Storage processing method, apparatus and terminal
CN111435286B (en) Data storage method, device and system
CN114442910A (en) Method, electronic device and computer program product for managing storage system
US9021491B2 (en) Dual mode reader writer lock
WO2016115798A1 (en) Storage space allocation method, storage space allocation device, and terminal
US11144243B2 (en) Method and device for managing redundant array of independent disks and computer program product

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 06722167

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 06722167

Country of ref document: EP

Kind code of ref document: A1