[go: up one dir, main page]

CN103176907A - Memory management method and memory management system - Google Patents

Memory management method and memory management system Download PDF

Info

Publication number
CN103176907A
CN103176907A CN2011104359895A CN201110435989A CN103176907A CN 103176907 A CN103176907 A CN 103176907A CN 2011104359895 A CN2011104359895 A CN 2011104359895A CN 201110435989 A CN201110435989 A CN 201110435989A CN 103176907 A CN103176907 A CN 103176907A
Authority
CN
China
Prior art keywords
node
linked list
data
storing
memory
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN2011104359895A
Other languages
Chinese (zh)
Other versions
CN103176907B (en
Inventor
张孝岐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Feinno Communication Technology Co Ltd
Original Assignee
Beijing Feinno Communication Technology Co Ltd
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 Beijing Feinno Communication Technology Co Ltd filed Critical Beijing Feinno Communication Technology Co Ltd
Priority to CN201110435989.5A priority Critical patent/CN103176907B/en
Priority claimed from CN201110435989.5A external-priority patent/CN103176907B/en
Publication of CN103176907A publication Critical patent/CN103176907A/en
Application granted granted Critical
Publication of CN103176907B publication Critical patent/CN103176907B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Memory System (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a memory management method and a memory management system. The memory management method includes the steps of distributing memory blocks used for storing user-defined chain tables according to quantity of nodes in the preset user-defined chain tables, wherein content stored in each node of the user-defined chain tables is word addresses of the memory blocks used for storing any type of data, the data which are stored in the memory blocks and correspond to the word addresses are any type of data corresponding to the nodes, and the memory blocks are one piece of internal memory with continuous addresses. The memory management method and the memory management system can solve the problems that a large number of pointers are used for carrying out node connection, application complexity is increased, and efficiency of application and development is low.

Description

Memory management method and system
Technical Field
The present invention relates to the field of computers, and in particular, to a method and a system for memory management.
Background
Memory management is an important issue in computer applications. In the prior art, a linked list mode is adopted for memory management. The linked list is made up of a series of nodes (each element in the list is called a node) that can be dynamically generated at run-time. Each node comprises two parts: one part is the data field storing the data element and the other part is the pointer field storing the address of the next node, as shown in figure 1. The linked list operations include inserting nodes, accessing node data, deleting nodes, modifying node data, looking up data, and the like.
In the prior art, a large number of pointers are used for node connection, so that the complexity of application is increased, and the efficiency of application development is low; in addition, when accessing data in a node, all nodes in the linked list before the node need to be traversed, and the node can be accessed, so that the speed and the convenience degree of data access are influenced.
Disclosure of Invention
The memory management method and the memory management system provided by the invention are used for solving the problems that a large number of pointers are used for node connection, the complexity of application is increased, and the efficiency of application development is low.
The invention discloses a memory management method, which comprises the following steps:
step 1, allocating memory blocks for storing a user-defined linked list according to the number of nodes in a preset user-defined linked list;
step 2, the content stored in each node of the user-defined linked list is the first address of a memory block used for storing any type of data, and the data stored in the memory block corresponding to the first address is any type of data corresponding to the node;
the memory block is a block of memory with continuous addresses.
Wherein the method further comprises:
and step 21, allocating a memory for storing the self-defined linked list information, wherein the self-defined linked list information comprises the head address of the memory block for storing the self-defined linked list and the node number in the self-defined linked list.
Wherein, the number of bytes occupied by the nodes in the self-defined linked list is the same,
after the step 2, the method further comprises the following steps:
step 31, when accessing the data corresponding to the node at the specified position in the custom linked list, determining the address of the node at the specified position according to the number of bytes occupied by each node and the specified position by taking the first address of the custom linked list as a starting point;
step 32, reading the first address of the memory block stored in the node of the specified position according to the address;
and step 33, accessing the data stored in the memory block according to the first address.
The types of data corresponding to each node of the user-defined linked list are the same;
after the step 2, the method further comprises the following steps:
step 41, when inserting data, comparing the size of the data to be inserted with the corresponding data in the self-defined linked list, and determining the position of the corresponding node of the data to be inserted in the self-defined linked list from small to large;
step 42, if the node at the position is not empty, moving the data stored by the node to the next node for storage for each node which is not empty after the position and the position;
and 43, storing the first address of the memory block storing the data to be inserted into the node of the position.
Wherein, still include after said step 2:
step 51, when searching data, comparing the data corresponding to the nodes of the user-defined linked list with the data to be searched according to a dichotomy;
step 52, returning the search result.
Wherein, still include after said step 2:
step 61, when adding new node data at the appointed position of the self-defined linked list, if the appointed position node is not empty, moving the data stored in the node to the next node for storage for each node which is not empty after the appointed position and the appointed position;
step 62, storing the new node data to be added into the node of the position;
the new node data is the first address of the memory block for storing any type of data.
Wherein, still include after said step 2:
and step 71, when deleting the data of the nodes at the appointed positions of the user-defined linked list, deleting the data stored in the nodes at the appointed positions, and for each node which is not empty after the appointed positions, forwarding the data stored in the nodes to the previous node for storage.
Wherein, still include after said step 2:
step 81, when the memory is redistributed to the self-defined linked list, increasing the number of nodes in the self-defined linked list according to a preset rule, and distributing a new memory block for storing the self-defined linked list after the number of the nodes is increased;
step 82, data stored by the nodes in the original custom linked list are moved into a new memory block;
and step 83, releasing the memory block for storing the original custom linked list.
Wherein, still include after said step 2:
step 91, deleting the data stored by all nodes in the user-defined linked list;
or,
after the step 2, the method further comprises the following steps:
step 92, judging whether the self-defined linked list is empty or not;
or,
after the step 2, the method further comprises the following steps:
and step 93, releasing the memory blocks for storing the corresponding data in the user-defined linked list and the memory blocks for storing the user-defined linked list.
The invention also discloses a system for memory management, which comprises:
the link table memory allocation module is used for allocating memory blocks for storing a user-defined link table according to the number of nodes in the preset user-defined link table;
the linked list data storage module is used for storing the head address of the memory block for storing any type of data in each node of the user-defined linked list, and the data stored in the memory block corresponding to the head address is any type of data corresponding to the node;
the memory block is a block of memory with continuous addresses.
The embodiment of the invention has the beneficial effects that: by using the memory block storage node with continuous addresses and storing the first address of the memory block for storing data in the node, the massive use of pointers in application can be avoided, and the development efficiency is improved;
furthermore, during data access, according to the position of the accessed node in the linked list, the data corresponding to the node can be directly accessed, and the access speed and the convenience degree are increased;
in addition, the data are inserted from small to large according to the sequence of the data corresponding to the nodes, and the dichotomy is used during searching, so that the searching speed is increased.
Drawings
FIG. 1 is a schematic diagram of a linked list in a technical solution for performing memory management using the linked list in the prior art;
FIG. 2 is a flow chart of a method of memory management according to the present invention;
FIG. 3 is a diagram illustrating a method for allocating memory according to an embodiment of the present invention;
fig. 4 is a block diagram of a memory management system according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Referring to fig. 2, it is a flowchart of a memory management method provided in the present invention.
And step S100, allocating memory blocks for storing the user-defined linked list according to the number of nodes in the preset user-defined linked list.
Step S200, the data stored in each node of the custom linked list is the head address of the memory block for storing any type of data, and the data stored in the memory block is the data corresponding to the node.
The memory block is a block of memory with continuous addresses.
It should be noted that, in step S100, the memory blocks allocated for storing the customized linked list include multiple sub-memory blocks with consecutive addresses, and the size of the sub-memory block is the number of bytes occupied by the node. Each node occupies a set byte number, for example, each node occupies 4 bytes, and each 4 bytes in the memory block is a sub-memory block and corresponds to a node.
In a preferred embodiment, the method further includes allocating a memory for storing the user-defined linked list information, where the user-defined linked list information includes a first address of a memory block for storing the user-defined linked list and a node number in the user-defined linked list.
By storing the information of the user-defined linked list, the information of the user-defined linked list can be conveniently called when in use.
For example, as shown in fig. 3, a schematic diagram of a method for allocating memory in an embodiment is shown.
The self-defined linked list information comprises: the total number of nodes for storing data in the user-defined linked list, the total number of nodes in the user-defined linked list, the number of expansion nodes and the head address of the memory block for storing the user-defined linked list.
Definition structure CList
Figure BDA0000123699200000051
The member variables in the structure are described below
nCount: the node number is used for counting the number of nodes storing data in the user-defined linked list;
nTotle: the node self-defining link list is used for recording the total number of nodes in the self-defining link list;
nIncreate: the number of the expansion nodes in the self-defined linked list is recorded;
pszDataList: and the pointer type is used for recording the initial address of the memory for storing the self-defined linked list.
The custom linked list is stored in memory starting at the beginning address of the pszDataList record.
And each node of the self-defined linked list stores the first address of the memory block for storing any type of data.
Definition function prototype PCLIstHead clist initilize (int nIncreate)
The function is used to dynamically allocate memory blocks for storing the custom linked list.
Parameters are as follows:
nIncreate, defining the number of the expansion nodes in the linked list.
When initially establishing, the node number in the self-defined linked list is 0, and the total number of the nodes of the preset self-defined linked list is assigned to the parameter nIncreate. Each node occupies 4 bytes, and dynamically allocates memory blocks with 4 xnincreate bytes for storing the self-defined linked list.
After the initialization is successful, the first address of the memory returned to be dynamically allocated is assigned to pszDataList, nCount is set to be 0, and nTotle is assigned to be a parameter nIncreate.
In a preferred embodiment, the number of bytes occupied by the nodes in the custom linked list is the same, for example, 4 bytes.
After the step S200, the method further includes: when accessing data corresponding to a node at a specified position in a custom linked list, determining the address of the node at the specified position according to the number of bytes occupied by each node and the specified position by taking the first address of the custom linked list as a starting point, reading the first address of a memory block stored in the node at the specified position according to the address, and accessing the data stored in the memory block according to the first address.
For example, the function prototype: char list get at (PCLISTED head pData, int nPos)
And accessing data corresponding to the nodes at the specified positions by using the function.
Parameters are as follows:
PCLIstHead pData, a pointer of a structure body storing custom linked list information.
And accessing a data member pszDataList in the structure body through the pointer to obtain the first address of the memory block storing the self-defined linked list.
int nPos, the position of the node to be accessed in the custom linked list.
The first address +4 bytes × nPos is the address of the node to be accessed, and the first address of the memory block stored by the node is read according to the address.
And returning a value: and the first address of the memory block which is accessed and stores the data corresponding to the node at the appointed position.
And accessing data corresponding to the nodes at the specified positions by using the initial address.
In a preferred embodiment, the types of data corresponding to the nodes of the custom linked list are the same.
After the step S200, when data is inserted, comparing the size of the data to be inserted with the size of the corresponding data in the self-defined linked list, and determining the position of the corresponding node in the self-defined linked list according to the sequence from small to large; if the node at the position is not empty, moving the data stored by the node to the next node for storage for each node which is not empty after the position and the position; and storing the first address of the memory block storing the data to be inserted into the node of the position.
For example, the function prototype: int clist _ insert (PCLIstHead pData, COMPFUNCpCompFUnc, char pItem)
The function is used to insert data in order from small to large according to the result of the comparison function.
Parameters are as follows:
PCLIstHead pData, a pointer of a structure body storing custom linked list information.
And accessing a data member pszDataList in the structure body through the pointer to obtain the first address of the memory block storing the self-defined linked list.
COMPFUNC pCompFUnc, callback function, for comparing the sizes of the two data, and returning the comparison result.
char pItem, the data pointer to be inserted, points to the first address of the memory block storing the data to be inserted.
And sequentially comparing the size of the data corresponding to the nodes in the self-defined linked list with the size of the data to be inserted from the first address of the memory block pointed by the pszDataList, if the data to be inserted is larger than the data corresponding to the nodes, comparing the next node with the data to be inserted, and otherwise, determining the position of the current node as the position of the node corresponding to the data to be inserted.
And if the node at the position is not empty, moving the data stored by the node to the next node for storage for the position and each node after the position which is not empty. And storing the first address of the memory block storing the data to be inserted into the node of the position. And if the node of the position is empty, storing the first address of the memory block storing the data to be inserted into the node of the position.
The value of data member nCount in the structure is added by 1.
And returning a value: 1 indicates successful insertion and 0 indicates failed insertion.
Further, after the step S200, when searching for data, comparing data corresponding to the node of the custom linked list with data to be searched according to a dichotomy; and returning a search result.
For example, the function prototype: char list find (PCLIstHead pData, COMPFUNCpCompFUnc, char list)
The data is looked up by using a function in a dichotomy.
Parameters are as follows:
PCLIstHead pData, a pointer of a structure body storing custom linked list information.
And accessing a data member pszDataList in the structure body through the pointer to obtain the first address of the memory block storing the self-defined linked list.
COMPFUNC pCompFunc, callback function, for comparing the size of two data, returning the comparison result
char pItem, the data pointer to be searched, and the first address of the memory block storing the data to be searched.
Since the data are inserted in the order from small to large, the data lookup can be performed by using the dichotomy.
And accessing the data member nCount in the structure body through the pointer pData, comparing the size of the node and the data to be searched if the node to be compared for the first time is the node positioned in the middle of the nodes for storing the data, searching in the second half section if the data to be searched is larger, and searching in the first half section if the data to be searched is smaller. And in the determined query range, comparing the node with the node at the middle position in the query range according to the above, determining the next search range according to the comparison result until the data to be searched is found, and if the node at the self-defined list head or the last stored data is found and is not found, failing to search.
And returning a value: and returning the first address of the memory block stored in the searched node, wherein if the search fails, the return pointer is null.
In a preferred embodiment, after the step S200, when new node data is added to the designated position of the self-defined linked list, if the node at the designated position is not empty, for each node that is not empty after the designated position and the designated position, moving the data stored in the node back to the next node for storage; and storing the new node data to be added into the node of the position.
And the data of the new node is the first address of the memory block for storing any type of data.
For example, the function prototype: int clist _ add _ at (PCLIstHead pData, char pItem, int nPos)
The function is used to add new node data at the specified location.
Parameters are as follows:
PCLIstHead pData, a pointer of a structure body storing custom linked list information.
And accessing a data member pszDataList in the structure body through the pointer to obtain the first address of the memory block storing the self-defined linked list.
char, pItem, the data pointer to be added, points to the first address of the memory block storing the data to be added.
int nPos, the location to be added.
The data member nCount in the structure is accessed through the pointer pData.
And comparing the nCount with the nPos, if the nPos is larger, the node at the appointed position is empty, storing the new node data to be added into the node at the appointed position, otherwise, the node at the appointed position is not empty, and for each node which is not empty at the appointed position and behind the appointed position, moving the data stored in the node back to the next node for storage. And storing the data of the new node to be added into the node at the position.
The value of nCount is added by 1.
And returning a value: successfully returns 1, otherwise returns 0.
In a preferred embodiment, after the step S200, when deleting the data of the node at the designated position in the custom linked list, the data stored in the node at the designated position is deleted, and for each node after the designated position that is not empty, the data stored in the node is moved forward to the previous node for storage.
Function prototype: int clist _ remove _ at (PCLIstHead pData, int nPos)
The function is used to delete the data of the nodes at the specified locations.
Parameters are as follows:
PCLIstHead pData, a pointer of a structure body storing custom linked list information.
And accessing a data member pszDataList in the structure body through the pointer to obtain the first address of the memory block storing the self-defined linked list.
int nPos, the location of the node to be deleted in the data chain.
And deleting the data stored in the nodes at the designated positions, and forwarding the data stored in the nodes to the previous node for storage for each node which is not empty after the designated positions.
The value of nCount is decremented by 1.
And returning a value: successfully returns 1, otherwise returns 0.
In a preferred embodiment, after step S200, when the memory is reallocated to the custom linked list, increasing the number of nodes in the custom linked list according to a preset rule, for example, doubling the number of nodes, and allocating a new memory block for storing the custom linked list after the number of nodes is increased; moving the data stored in the node in the original self-defined linked list into a new memory block; and releasing the memory block for storing the original self-defined linked list.
For example, the function prototype: int clist _ realloc _ mem (PClistHead pData)
The function is used to reallocate memory for the custom linked list.
Parameters are as follows:
PCLIstHead pData, a pointer of a structure body storing custom linked list information.
And accessing a data member pszDataList in the structure body through the pointer to obtain the first address of the memory block storing the self-defined linked list.
And increasing the number of the nodes, and allocating memory blocks with the size of (nTotle + nIncreate) multiplied by 4 bytes for storing the self-defined linked list after the number of the nodes is increased. And moving the data stored in the node in the original self-defined linked list into the new memory block. And releasing the memory block for storing the original self-defined linked list.
Correspondingly changing the list first address pszDataList in the user-defined linked list information into the first address of the new memory block, wherein the total node updating node number nTotle is the sum of the original node number and the expansion node number, nTotle + nIncreate.
And returning a value: successfully returns 1, otherwise returns 0.
In a preferred embodiment, after the step S200, the method further includes deleting data stored in all nodes in the custom linked list.
Function prototype: void clist _ remove _ all (PCLIstHead pData)
And deleting the data stored in the nodes in all the self-defined linked lists by using the function.
Parameters are as follows:
PCLIstHead pData, a pointer of a structure body storing custom linked list information.
And accessing a data member pszDataList in the structure body through the pointer to obtain the first address of the memory block storing the self-defined linked list.
And deleting the data stored by all the nodes in the user-defined linked list. nCount is set to 0.
And returning a value: is free of
In a preferred embodiment, the step S200 further includes determining whether the custom linked list is empty.
For example, the function prototype: int clist _ is _ empty (PCLIstHead pData)
The function is used to determine whether the custom linked list is empty.
Parameters are as follows:
PCLIstHead pData, a pointer of a structure body storing custom linked list information.
And accessing a data member pszDataList in the structure body through the pointer to obtain the first address of the memory block for storing the self-defined linked list.
And judging whether the first node of the self-defined linked list stores data or not, wherein if the first node stores the data, the self-defined linked list is not empty, and otherwise, the self-defined linked list is empty.
Or, accessing a data member nCount in the structure through the pointer pData, and if nCount is 0, the self-defined linked list is empty.
And returning a value: return 1 for null, otherwise return 0
In a preferred embodiment, after the step S200, the method further includes releasing the memory block for storing the corresponding data in the custom linked list and the memory block for storing the custom linked list.
For example, the function prototype: void clist _ release (PCLIstHead pData)
Releasing memory using functions
Parameters are as follows:
PCLIstHead pData, a pointer of a structure body storing custom linked list information.
And accessing a data member pszDataList in the structure body through the pointer to obtain the first address of the memory block storing the self-defined linked list.
And releasing the memory block for storing the corresponding data in the user-defined linked list and the memory block for storing the user-defined linked list.
And returning a value: is free of
Fig. 4 is a structural diagram of the memory management system according to the present invention.
A linked list memory allocation module 100, configured to allocate a memory block for storing a user-defined linked list according to the number of nodes in the preset user-defined linked list.
A linked list data storage module 200, configured to store, in each node of the user-defined linked list, a first address of a memory block used for storing any type of data, where data stored in the memory block corresponding to the first address is any type of data corresponding to the node.
The memory block is a block of memory with continuous addresses.
Further, the system further comprises a linked list information storage module for allocating the memory and storing the user-defined linked list information, wherein the user-defined linked list information comprises the head address of the memory block for storing the user-defined linked list and the node number in the user-defined linked list.
Furthermore, the number of bytes occupied by the nodes in the self-defined linked list is the same, and the system further comprises a data access module, which is used for determining the address of the node at the specified position according to the number of bytes occupied by each node and the specified position by taking the first address of the self-defined linked list as a starting point when accessing the data corresponding to the node at the specified position in the self-defined linked list, reading the first address of the memory block stored in the node at the specified position according to the address, and accessing the data stored in the memory block according to the first address.
Further, the types of data corresponding to each node of the self-defined linked list are the same.
The system also comprises a data inserting module used for comparing the size of the data to be inserted with the size of the corresponding data in the self-defined linked list when the data is inserted, and determining the position of the corresponding node of the data to be inserted in the self-defined linked list according to the sequence from small to large; if the node at the position is not empty, moving the data stored by the node to the next node for storage for each node which is not empty after the position and the position; and storing the first address of the memory block storing the data to be inserted into the node of the position.
And the system further comprises a data searching module which is used for comparing the data corresponding to the nodes of the user-defined linked list with the data to be searched according to the dichotomy and returning a searching result when the data is searched.
Further, the system also comprises a node data adding module, which is used for moving the data stored in the node back to the next node for storage if the node at the designated position is not empty when adding new node data at the designated position of the self-defined linked list; storing new node data to be added into the nodes of the positions;
the new node data is the first address of the memory block for storing any type of data.
The system further comprises a designated node data deleting module, wherein the designated node data deleting module is used for deleting the data stored in the designated node when the data of the designated node of the self-defined linked list is deleted, and for each node which is not empty after the designated node, the data stored in the node is moved forward to the previous node for storage.
Further, the system further comprises a memory reallocation module, which is used for increasing the number of nodes in the user-defined linked list according to a preset rule, allocating a new memory block for storing the user-defined linked list after the number of the nodes is increased, moving the data stored by the nodes in the original user-defined linked list into the new memory block, and releasing the memory block for storing the original user-defined linked list when the memory is reallocated to the user-defined linked list.
Further, the system also comprises a data deleting module which is used for deleting the data stored by all the nodes in the self-defined linked list.
Further, the system also comprises a linked list empty judgment module used for judging whether the self-defined linked list is empty or not.
Further, the system further includes a memory releasing module, configured to release the memory block used for storing the corresponding data in the custom linked list and the memory block used for storing the custom linked list.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A method for memory management, the method comprising:
step 1, allocating memory blocks for storing a user-defined linked list according to the number of nodes in a preset user-defined linked list;
step 2, the content stored in each node of the user-defined linked list is the first address of a memory block used for storing any type of data, and the data stored in the memory block corresponding to the first address is any type of data corresponding to the node;
the memory block is a block of memory with continuous addresses.
2. The method of memory management according to claim 1,
the method further comprises the following steps:
and step 21, allocating a memory for storing the self-defined linked list information, wherein the self-defined linked list information comprises the head address of the memory block for storing the self-defined linked list and the node number in the self-defined linked list.
3. The method of memory management according to claim 1,
the number of bytes occupied by the nodes in the self-defined linked list is the same,
after the step 2, the method further comprises the following steps:
step 31, when accessing the data corresponding to the node at the specified position in the custom linked list, determining the address of the node at the specified position according to the number of bytes occupied by each node and the specified position by taking the first address of the custom linked list as a starting point;
step 32, reading the first address of the memory block stored in the node of the specified position according to the address;
and step 33, accessing the data stored in the memory block according to the first address.
4. The method of memory management according to claim 1,
the types of data corresponding to each node of the user-defined linked list are the same;
after the step 2, the method further comprises the following steps:
step 41, when inserting data, comparing the size of the data to be inserted with the corresponding data in the self-defined linked list, and determining the position of the corresponding node of the data to be inserted in the self-defined linked list from small to large;
step 42, if the node at the position is not empty, moving the data stored by the node to the next node for storage for each node which is not empty after the position and the position;
and 43, storing the first address of the memory block storing the data to be inserted into the node of the position.
5. The method of memory management according to claim 4,
after the step 2, the method further comprises the following steps:
step 51, when searching data, comparing the data corresponding to the nodes of the user-defined linked list with the data to be searched according to a dichotomy;
step 52, returning the search result.
6. The method of memory management according to claim 1,
after the step 2, the method further comprises the following steps:
step 61, when adding new node data at the appointed position of the self-defined linked list, if the appointed position node is not empty, moving the data stored in the node to the next node for storage for each node which is not empty after the appointed position and the appointed position;
step 62, storing the new node data to be added into the node of the position;
the new node data is the first address of the memory block for storing any type of data.
7. The method of memory management according to claim 1,
after the step 2, the method further comprises the following steps:
and step 71, when deleting the data of the nodes at the appointed positions of the user-defined linked list, deleting the data stored in the nodes at the appointed positions, and for each node which is not empty after the appointed positions, forwarding the data stored in the nodes to the previous node for storage.
8. The method of memory management according to claim 1,
after the step 2, the method further comprises the following steps:
step 81, when the memory is redistributed to the self-defined linked list, increasing the number of nodes in the self-defined linked list according to a preset rule, and distributing a new memory block for storing the self-defined linked list after the number of the nodes is increased;
step 82, data stored by the nodes in the original custom linked list are moved into a new memory block;
and step 83, releasing the memory block for storing the original custom linked list.
9. The method of memory management according to claim 1,
after the step 2, the method further comprises the following steps:
step 91, deleting the data stored by all nodes in the user-defined linked list;
or,
after the step 2, the method further comprises the following steps:
step 92, judging whether the self-defined linked list is empty or not;
or,
after the step 2, the method further comprises the following steps:
and step 93, releasing the memory blocks for storing the corresponding data in the user-defined linked list and the memory blocks for storing the user-defined linked list.
10. A system for memory management, the system comprising:
the link table memory allocation module is used for allocating memory blocks for storing a user-defined link table according to the number of nodes in the preset user-defined link table;
the linked list data storage module is used for storing the head address of the memory block for storing any type of data in each node of the user-defined linked list, and the data stored in the memory block corresponding to the head address is any type of data corresponding to the node;
the memory block is a block of memory with continuous addresses.
CN201110435989.5A 2011-12-22 A kind of method and system of memory management Active CN103176907B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110435989.5A CN103176907B (en) 2011-12-22 A kind of method and system of memory management

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110435989.5A CN103176907B (en) 2011-12-22 A kind of method and system of memory management

Publications (2)

Publication Number Publication Date
CN103176907A true CN103176907A (en) 2013-06-26
CN103176907B CN103176907B (en) 2016-12-14

Family

ID=

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103455433A (en) * 2013-08-19 2013-12-18 曙光信息产业股份有限公司 Memory management method and system
CN104468665A (en) * 2013-09-18 2015-03-25 腾讯科技(深圳)有限公司 Method and system for realizing distributed data storage
CN106126442A (en) * 2016-06-17 2016-11-16 北京京坤倍益科技发展有限公司 A kind of data store organisation and remote sensing satellite data-storage system
CN112328389A (en) * 2020-10-12 2021-02-05 长沙新弘软件有限公司 Memory allocation method for adding and deleting nodes in binary tree

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005072905A (en) * 2003-08-22 2005-03-17 Nippon Telegr & Teleph Corp <Ntt> Multicast MPLS node table configuration method, multicast MPLS node table initial registration method, multicast MPLS node table addition registration method, multicast MPLS node table deletion method, multicast MPLS node table search method, and multicast MPLS table point-to-point Label registration method, multicast MPLS table point-to-point label search method, and multicast MPLS node table operation method
CN1897570A (en) * 2006-06-15 2007-01-17 清华大学 Large data-set task node transferrying method based on content and relation separation
CN1936859A (en) * 2005-09-30 2007-03-28 康佳集团股份有限公司 Internal memory monitoring method
CN101241492A (en) * 2007-02-06 2008-08-13 中兴通讯股份有限公司 EMS memory data storage apparatus possessing capacity dynamic control function and its accomplishing method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005072905A (en) * 2003-08-22 2005-03-17 Nippon Telegr & Teleph Corp <Ntt> Multicast MPLS node table configuration method, multicast MPLS node table initial registration method, multicast MPLS node table addition registration method, multicast MPLS node table deletion method, multicast MPLS node table search method, and multicast MPLS table point-to-point Label registration method, multicast MPLS table point-to-point label search method, and multicast MPLS node table operation method
CN1936859A (en) * 2005-09-30 2007-03-28 康佳集团股份有限公司 Internal memory monitoring method
CN1897570A (en) * 2006-06-15 2007-01-17 清华大学 Large data-set task node transferrying method based on content and relation separation
CN101241492A (en) * 2007-02-06 2008-08-13 中兴通讯股份有限公司 EMS memory data storage apparatus possessing capacity dynamic control function and its accomplishing method

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103455433A (en) * 2013-08-19 2013-12-18 曙光信息产业股份有限公司 Memory management method and system
CN103455433B (en) * 2013-08-19 2016-08-10 曙光信息产业股份有限公司 Memory management method and system
CN104468665A (en) * 2013-09-18 2015-03-25 腾讯科技(深圳)有限公司 Method and system for realizing distributed data storage
CN104468665B (en) * 2013-09-18 2020-05-29 腾讯科技(深圳)有限公司 Method and system for realizing data distributed storage
CN106126442A (en) * 2016-06-17 2016-11-16 北京京坤倍益科技发展有限公司 A kind of data store organisation and remote sensing satellite data-storage system
CN112328389A (en) * 2020-10-12 2021-02-05 长沙新弘软件有限公司 Memory allocation method for adding and deleting nodes in binary tree
CN112328389B (en) * 2020-10-12 2024-04-30 长沙新弘软件有限公司 Memory allocation method for adding and deleting nodes in binary tree

Similar Documents

Publication Publication Date Title
CN107168657B (en) Virtual disk hierarchical cache design method based on distributed block storage
CN107239230B (en) Optimized hop-house multiple hash table for efficient memory inline deduplication applications
CN100565530C (en) A kind of snapshot system and using method thereof
CN102508784B (en) Data storage method of flash memory card in video monitoring equipment, and system thereof
JP5996088B2 (en) Cryptographic hash database
US10228875B2 (en) Data writing and reading methods for flash
CN101122885A (en) Data cache processing method, system and data cache device
US20090327377A1 (en) Copying entire subgraphs of objects without traversing individual objects
CN105320775A (en) Data access method and apparatus
CN110109873B (en) File management method for message queue
CN101916290B (en) Managing method of internal memory database and device
CN101315628A (en) In-memory database system and method and device for realizing in-memory database
CN103473298B (en) Data archiving method and device and storage system
CN107256196A (en) The caching system and method for support zero-copy based on flash array
CN104424030A (en) Sharing memory multi-process operation method and device
CN103914483A (en) File storage method and device and file reading method and device
CN108664482B (en) FLASH memory and storage file management method
CN109407985B (en) Data management method and related device
CN112527196B (en) Cache read-write method and device, computer readable storage medium and electronic equipment
CN102799583B (en) Object-oriented access method and system
CN111427885B (en) Database management method and device based on lookup table
CN115964002A (en) Electric energy meter terminal file management method, device, equipment and medium
CN108804571B (en) Data storage method, device and equipment
CN111708894A (en) Knowledge graph creating method
CN118210825B (en) Database query performance optimization method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: Room 810, 8 / F, 34 Haidian Street, Haidian District, Beijing 100080

Patentee after: BEIJING D-MEDIA COMMUNICATION TECHNOLOGY Co.,Ltd.

Address before: 100089 Beijing city Haidian District wanquanzhuang Road No. 28 Wanliu new building 6 storey block A room 602

Patentee before: BEIJING D-MEDIA COMMUNICATION TECHNOLOGY Co.,Ltd.