CN107133182A - A kind of EMS memory management process and device - Google Patents
A kind of EMS memory management process and device Download PDFInfo
- Publication number
- CN107133182A CN107133182A CN201610112157.2A CN201610112157A CN107133182A CN 107133182 A CN107133182 A CN 107133182A CN 201610112157 A CN201610112157 A CN 201610112157A CN 107133182 A CN107133182 A CN 107133182A
- Authority
- CN
- China
- Prior art keywords
- memory
- node
- memory node
- block
- internal
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/10—Providing a specific technical effect
- G06F2212/1016—Performance improvement
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/10—Providing a specific technical effect
- G06F2212/1032—Reliability improvement, data loss prevention, degraded operation etc
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/16—General purpose computing application
- G06F2212/163—Server or database system
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System (AREA)
Abstract
The invention provides a kind of EMS memory management process and device, the problem of solving existing EMS memory management process reliability and relatively low convenience.The EMS memory management process that the present invention is implemented includes:Memory node tree construction is created, the memory node tree construction includes:Record has an incidence relation in the memory node and the memory node tree construction between other memory nodes in multiple memory nodes, each memory node, and memory block shared by the memory node internal memory use state information;According to the memory node tree construction, memory management is carried out in the memory node.The embodiment of the present invention is according to the related information between the memory node recorded in memory node tree, and the internal memory use state information of memory block shared by each memory node, the hierarchical relationship between each memory block can be well understood, and then convenient memory management reliably can be carried out to memory block.
Description
Technical field
The present invention relates to the technical field of databases management, a kind of EMS memory management process and dress are particularly related to
Put.
Background technology
Any application program has the memory management model of oneself, and finding a suitable method can undoubtedly carry
The overall performance of high system.Data base management system is as a large complicated software systems, with greater need for one
Reliable and stable EMS memory management process.But existing EMS memory management process tends not to enough convenient reliably to internal memory
Random memory is carried out, so as to be unfavorable for the overall performance of raising system.
The content of the invention
It is an object of the invention to provide a kind of EMS memory management process and device, to solve existing memory management
The problem of method reliability and relatively low convenience.
To achieve these goals, the invention provides a kind of EMS memory management process, including:
Memory node tree construction is created, the memory node tree construction includes:Multiple memory nodes, Mei Gesuo
Stating record in memory node has in the memory node and the memory node tree construction between other memory nodes
Incidence relation, and memory block shared by the memory node internal memory use state information;
According to the memory node tree construction, memory management is carried out in the memory node.
It is wherein, described that memory management is carried out in the memory node according to the memory node tree construction,
Including:
According to the memory node tree construction, Memory Allocation or internal memory release are carried out in the memory node.
Wherein, the internal memory use state information includes memory block chained list and free memory piece array, described interior
Counterfoil chained list is used to record all memory blocks shared by the memory node, arranging by preset order, institute
Stating free memory piece array is used to record the Memory slice being recovered in the memory block, wherein, the Memory slice
To carry out the internal memory fragment of generation during Memory Allocation in the memory block.
It is wherein, described that Memory Allocation is carried out in the memory node according to the memory node tree construction,
Including:
In multiple memory nodes of the memory node tree, it is determined that needing to carry out the current memory of Memory Allocation
Node;
Judge that applying for whether storage allocation is more than in the memory block shared by the current memory node allows distribution
The maximum of Memory slice, draws the first judged result;
If first judged result is yes, a new memory block is distributed, by all of the new memory block
Internal memory is allocated as a Memory slice, and the new memory block is added to the work of the memory block chained list
Behind dynamic memory block, the movable memory block is the memory block ranked the first in the memory block chained list;
If first judged result is no, in the free memory piece array for judging the current memory node
With the presence or absence of suitable free memory piece, the second judged result is drawn;
If second judged result is yes, to being closed in the free memory piece array of the current memory node
Suitable free memory piece is allocated, otherwise, is carried out in the movable memory block of the current memory node interior
Deposit distribution.
Wherein, it is described to carry out Memory Allocation in the movable memory block of the current memory node, including:
Judge whether unappropriated internal memory is more than or equal to application in the movable memory block of the current memory node
Storage allocation, draws the 3rd judged result;
If the 3rd judged result is yes, in the movable memory block of the current memory node distribution with
The Memory slice of the application storage allocation correspondence size;
, will be unallocated in the movable memory block of the current memory node if the 3rd judged result is no
Internal memory be added in the free memory piece array of the current memory node, and distribute redistribute an internal memory
Block, the Memory slice of distribution size corresponding with the application storage allocation in the memory block redistributed, and will
The memory block redistributed as the current memory node movable memory block.
Wherein, with the presence or absence of suitable empty in the free memory piece array for judging the current memory node
Not busy Memory slice, including:
Judge pre- with the presence or absence of free memory piece satisfaction in the free memory piece array of the current memory node
If condition, the preparatory condition is more than the internal memory of application distribution for the internal memory of the free memory piece, and described
Internal memory difference between the internal memory of free memory piece and the internal memory of application distribution is in preset range;
If meeting described default in the presence of a free memory piece in the free memory piece array of the current memory node
There is suitable free memory piece in condition, then the free memory piece array for judging the current memory node,
Otherwise, judge suitable free memory piece is not present in the free memory piece array of the current memory node.
Wherein, it is described according to the memory node tree construction, internal memory release is carried out in the memory node,
Including:
Memory slice is received to release order;
Released order according to the Memory slice, judge the internal memory of Memory slice to be released whether more than described to be released
Memory slice, which belongs to, allows the maximum of storage allocation piece in memory block, draw the 4th judged result;
If the 4th judged result is yes, the Memory slice to be released is discharged, otherwise, waits to release by described
Put Memory slice and be added to the free memory piece number that the Memory slice to be released belongs to memory block correspondence memory node
In group.
Wherein, it is described according to the memory node tree construction, internal memory release is carried out in the memory node,
Including:
Memory node is received to release order;
Released order according to the memory node and memory node to be released and its in the memory node tree construction
Incidence relation between his memory node, judges that the memory node to be released whether there is sub- memory node;
If the memory node to be released has sub- memory node, the memory node to be released and institute are discharged
All memory blocks shared by the sub- memory node of memory node to be released are stated, otherwise, are discharged described to be released
All memory blocks shared by memory node.
Embodiments of the invention additionally provide a kind of memory management device, including:
Creation module, for creating memory node tree construction, the memory node tree construction includes:In multiple
Node is deposited, record has the memory node and other in the memory node tree construction in each memory node
Incidence relation between memory node, and memory block shared by the memory node internal memory use state information;
Management module, for according to the memory node tree construction, internal memory pipe to be carried out in the memory node
Reason.
Wherein, the management module is specifically for according to the memory node tree construction, in the memory node
Middle progress Memory Allocation or internal memory release.
Wherein, the internal memory use state information includes memory block chained list and free memory piece array, described interior
Counterfoil chained list is used to record all memory blocks shared by the memory node, arranging by preset order, institute
Stating free memory piece array is used to record the Memory slice being recovered in the memory block, wherein, the Memory slice
To carry out the internal memory fragment of generation during Memory Allocation in the memory block.
Wherein, the management module includes:
Determination sub-module, in multiple memory nodes of the memory node tree, it is determined that needing in progress
Deposit the current memory node of distribution;
First judging submodule, for judging whether application storage allocation is more than shared by the current memory node
Allow the maximum of storage allocation piece in memory block, draw the first judged result;
First processing submodule, if being yes for first judged result, distributes a new memory block,
It is allocated all internal memories of the new memory block as a Memory slice, and the new memory block is added
To behind the movable memory block of the memory block chained list, the movable memory block is in the memory block chained list
In the memory block that ranks the first;
Second judging submodule, if being no for first judged result, judges the current memory section
It whether there is suitable free memory piece in the free memory piece array of point, draw the second judged result;
Second processing submodule, if being yes for second judged result, to the current memory node
Free memory piece array in suitable free memory piece be allocated, otherwise, in the current memory node
Movable memory block in carry out Memory Allocation.
Wherein, the second processing submodule includes:
Unappropriated internal memory in first judging unit, the movable memory block for judging the current memory node
Whether it is more than or equal to application storage allocation, draws the 3rd judged result;
Allocation unit, if being yes for the 3rd judged result, in the activity of the current memory node
The Memory slice of distribution size corresponding with the application storage allocation in memory block;
Processing unit, if being no for the 3rd judged result, by the activity of the current memory node
Unappropriated internal memory is added in the free memory piece array of the current memory node in memory block, and is distributed
A memory block is redistributed, the distribution size corresponding with the application storage allocation in the memory block redistributed
Memory slice, and using the memory block redistributed as the current memory node movable memory block.
Wherein, second judging submodule includes:
It whether there is in second judging unit, the free memory piece array for judging the current memory node
One free memory piece meets preparatory condition, and the preparatory condition is more than application for the internal memory of the free memory piece
Internal memory difference between the internal memory of distribution, and the internal memory of the free memory piece and the internal memory of application distribution
In preset range;
3rd judging unit, if idle for having one in the free memory piece array of the current memory node
Memory slice meets the preparatory condition, then is deposited in the free memory piece array for judging the current memory node
In suitable free memory piece, otherwise, judge in the free memory piece array of the current memory node not
In the presence of suitable free memory piece.
Wherein, the management module includes:
First receiving submodule, releases order for receiving Memory slice;
3rd judging submodule, for being released order according to the Memory slice, judges the interior of Memory slice to be released
Deposit and whether be more than the maximum that the Memory slice to be released belongs to permission storage allocation piece in memory block, draw
4th judged result;
3rd processing submodule, if being yes for the 4th judged result, discharges the internal memory to be released
Piece, otherwise, is added to the Memory slice to be released by the Memory slice to be released and belongs in memory block correspondence
In the free memory piece array for depositing node.
Wherein, the management module includes:
Second receiving submodule, releases order for receiving memory node;
4th judging submodule, for being released order according to the memory node and memory node to be released and institute
The incidence relation between other memory nodes in memory node tree construction is stated, the memory node to be released is judged
With the presence or absence of sub- memory node;
Fourth process submodule, if there is sub- memory node for the memory node to be released, discharges institute
All memory blocks shared by the sub- memory node of memory node to be released and the memory node to be released are stated,
Otherwise, all memory blocks shared by the memory node to be released are discharged.
The embodiment of the present invention has the advantages that:
The EMS memory management process of the embodiment of the present invention, creates memory node tree construction, memory node tree construction bag
Include:Record has the memory node and its in memory node tree construction in multiple memory nodes, each memory node
Incidence relation between his memory node, and memory block shared by the memory node internal memory use state information;
According to memory node tree construction, memory management is carried out in memory node.According to internal memory in the embodiment of the present invention
Related information between the memory node recorded in node tree, and memory block shared by each memory node are interior
Use state information is deposited, the hierarchical relationship between each memory block can be well understood, and then can be convenient
Memory management reliably is carried out to memory block.
Brief description of the drawings
Fig. 1 is the first workflow diagram of the EMS memory management process of the embodiment of the present invention;
Fig. 2 is the second workflow diagram of the EMS memory management process of the embodiment of the present invention;
Fig. 3 for the embodiment of the present invention EMS memory management process in memory node tree structural representation;
Fig. 4 for the embodiment of the present invention EMS memory management process in memory node structural representation;
Fig. 5 for the embodiment of the present invention EMS memory management process in Memory Allocation workflow diagram;
Fig. 6 is the structured flowchart of the memory management device of the embodiment of the present invention.
Embodiment
To make the technical problem to be solved in the present invention, technical scheme and advantage clearer, below in conjunction with tool
Body embodiment and accompanying drawing are described in detail.
The embodiment provides a kind of EMS memory management process and device, existing memory management side is solved
The problem of method reliability and relatively low convenience.
First embodiment:
As shown in figure 1, the EMS memory management process of the embodiment of the present invention, including:
Step 11:Memory node tree construction is created, the memory node tree construction includes:Multiple memory nodes,
Record has the memory node and other memory nodes in the memory node tree construction in each memory node
Between incidence relation, and memory block shared by the memory node internal memory use state information.
In a particular embodiment of the present invention, memory node tree construction may particularly include root memory node, the root
Both defined in the sub- memory node of at least one of memory node, each memory node shared by the memory node
The relevant informations such as particular location, the size of memory block and the related information between other memory nodes, only
This memory node can be obtained, it is possible to obtain the internal memory use state information of its child node.
Step 12:According to the memory node tree construction, memory management is carried out in the memory node.
Specifically, the distribution of internal memory, reassignment and release can all be carried out in memory node, without reusing
Standard library function malloc, realloc and free etc. are operated.When carrying out internal memory operation, it is necessary to refer to
Some fixed specific memory node, is then carried out in the above.A current memory node can be specifically defined,
For representing the memory node of current operation, current memory node can be switched to needs operated in
Deposit node.
The EMS memory management process of the embodiment of the present invention, creates memory node tree construction, memory node tree construction bag
Include:Record has the memory node and its in memory node tree construction in multiple memory nodes, each memory node
Incidence relation between his memory node, and memory block shared by the memory node internal memory use state information;
According to memory node tree construction, memory management is carried out in memory node.According to internal memory in the embodiment of the present invention
Related information between the memory node recorded in node tree, and memory block shared by each memory node are interior
Use state information is deposited, the hierarchical relationship between each memory block can be well understood, and then can be convenient
Memory management reliably is carried out to memory block.
Second embodiment:
As shown in Fig. 2 the EMS memory management process of the embodiment of the present invention, including:
Step 21:Memory node tree construction is created, the memory node tree construction includes:Multiple memory nodes,
Record has the memory node and other memory nodes in the memory node tree construction in each memory node
Between incidence relation, and memory block shared by the memory node internal memory use state information.
Here, internal memory use state information includes memory block chained list and free memory piece array, the memory block
Chained list is used to record all memory blocks shared by the memory node, arranging by preset order, the sky
Not busy Memory slice array is used to record the Memory slice that is recovered in the memory block, wherein, the Memory slice be
The internal memory fragment of generation during Memory Allocation is carried out in the memory block.
In a particular embodiment of the present invention, memory node tree was composition tree structure progress between memory node
Management, as shown in Figure 3.Memory node tree includes root memory node (memory node 1), the root memory section
The sub- memory node (memory node 2, memory node 3, memory node 4, memory node 5) of point, internal memory section
The sub- memory node (memory node 6) of point 2 and the sub- memory node (memory node 8) of memory node 3,
The structure of each memory node is specific as shown in figure 4, including multiple memory blocks, each memory block includes multiple
Memory slice, and for recording the idle array of Memory slice for the Memory slice being recovered in memory block.Pass through the internal memory
Node tree structure can track establishment and the service condition of all memory nodes, when one new internal memory of establishment
During node, added to below some already present memory node and be used as its child node.Allowed when removing internal memory
Node to be deleted begins stepping through memory node tree as root node can be complete by the internal memory of its all nodes occupancy
Release.In addition, more than one top layer memory node can be created in program as needed.
Concrete example illustrates the internal structure of memory node below.
As follows, the example of a data structure 1 just represents a memory node, and the structure is shown
The specifying information of each memory node.The field to the structure is described in detail below.
Data structure 1:
Data structure 2:
Wherein, memory block chained list blocks:
The element is the pointer of a sensing MemoryBlock structure, and MemoryBlock is used to represent one
Memory block.A single-track link table is linked into by next fields between MemoryBlock, and MemoryInfo
Blocks fields then point to the head of this chained list.
FreeList arrays:
The array is used to being maintained in the free memory piece that is recovered in memory block, these free memory pieces will by with
In reallocation.FreeList array element types are MemoryChunk pointer types, and array length is by grand
ALLOCSET_NUM_FREELISTS is defined, and is now designed as 11.
Each MemoryInfo structures correspond to the internal memory service condition of a memory node, MemoryInfo institutes
The region of memory of management is divided into several memory blocks (block), memory block MemoryBlock structures (number
According to structure 3) represent.It is divided into multiple lists for being referred to as Memory slice (MemoryChunk) in each memory block again
Member.
Data structure 3:
MemoryBlock is recorded at the initial address of one piece of region of memory, and this block region of memory passes through standard
Built-in function malloc is allocated, referred to as one memory block.Production during Memory Allocation is carried out in each memory block
Raw internal memory fragment is referred to as Memory slice, and each Memory slice includes a header information and data area, wherein
Header information includes other relevant informations of the memory node and the memory field belonging to the Memory slice, data field
Then store real data.The header information of Memory slice describes (data structure by data structure MemoryChunk
4), the data area of Memory slice is then distributed after its header information.
Data structure 4:
In a particular embodiment of the present invention, memory node tree system is that memory block allocates one in advance to operating system
Determine internal memory, so that system needs the place of Memory Allocation to use, reduce to system repeatedly application, releasing memory
Number of times, improve Memory Allocation efficiency and systematic entirety energy.
Step 22:According to the memory node tree construction, Memory Allocation or interior is carried out in the memory node
Deposit release.
Using a kind of memory management mechanism for being referred to as memory node tree in the embodiment of the present invention, the internal memory in system
Batch operation is carried out in various semantic memory nodes, and all memory headrooms distributed in memory node are all
Recorded by memory node.It is therein all interior to discharge that releasing memory node can be easily passed very much
Hold, go to discharge each of which block internal memory without expense heart so that random memory it is more quick and
Reliably.
The random memory management process in the embodiment of the present invention is specifically described below.
(1) Memory Allocation is managed
As shown in figure 5, in the embodiment of the present invention, according to the memory node tree construction, in the internal memory section
Memory Allocation is carried out in point, including:
Step 51:In multiple memory nodes of the memory node tree, it is determined that needing to carry out Memory Allocation
Current memory node.
Step 52:Judge to apply for whether storage allocation is more than in the memory block shared by the current memory node
Allow the maximum of storage allocation piece, draw the first judged result.
Step 53:If first judged result is yes, a new memory block is distributed, by the new internal memory
All internal memories of block are allocated as a Memory slice, and the new memory block is added into the memory block
Behind the movable memory block of chained list, the movable memory block ranks the first in the memory block chained list
Memory block.
Here, after the new memory block is added to behind the movable memory block of the memory block chained list,
Return to the pointer of the Memory slice dispensed.
Step 54:If first judged result is no, the free memory of the current memory node is judged
It whether there is suitable free memory piece in piece array, draw the second judged result.
Step 55:If second judged result is yes, to the free memory piece of the current memory node
Suitable free memory piece is allocated in array, otherwise, in the movable memory block of the current memory node
Middle carry out Memory Allocation.
If specifically, in the presence of suitable free memory piece, being multiplexed, and returning to multiplexing free memory piece
Pointer.Wherein, judge in the free memory piece array of the current memory node with the presence or absence of suitable empty
Not busy Memory slice, including:Judge idle with the presence or absence of one in the free memory piece array of the current memory node
Memory slice meets preparatory condition, and the preparatory condition is more than application distribution for the internal memory of the free memory piece
Internal memory difference between internal memory, and the internal memory of the free memory piece and the internal memory of application distribution is in pre-
If in scope;If meeting institute in the presence of a free memory piece in the free memory piece array of the current memory node
Preparatory condition is stated, then judges there is the suitable free time in the free memory piece array of the current memory node
Memory slice, otherwise, judges suitable sky is not present in the free memory piece array of the current memory node
Not busy Memory slice.
Further, it is above-mentioned to carry out Memory Allocation in the movable memory block of the current memory node, including:
Judge whether unappropriated internal memory is more than or equal to application in the movable memory block of the current memory node
Storage allocation, draws the 3rd judged result;
If the 3rd judged result is yes, in the movable memory block of the current memory node distribution with
The Memory slice of the application storage allocation correspondence size;
, will be unallocated in the movable memory block of the current memory node if the 3rd judged result is no
Internal memory be added in the free memory piece array of the current memory node, and distribute redistribute an internal memory
Block, the Memory slice of distribution size corresponding with the application storage allocation in the memory block redistributed, and will
The memory block redistributed as the current memory node movable memory block.
Here, when unappropriated internal memory is less than application storage allocation in the movable memory block of current memory node,
Need to redistribute a memory block, but also have unallocated space in movable memory block currently, if dividing again
With memory block and as new movable memory block, then the unallocated space in current active memory block will
Waste.In order to avoid wasting, the embodiment of the present invention first decomposes the unallocated space in current active memory block
Into number few Memory slice (i.e. each Memory slice is as big as possible) as far as possible, and it is empty to add them into Memory slice
In not busy array, then redistribute a memory block (its size is twice of memory block of preceding primary distribution,
But no more than the maximum of memory block) and (it is added to memory block chained list using it as new movable memory block
Stem).The Memory slice of size corresponding with application storage allocation is finally distributed in new movable memory block, and
Return to its pointer.
(2) internal memory release management
In a particular embodiment of the present invention, the internal memory in releasing memory node, mainly there is following two modes:
(1) Memory slice specified in releasing memory node:
Whole memory block is monopolized to the Memory slice of release, i.e., the Memory slice is to exceed to allow distribution in memory block
The maximum of Memory slice and distribute, then whole memory block is directly discharged, returns to operating system.Otherwise,
The Memory slice is added in the idle array of Memory slice so as to lower sub-distribution.
Released order specifically, receiving Memory slice;
Released order according to the Memory slice, judge the internal memory of Memory slice to be released whether more than described to be released
Memory slice, which belongs to, allows the maximum of storage allocation piece in memory block, draw the 4th judged result;
If the 4th judged result is yes, the Memory slice to be released is discharged, otherwise, waits to release by described
Put Memory slice and be added to the free memory piece number that the Memory slice to be released belongs to memory block correspondence memory node
In group.
(2) releasing memory node full memory block
All memory blocks in current memory node are discharged, but memory node can't discharge in itself, because interior
It is the internal memory applied in father node to deposit node, will be managed by father node.
Released order specifically, receiving memory node;
Released order according to the memory node and memory node to be released and its in the memory node tree construction
Incidence relation between his memory node, judges that the memory node to be released whether there is sub- memory node;
If the memory node to be released has sub- memory node, the memory node to be released and institute are discharged
All memory blocks shared by the sub- memory node of memory node to be released are stated, otherwise, are discharged described to be released
All memory blocks shared by memory node.
The embodiment of the present invention reduces the number of times to system repeatedly application, releasing memory, improves Memory Allocation effect
Rate, improves systematic entirety energy, reduces memory fragmentation, improves memory usage.
3rd embodiment:
As shown in fig. 6, embodiments of the invention additionally provide a kind of memory management device, including:
Creation module 61, for creating memory node tree construction, the memory node tree construction includes:It is multiple
Record has the memory node and its in the memory node tree construction in memory node, each memory node
Incidence relation between his memory node, and memory block shared by the memory node internal memory use state information;
Management module 62, for according to the memory node tree construction, internal memory to be carried out in the memory node
Management.
The memory management device of the embodiment of the present invention, the management module 62 is specifically for according to the internal memory section
Point-tree data structure, carries out Memory Allocation or internal memory release in the memory node.
The memory management device of the embodiment of the present invention, the internal memory use state information include memory block chained list and
Free memory piece array, the memory block chained list is used to record shared by the memory node, suitable by presetting
All memory blocks of sequence arrangement, it is interior that the free memory piece array is recovered for recording in the memory block
Piece is deposited, wherein, the Memory slice is the internal memory fragment of generation when Memory Allocation is carried out in the memory block.
The memory management device of the embodiment of the present invention, the management module 62 includes:
Determination sub-module 621, in multiple memory nodes of the memory node tree, it is determined that needing to carry out
The current memory node of Memory Allocation;
First judging submodule 622, for judging whether application storage allocation is more than the current memory node institute
Allow the maximum of storage allocation piece in the memory block of occupancy, draw the first judged result;
First processing submodule 623, if being yes for first judged result, distributes a new memory block,
It is allocated all internal memories of the new memory block as a Memory slice, and the new memory block is added
To behind the movable memory block of the memory block chained list, the movable memory block is in the memory block chained list
In the memory block that ranks the first;
Second judging submodule 624, if being no for first judged result, judges the current memory
It whether there is suitable free memory piece in the free memory piece array of node, draw the second judged result;
Second processing submodule 625, if being yes for second judged result, to the current memory section
Suitable free memory piece is allocated in the free memory piece array of point, otherwise, in the current memory section
Memory Allocation is carried out in the movable memory block of point.
The memory management device of the embodiment of the present invention, the second processing submodule 625 includes:
It is unappropriated in first judging unit 6251, the movable memory block for judging the current memory node
Whether internal memory is more than or equal to application storage allocation, draws the 3rd judged result;
Allocation unit 6252, if being yes for the 3rd judged result, in the current memory node
The Memory slice of distribution size corresponding with the application storage allocation in movable memory block;
Processing unit 6253, if being no for the 3rd judged result, by the current memory node
Unappropriated internal memory is added in the free memory piece array of the current memory node in movable memory block, and
A memory block is redistributed in distribution, and distribution is corresponding with the application storage allocation in the memory block redistributed
The Memory slice of size, and using the memory block redistributed as the current memory node movable internal memory
Block.
The memory management device of the embodiment of the present invention, second judging submodule 624 includes:
In second judging unit 6241, the free memory piece array for judging the current memory node whether
Preparatory condition is met in the presence of a free memory piece, the preparatory condition is more than for the internal memory of the free memory piece
Apply for the internal memory between the internal memory of distribution, and the internal memory of the free memory piece and the internal memory of application distribution
Difference is in preset range;
3rd judging unit 6242, if for having one in the free memory piece array of the current memory node
Free memory piece meets the preparatory condition, then judges the free memory piece array of the current memory node
In there is suitable free memory piece, otherwise, judge the free memory piece array of the current memory node
In be not present suitable free memory piece.
The memory management device of the embodiment of the present invention, the management module 62 includes:
First receiving submodule 626, releases order for receiving Memory slice;
3rd judging submodule 627, for being released order according to the Memory slice, judges Memory slice to be released
Whether internal memory, which is more than the Memory slice to be released, which belongs to, allows the maximum of storage allocation piece in memory block, obtain
Go out the 4th judged result;
3rd processing submodule 628, if being yes for the 4th judged result, discharges described to be released interior
Piece is deposited, otherwise, the Memory slice to be released is added to the Memory slice to be released and belongs to memory block correspondence
In the free memory piece array of memory node.
The memory management device of the embodiment of the present invention, the management module 62 includes:
Second receiving submodule 629, releases order for receiving memory node;
4th judging submodule 6210, for being released order according to the memory node and memory node to be released
With the incidence relation between other memory nodes in the memory node tree construction, the internal memory to be released is judged
Node whether there is sub- memory node;
Fourth process submodule 6211, if there is sub- memory node for the memory node to be released, is released
Put all internal memories shared by the sub- memory node of the memory node to be released and the memory node to be released
Block, otherwise, discharges all memory blocks shared by the memory node to be released.
It should be noted that the device is device corresponding with above method embodiment, above method embodiment
In all implementations suitable for the embodiment of the device, can also reach identical technique effect.
The EMS memory management process and device of the embodiment of the present invention, create memory node tree construction, memory node tree
Structure includes:Record has the memory node to be tied with memory node tree in multiple memory nodes, each memory node
Incidence relation between the memory node of other in structure, and the internal memory of memory block uses shape shared by the memory node
State information;According to memory node tree construction, memory management is carried out in memory node.In the embodiment of the present invention
It is interior according to the related information between the memory node recorded in memory node tree, and shared by each memory node
The internal memory use state information of counterfoil, can be well understood the hierarchical relationship between each memory block, and then
Convenient memory management reliably can be carried out to memory block.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in this hair
Within bright spirit and principle, any modification, equivalent substitution and improvements made etc. should be included in this hair
Within bright protection domain.
Claims (16)
1. a kind of EMS memory management process, it is characterised in that including:
Memory node tree construction is created, the memory node tree construction includes:Multiple memory nodes, Mei Gesuo
Stating record in memory node has in the memory node and the memory node tree construction between other memory nodes
Incidence relation, and memory block shared by the memory node internal memory use state information;
According to the memory node tree construction, memory management is carried out in the memory node.
2. EMS memory management process according to claim 1, it is characterised in that described according to the internal memory section
Point-tree data structure, carries out memory management in the memory node, including:
According to the memory node tree construction, Memory Allocation or internal memory release are carried out in the memory node.
3. EMS memory management process according to claim 2, it is characterised in that the internal memory use state
Information includes memory block chained list and free memory piece array, and the memory block chained list is used to record the internal memory section
All memory blocks that point is shared, arranged by preset order, the free memory piece array is used to record institute
The Memory slice being recovered in memory block is stated, wherein, the Memory slice is that internal memory point is carried out in the memory block
The internal memory fragment that timing is produced.
4. EMS memory management process according to claim 3, it is characterised in that described according to the internal memory
Node tree structure, carries out Memory Allocation in the memory node, including:
In multiple memory nodes of the memory node tree, it is determined that needing to carry out the current memory of Memory Allocation
Node;
Judge that applying for whether storage allocation is more than in the memory block shared by the current memory node allows distribution
The maximum of Memory slice, draws the first judged result;
If first judged result is yes, a new memory block is distributed, by all of the new memory block
Internal memory is allocated as a Memory slice, and the new memory block is added to the work of the memory block chained list
Behind dynamic memory block, the movable memory block is the memory block ranked the first in the memory block chained list;
If first judged result is no, in the free memory piece array for judging the current memory node
With the presence or absence of suitable free memory piece, the second judged result is drawn;
If second judged result is yes, to being closed in the free memory piece array of the current memory node
Suitable free memory piece is allocated, otherwise, is carried out in the movable memory block of the current memory node interior
Deposit distribution.
5. EMS memory management process according to claim 4, it is characterised in that described described current interior
Memory Allocation is carried out in the movable memory block for depositing node, including:
Judge whether unappropriated internal memory is more than or equal to application in the movable memory block of the current memory node
Storage allocation, draws the 3rd judged result;
If the 3rd judged result is yes, in the movable memory block of the current memory node distribution with
The Memory slice of the application storage allocation correspondence size;
, will be unallocated in the movable memory block of the current memory node if the 3rd judged result is no
Internal memory be added in the free memory piece array of the current memory node, and distribute redistribute an internal memory
Block, the Memory slice of distribution size corresponding with the application storage allocation in the memory block redistributed, and will
The memory block redistributed as the current memory node movable memory block.
6. EMS memory management process according to claim 4, it is characterised in that the judgement is described current
It whether there is suitable free memory piece in the free memory piece array of memory node, including:
Judge pre- with the presence or absence of free memory piece satisfaction in the free memory piece array of the current memory node
If condition, the preparatory condition is more than the internal memory of application distribution for the internal memory of the free memory piece, and described
Internal memory difference between the internal memory of free memory piece and the internal memory of application distribution is in preset range;
If meeting described default in the presence of a free memory piece in the free memory piece array of the current memory node
There is suitable free memory piece in condition, then the free memory piece array for judging the current memory node,
Otherwise, judge suitable free memory piece is not present in the free memory piece array of the current memory node.
7. EMS memory management process according to claim 3, it is characterised in that described according to the internal memory
Node tree structure, carries out internal memory release in the memory node, including:
Memory slice is received to release order;
Released order according to the Memory slice, judge the internal memory of Memory slice to be released whether more than described to be released
Memory slice, which belongs to, allows the maximum of storage allocation piece in memory block, draw the 4th judged result;
If the 4th judged result is yes, the Memory slice to be released is discharged, otherwise, waits to release by described
Put Memory slice and be added to the free memory piece number that the Memory slice to be released belongs to memory block correspondence memory node
In group.
8. EMS memory management process according to claim 3, it is characterised in that described according to the internal memory
Node tree structure, carries out internal memory release in the memory node, including:
Memory node is received to release order;
Released order according to the memory node and memory node to be released and its in the memory node tree construction
Incidence relation between his memory node, judges that the memory node to be released whether there is sub- memory node;
If the memory node to be released has sub- memory node, the memory node to be released and institute are discharged
All memory blocks shared by the sub- memory node of memory node to be released are stated, otherwise, are discharged described to be released
All memory blocks shared by memory node.
9. a kind of memory management device, it is characterised in that including:
Creation module, for creating memory node tree construction, the memory node tree construction includes:In multiple
Node is deposited, record has the memory node and other in the memory node tree construction in each memory node
Incidence relation between memory node, and memory block shared by the memory node internal memory use state information;
Management module, for according to the memory node tree construction, internal memory pipe to be carried out in the memory node
Reason.
10. memory management device according to claim 9, it is characterised in that the management module is specific
For according to the memory node tree construction, carrying out Memory Allocation or internal memory release in the memory node.
11. memory management device according to claim 10, it is characterised in that the internal memory uses shape
State information includes memory block chained list and free memory piece array, and the memory block chained list is used to record the internal memory
All memory blocks shared by node, being arranged by preset order, the free memory piece array is used to record
The Memory slice being recovered in the memory block, wherein, the Memory slice is that internal memory is carried out in the memory block
The internal memory fragment produced during distribution.
12. memory management device according to claim 11, it is characterised in that the management module bag
Include:
Determination sub-module, in multiple memory nodes of the memory node tree, it is determined that needing in progress
Deposit the current memory node of distribution;
First judging submodule, for judging whether application storage allocation is more than shared by the current memory node
Allow the maximum of storage allocation piece in memory block, draw the first judged result;
First processing submodule, if being yes for first judged result, distributes a new memory block,
It is allocated all internal memories of the new memory block as a Memory slice, and the new memory block is added
To behind the movable memory block of the memory block chained list, the movable memory block is in the memory block chained list
In the memory block that ranks the first;
Second judging submodule, if being no for first judged result, judges the current memory section
It whether there is suitable free memory piece in the free memory piece array of point, draw the second judged result;
Second processing submodule, if being yes for second judged result, to the current memory node
Free memory piece array in suitable free memory piece be allocated, otherwise, in the current memory node
Movable memory block in carry out Memory Allocation.
13. memory management device according to claim 12, it is characterised in that second processing
Module includes:
Unappropriated internal memory in first judging unit, the movable memory block for judging the current memory node
Whether it is more than or equal to application storage allocation, draws the 3rd judged result;
Allocation unit, if being yes for the 3rd judged result, in the activity of the current memory node
The Memory slice of distribution size corresponding with the application storage allocation in memory block;
Processing unit, if being no for the 3rd judged result, by the activity of the current memory node
Unappropriated internal memory is added in the free memory piece array of the current memory node in memory block, and is distributed
A memory block is redistributed, the distribution size corresponding with the application storage allocation in the memory block redistributed
Memory slice, and using the memory block redistributed as the current memory node movable memory block.
14. memory management device according to claim 12, it is characterised in that described second judges son
Module includes:
It whether there is in second judging unit, the free memory piece array for judging the current memory node
One free memory piece meets preparatory condition, and the preparatory condition is more than application for the internal memory of the free memory piece
Internal memory difference between the internal memory of distribution, and the internal memory of the free memory piece and the internal memory of application distribution
In preset range;
3rd judging unit, if idle for having one in the free memory piece array of the current memory node
Memory slice meets the preparatory condition, then is deposited in the free memory piece array for judging the current memory node
In suitable free memory piece, otherwise, judge in the free memory piece array of the current memory node not
In the presence of suitable free memory piece.
15. memory management device according to claim 11, it is characterised in that the management module bag
Include:
First receiving submodule, releases order for receiving Memory slice;
3rd judging submodule, for being released order according to the Memory slice, judges the interior of Memory slice to be released
Deposit and whether be more than the maximum that the Memory slice to be released belongs to permission storage allocation piece in memory block, draw
4th judged result;
3rd processing submodule, if being yes for the 4th judged result, discharges the internal memory to be released
Piece, otherwise, is added to the Memory slice to be released by the Memory slice to be released and belongs in memory block correspondence
In the free memory piece array for depositing node.
16. memory management device according to claim 11, it is characterised in that the management module bag
Include:
Second receiving submodule, releases order for receiving memory node;
4th judging submodule, for being released order according to the memory node and memory node to be released and institute
The incidence relation between other memory nodes in memory node tree construction is stated, the memory node to be released is judged
With the presence or absence of sub- memory node;
Fourth process submodule, if there is sub- memory node for the memory node to be released, discharges institute
All memory blocks shared by the sub- memory node of memory node to be released and the memory node to be released are stated,
Otherwise, all memory blocks shared by the memory node to be released are discharged.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610112157.2A CN107133182A (en) | 2016-02-29 | 2016-02-29 | A kind of EMS memory management process and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610112157.2A CN107133182A (en) | 2016-02-29 | 2016-02-29 | A kind of EMS memory management process and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107133182A true CN107133182A (en) | 2017-09-05 |
Family
ID=59721681
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610112157.2A Pending CN107133182A (en) | 2016-02-29 | 2016-02-29 | A kind of EMS memory management process and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107133182A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107844372A (en) * | 2017-10-17 | 2018-03-27 | 广东睿江云计算股份有限公司 | A kind of method of Memory Allocation, system |
CN109471724A (en) * | 2018-10-23 | 2019-03-15 | 郑州云海信息技术有限公司 | A kind of method and system of switch operating amount of memory |
WO2019137252A1 (en) * | 2018-01-10 | 2019-07-18 | Oppo广东移动通信有限公司 | Memory processing method, electronic device, and computer-readable storage medium |
CN112084028A (en) * | 2020-09-07 | 2020-12-15 | 北京字节跳动网络技术有限公司 | Memory detection method and device |
CN112214313A (en) * | 2020-09-22 | 2021-01-12 | 深圳云天励飞技术股份有限公司 | Memory allocation method and related equipment |
CN112596908A (en) * | 2020-12-28 | 2021-04-02 | 中孚安全技术有限公司 | Memory management method and system based on complete binary tree |
WO2021233187A1 (en) * | 2020-05-18 | 2021-11-25 | 中科寒武纪科技股份有限公司 | Method and device for allocating storage addresses for data in memory |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102012870A (en) * | 2010-11-18 | 2011-04-13 | 清华大学 | Memory allocation method |
CN102122306A (en) * | 2011-03-28 | 2011-07-13 | 中国人民解放军国防科学技术大学 | Data processing method and distributed file system applying same |
CN102999434A (en) * | 2011-09-15 | 2013-03-27 | 阿里巴巴集团控股有限公司 | Memory management method and device |
CN103902693A (en) * | 2014-03-28 | 2014-07-02 | 西安交通大学 | Method of read-optimized memory database T-tree index structure |
-
2016
- 2016-02-29 CN CN201610112157.2A patent/CN107133182A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102012870A (en) * | 2010-11-18 | 2011-04-13 | 清华大学 | Memory allocation method |
CN102122306A (en) * | 2011-03-28 | 2011-07-13 | 中国人民解放军国防科学技术大学 | Data processing method and distributed file system applying same |
CN102999434A (en) * | 2011-09-15 | 2013-03-27 | 阿里巴巴集团控股有限公司 | Memory management method and device |
CN103902693A (en) * | 2014-03-28 | 2014-07-02 | 西安交通大学 | Method of read-optimized memory database T-tree index structure |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107844372A (en) * | 2017-10-17 | 2018-03-27 | 广东睿江云计算股份有限公司 | A kind of method of Memory Allocation, system |
CN107844372B (en) * | 2017-10-17 | 2021-09-07 | 广东睿江云计算股份有限公司 | Memory allocation method and system |
WO2019137252A1 (en) * | 2018-01-10 | 2019-07-18 | Oppo广东移动通信有限公司 | Memory processing method, electronic device, and computer-readable storage medium |
CN109471724A (en) * | 2018-10-23 | 2019-03-15 | 郑州云海信息技术有限公司 | A kind of method and system of switch operating amount of memory |
WO2021233187A1 (en) * | 2020-05-18 | 2021-11-25 | 中科寒武纪科技股份有限公司 | Method and device for allocating storage addresses for data in memory |
CN112084028A (en) * | 2020-09-07 | 2020-12-15 | 北京字节跳动网络技术有限公司 | Memory detection method and device |
CN112084028B (en) * | 2020-09-07 | 2022-02-25 | 北京字节跳动网络技术有限公司 | Memory detection method and device |
CN112214313A (en) * | 2020-09-22 | 2021-01-12 | 深圳云天励飞技术股份有限公司 | Memory allocation method and related equipment |
CN112596908A (en) * | 2020-12-28 | 2021-04-02 | 中孚安全技术有限公司 | Memory management method and system based on complete binary tree |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107133182A (en) | A kind of EMS memory management process and device | |
CN104731799B (en) | Main memory DBM device | |
CN108038002B (en) | Embedded software memory management method | |
CN105302738B (en) | A kind of memory allocation method and device | |
CN101799797B (en) | Dynamic allocation method of user disk quota in distributed storage system | |
CN108132842B (en) | Embedded software memory management system | |
CN1085863C (en) | Memory management system of computer system | |
CN100382048C (en) | A managing method for EMS memory | |
CN103425538B (en) | Process communication method and system | |
KR101013073B1 (en) | Apparatus for Task Distribution and Parallel Processing System and Method there of | |
CN101459901B (en) | Vector map data transmission method based on multi-stage slicing mode | |
CA3177212A1 (en) | Resource allocating method, device, computer equipment, and storage medium | |
CN103886109B (en) | Method and device for realizing row lock of database | |
CN103765381B (en) | Parallel work-flow to B+ tree | |
CN106681829A (en) | Memory management method and system | |
CN104317742A (en) | Thin provisioning method for optimizing space management | |
CN106527963A (en) | Memory system and host apparatus | |
CN107783988A (en) | The locking method and equipment of a kind of directory tree | |
CN104850505B (en) | The EMS memory management process and system stacked based on chain type | |
CN108959113A (en) | Method and system for flash memory perception heap memory management | |
CN105991478A (en) | Server resource distribution method and system | |
CN103425435A (en) | Disk storage method and disk storage system | |
CN106155917A (en) | EMS memory management process and device | |
CN105550180B (en) | The method, apparatus and system of data processing | |
Lwin et al. | Non-redundant dynamic fragment allocation with horizontal partition in Distributed Database System |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20170905 |
|
WD01 | Invention patent application deemed withdrawn after publication |