CN102760080A - Memory management method and device - Google Patents

Memory management method and device Download PDF

Info

Publication number
CN102760080A
CN102760080A CN2011101049914A CN201110104991A CN102760080A CN 102760080 A CN102760080 A CN 102760080A CN 2011101049914 A CN2011101049914 A CN 2011101049914A CN 201110104991 A CN201110104991 A CN 201110104991A CN 102760080 A CN102760080 A CN 102760080A
Authority
CN
China
Prior art keywords
memory
memory node
node
function
application
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
CN2011101049914A
Other languages
Chinese (zh)
Other versions
CN102760080B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201110104991.4A priority Critical patent/CN102760080B/en
Publication of CN102760080A publication Critical patent/CN102760080A/en
Application granted granted Critical
Publication of CN102760080B publication Critical patent/CN102760080B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)
  • Memory System (AREA)

Abstract

The invention discloses memory management method and device, and belongs to the technical field of computers. The method comprises the following steps: acquiring a memory with preset size as a local memory pool through an application programming interface (API) of the memory of a platform, and initializing the memory pool; setting a memory node according to the memory pool; and when any one local application program function needs to use the memory, allocating a free memory node with memory equal to that needed by the application program function for the application program function. The device consists of a memory pool processing module, a memory node setting module and a memory allocating module. The memory management method and device can be used for realizing self locally memory management by acquiring a memory with preset size as the local memory pool and allocating or releasing the memory for the local different application program functions through a memory node mode, thus conveniently transplanting between different platforms.

Description

A kind of method and apparatus of memory management
Technical field
The present invention relates to field of computer technology, particularly a kind of method and apparatus of memory management.
Background technology
Development along with computer networking technology; Wireless interconnected network technology is also developing by leaps and bounds; Make the user not only can pass through mobile terminal device (for example mobile phone etc.) whenever and wherever possible with other people conversation; Can also be through the various types of application programs on the mobile terminal device, for example instant communication software, reader, browser of mobile terminal, map search etc. are realized other various functions.
At present in the application program operational process on mobile terminal device; The different internal memory API (Application Programming Interface, API) that the platform (running environment of mobile terminal device application software) of direct use mobile terminal device provides are that the difference in functionality of this application program distributes or releasing memory.
Yet in realizing process of the present invention, the inventor finds that there is following problem at least in prior art:
The characteristics of mobile terminal device are that platform is a lot, and the internal memory API that different platform provides might be different, when the application migration that will be applicable to certain platform may normally be moved during to other platforms, for the transplanting of application program brings difficulty.
Summary of the invention
In order to solve prior art problems, the embodiment of the invention provides a kind of method and apparatus of memory management.Said technical scheme is following:
A kind of method of memory management, said method comprises:
Memory applications DLL API through platform obtains the memory pool of the internal memory of a preset size as this locality, and the said memory pool of initialization;
According to said memory pool memory node is set;
When arbitrary function of application of this locality need be used internal memory, distribute an internal memory for said function of application and equal the free memory node of the required internal memory of said function of application.
A kind of device of memory management, said device comprises:
The memory pool processing module is used for obtaining the memory pool of the internal memory of a preset size as this locality through the memory applications DLL API of platform, and the said memory pool of initialization;
Memory node is provided with module, is used for behind the said memory pool of said memory pool processing module initialization, according to said memory pool memory node being set;
Memory allocating module is used for when local arbitrary function of application need be used internal memory, distributing an internal memory for said function of application and equaling the free memory node of the required internal memory of said function of application.
The beneficial effect of the technical scheme that the embodiment of the invention provides is:
Internal memory through obtaining a preset size is as the memory pool of this locality, and be that local different application function is distributed or releasing memory through the mode of memory node, realizes locally oneself internally depositing into the administration-management reason, thereby conveniently between different platform, transplants.
Description of drawings
Fig. 1 is the method flow diagram of a kind of memory management of providing of the embodiment of the invention 1;
Fig. 2 is the method flow diagram of a kind of memory management of providing of the embodiment of the invention 2;
Fig. 3 is the apparatus structure synoptic diagram of first kind of memory management providing of the embodiment of the invention 3;
Fig. 4 is the apparatus structure synoptic diagram of second kind of memory management providing of the embodiment of the invention 3;
Fig. 5 is the apparatus structure synoptic diagram of the third memory management of providing of the embodiment of the invention 3;
Fig. 6 is the apparatus structure synoptic diagram of the 4th kind of memory management providing of the embodiment of the invention 3;
Fig. 7 is the apparatus structure synoptic diagram of the 5th kind of memory management providing of the embodiment of the invention 3.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, will combine accompanying drawing that embodiment of the present invention is done to describe in detail further below.
Embodiment 1
Referring to Fig. 1, the embodiment of the invention provides a kind of method of memory management, comprising:
101: the memory applications DLL API through platform obtains the memory pool of the internal memory of a preset size as this locality, and this memory pool of initialization.
102: memory node is set according to this memory pool.
103: when arbitrary function of application of this locality need be used internal memory, distribute an internal memory for this function of application and equal the free memory node of the required internal memory of this function of application.
Further, when arbitrary function of application of this locality need be used internal memory, distribute an internal memory for this function of application and equal the free memory node of the required internal memory of this function of application, specifically comprise:
When arbitrary function of application of this locality need be used internal memory, audit memory node chained list;
Judge whether to inquire the first free memory node of an internal memory more than or equal to the required internal memory of this function of application;
If can, then this first free memory node is divided, obtain the second free memory node that an internal memory equals the required internal memory of this function of application, the second free memory node is distributed to this function of application.
Further, this first free memory node is divided, obtains the second free memory node that an internal memory equals the required internal memory of this function of application, the second free memory node is distributed to this function of application, specifically comprise:
The first free memory node is deleted from the memory node chained list;
With the first free memory node splitting is the second free memory node that an internal memory equals the required internal memory of this function of application, and internal memory equals the 3rd free memory node of difference of internal memory of internal memory and the second free memory node of the first free memory node;
The memory node state of the second free memory node is set to user mode, distributes to this function of application then, and the 3rd free memory node is inserted in the memory node chained list, and the attribute of memory pool is changed.
Further, this method also comprises:
When arbitrary function of application of this locality needs releasing memory; Obtain the physical location of the employed memory node of this function of application; With the memory node status modifier of the employed memory node of this function of application is idle condition, and revises the attribute of memory pool;
Judge in the adjacent memory node of the physics of the employed memory node of this function of application whether idle memory node is arranged,
If no, then the employed memory node of this function of application is inserted in the memory node chained list.
Further, this method also comprises:
When in the adjacent memory node of the physics of judging the employed memory node of this function of application idle memory node being arranged, the free memory node that the employed memory node of this function of application is adjacent with its physics is merged into a memory node;
Judge to merge in the adjacent memory node of the physics of the memory node that obtains whether idle memory node is arranged;
If the memory node that no, then merging is obtained is inserted in the memory node chained list.
Further, this method also comprises:
When in the adjacent memory node of the physics of judging the memory node that merging obtains idle memory node being arranged; The free memory node that the memory node that merging is obtained is adjacent with its physics is merged into a memory node, carry out to judge merges the step whether idle memory node is arranged in the adjacent memory node of the physics of the memory node that obtains then.
Further, this method also comprises:
When this locality is withdrawed from, print the operating position and the internal memory illegal operation record of all memory nodes according to the attribute of memory pool, the memory applications DLL API of calling platform discharges memory pool.
The method of the described memory management of the embodiment of the invention; Preset the memory pool of the internal memory of size through obtaining one as this locality; And the mode of passing through memory node is that local different application function is distributed or releasing memory; Realize that this locality oneself internally deposits into the administration-management reason, thereby conveniently between different platform, transplant.Internal memory through obtaining a preset size is as the memory pool of this locality, and be that local different application function is distributed or releasing memory through the mode of memory node, is convenient to the operating position of internal memory is followed the tracks of the situation of avoiding the internal memory use to cross the border.The operating position and the internal memory illegal operation record of all memory nodes that print according to the attribute of memory pool; Which local uses that internal memory is illegal, which local internal memory that causes is revealed can to find out the browser of mobile terminal application program, thus can change accordingly avoid the use of internal memory illegal with the internal memory leakage.And when the local program code logic goes wrong, avoid crashing thereby can carry out corresponding modification in the position of can the record logic in the operating position of all memory nodes that print according to the attribute of memory pool and the internal memory illegal operation record ging wrong.In addition, when quoting internal memory, can add inspection, illegally can point out the user serious problems to occur, please relevant information fed back to the developer if be checked through refers to.
The method of the described memory management of the embodiment of the invention can be applied in the various types of application programs on the mobile terminal device, also can be applied to this not done concrete qualification in the various types of application programs on other equipment such as computing machine.For the ease of understanding, be that example further specifies to be applied to the browser of mobile terminal application program below.
Embodiment 2
Referring to Fig. 2, the embodiment of the invention provides a kind of method of memory management, comprising:
201: when the browser of mobile terminal application program launching, the browser of mobile terminal application program is obtained the memory pool of the internal memory of a preset size as himself through the internal memory API of platform, and this memory pool of initialization.
Particularly; When the browser of mobile terminal application program launching; The browser of mobile terminal application program is preset the internal memory of size to platform application one through the internal memory API of platform; After platform receives application, be the internal memory of this browser of mobile terminal application assigned one preset size through internal memory API.
Particularly, can estimate the memory size of these browser of mobile terminal application program needs, the internal memory of a preset size is set according to the internal memory of each function needs in the browser of mobile terminal application program.And can the internal memory of preset size be adjusted according to the final operation result of browser of mobile terminal application program, to reach optimum result.For example: suppose in the embodiment of the invention to estimate that according to the internal memory of each function needs in the browser of mobile terminal application program memory size of these browser of mobile terminal application program needs is 500k, then be provided with preset size in save as 500k.The back finds that according to the final operation result of browser of mobile terminal application program the internal memory of these browser of mobile terminal application program needs 400k just can normally move, and therefore can internal memory that preset size be revised as 400k.
Particularly; For memory pool is provided with a memory pool structure its attribute is described in the embodiment of the invention; Comprise in the memory pool structure that memory pool first address, memory pool size, memory pool use memory pool attributes such as filename and the line number of byte number, memory pool free word joint number, memory node chained list gauge outfit, the Memory Allocation number of times that is used to debug, internal memory release times, Memory Allocation number of times, maximum memory node number, current memory node number, Memory Allocation; But need to prove to be not limited to above-mentioned attribute, can increase other attributes or reduce wherein some attribute according to the practical application situation.The initialization memory pool is about to each memory pool attribute and composes to the memory pool structure.
202: memory node (Node) is set according to this memory pool.
Particularly; Memory management is based on the memory node notion in the embodiment of the invention; When arbitrary function of browser of mobile terminal application program need be used internal memory; Through realizing for the mode of this function storage allocation node; Memory node structure of definition removes to describe the attribute of this memory node in the embodiment of the invention; Comprise in the memory node structure browser of mobile terminal application file name and the place file at memory node state (comprise free time (free) and use 2 kinds of states), memory node length, storage allocation node place row number, memory node life period, point to two attributes such as pointer of memory node, but need to prove and be not limited to above-mentioned attribute, can increase other attributes or reduce wherein some attribute according to the practical application situation.Wherein, The first address of the tail address of the previous memory node of this memory node of pointed in two pointers of sensing memory node, a back memory node of another this memory node of pointed; The pointer of each memory node constitutes list structure; Remove to describe each free memory node (the memory node state is idle memory node) through list structure; For searching and use, and two pointer fields of memory node can be filled user data in being assigned with the memory node that uses, and can save a little internal memories like this.The pointer of each free memory node exists with list structure, forms the memory node chained list, can obtain each free memory node through audit memory node chained list.
Particularly, memory node is set according to this memory pool, be with whole memory pool as a memory node, and the memory node state that this memory node is set is idle.For example: suppose to be provided with in the embodiment of the invention preset size in save as 500k, then the memory pool of this browser of mobile terminal application program is 500k, the memory node of setting is 500k, and the memory node state of this memory node is idle.
203: detect the running status of browser of mobile terminal application program,, then carry out 204 if arbitrary function of browser of mobile terminal application program need be used the state of internal memory; If arbitrary function of browser of mobile terminal application program needs the state of releasing memory, then carry out 206; If the state that the browser of mobile terminal application program withdraws from then carries out 212.
204: browser of mobile terminal application queries memory node chained list, judge whether to inquire the first free memory node (note make pNode1) of an internal memory more than or equal to the required internal memory of this function, if could would carry out 205; Otherwise, carry out 212.
For example: arbitrary function of supposing the browser of mobile terminal application program need be used the internal memory of one 32 byte; Browser of mobile terminal application queries memory node chained list; Obtain the first free memory node of a byte number, then carry out 205 greater than 32 bytes.And, thereby inquire the concrete physical location that the first free memory node promptly can obtain the definite first free memory node of first address of the first free memory node.
Wherein, The size of the required internal memory of this function of browser of mobile terminal application program is: the internal memory that the user data of the required use of this function takies; Add the size of memory node structure; Add the size (be used for depositing the length of memory node, be generally 4 bytes) of memory node tail structure body.But; If two pointer fields of memory node also are used to fill user data; Then the size of the required internal memory of this function of browser of mobile terminal application program is: the internal memory that the user data of the required use of this function takies; Add the size (removing the size of two pointers) of memory node structure, add the size of memory node tail structure body.
205: the browser of mobile terminal application program divides this first free memory node; Obtain the second free memory node (note is made pNode2) that an internal memory equals the required internal memory of this function; The second free memory node is distributed to this function of browser of mobile terminal application program, carry out 203 then.
Particularly, the process of division is following: the first free memory node is deleted from the memory node chained list; Size according to the needed internal memory of this function of the size of the internal memory of the first free memory node and browser of mobile terminal application program; Be the equal-sized second free memory node (note is made pNode2) of the needed internal memory of this function of size and the browser of mobile terminal application program of an internal memory with the first free memory node splitting, and the size of an internal memory is the 3rd free memory node (note is made pNode3) of difference of size of internal memory of size and the second free memory node of the internal memory of the first free memory node; The state of the second free memory node is set to user mode, distributes to this function of browser of mobile terminal application program, and the 3rd free memory node is inserted in the memory node chained list; Attribute to memory pool is changed, such as, the filename of maximum memory node number, current memory node number, Memory Allocation number of times, internal memory use byte number, internal memory free word joint number, Memory Allocation and line number etc.
206: the physical location that obtains the employed memory node of this function of browser of mobile terminal application program; With the memory node status modifier of the employed memory node of this function is idle condition; Revise the attribute (such as the internal memory release times etc.) of memory pool; Judge in the adjacent memory node of the physics of the employed memory node of this function whether idle memory node is arranged,, then carry out 207 if having; Otherwise, carry out 211.
Wherein, the method for obtaining the memory address of the employed memory node of this function that the physical location of the employed memory node of this function of browser of mobile terminal application program specifically can be through obtaining the browser of mobile terminal application program realizes.
207: the free memory node that the employed memory node of this function is adjacent with its physics is merged into a memory node.
208: judge to merge in the adjacent memory node of the physics of the memory node that obtains whether idle memory node is arranged,, then carry out 209 if having; Otherwise, carry out 210.
209: the free memory node that the memory node that merging is obtained is adjacent with its physics is merged into a memory node, carries out 208 then.
210: the memory node that merging is obtained is inserted in the memory node chained list, carries out 203 then.
211: the employed memory node of this function is inserted in the memory node chained list, carries out 203 then.
For example: suppose that mode with 204-205 is that 3 functions in the browser of mobile terminal application program have been distributed a memory node (note is made pNode1, pNode2, pNode3 respectively) respectively; Corresponding memory node address exists in 3 variablees (note is made pMem1, pMem2, pMem3 respectively), and have 4 memory nodes in the memory pool this moment, and wherein 3 are to use state; 1 is idle condition; Wherein, 3 are assigned with memory node physics are adjacent successively, and the memory node of 1 idle condition is on the right side of pNode3 physical location; Suppose to discharge pNode2, pNode3, process is following:
When at first discharging pNode2, obtaining the first address of pNode2 according to pMem2, is idle condition with the memory node status modifier of pNode2, revises the attribute of memory pool then, such as the idle number of times of memory node etc.Judge in the adjacent memory node of the physics of pNode2 whether idle memory node is arranged, this moment pNode2 the adjacent memory node of physics in do not have the free memory node, so pNode2 is inserted in the memory node chained list.And because pNode2 is in the left side of free memory node physical location, so pNode2 become the gauge outfit of memory node chained list.And then when discharging pNode3, obtain the first address of pNode3 according to pMem3, and be idle condition with the memory node status modifier of pNode3, revise the attribute of memory pool then, such as the idle number of times of memory node etc.Judge in the adjacent memory node of the physics of pNode3 whether idle memory node is arranged; In the memory node that the physics of pNode3 is adjacent at this moment idle memory node (pNode2) is arranged; So pNode3 and pNode2 are merged, the adjacent right node of physics of the memory node after pNode3 and pNode2 merge also is a free memory node, so merge once more; Whole like this memory pool becomes two memory nodes, a pNode1 and the free memory node that merging obtains.If follow-uply then also will discharge pNode1, then discharge pNode1 after, whole memory pool is got back to original state again.
212: print the operating position and the internal memory illegal operation record of all memory nodes according to the attribute of memory pool, the internal memory API of calling platform discharges memory pool.
Need to prove; Be that method with above-mentioned memory management directly is nested in the browser of mobile terminal application program and realizes memory management in the embodiment of the invention; Can also be in the practical application with the method for above-mentioned memory management separately as a memory management subroutine; LZT the browser of mobile terminal application program runs to memory management, get final product through invoke memory supervisory routine corresponding interface, concrete implementation method is not done concrete qualification.
The method of the described memory management of the embodiment of the invention; The browser of mobile terminal application program is preset the memory pool of the internal memory of size as himself through obtaining one; And the mode of passing through memory node is the difference in functionality distribution or the releasing memory of this application program; Realize oneself internally depositing into the administration-management reason, thereby conveniently between different platform, transplant.The browser of mobile terminal application program is preset the memory pool of the internal memory of size as himself through obtaining one; And the mode of passing through memory node is the difference in functionality distribution or the releasing memory of this application program; Be convenient to the operating position of internal memory is followed the tracks of, avoid internal memory to use the situation of crossing the border.The operating position and the internal memory illegal operation record of all memory nodes that print according to the attribute of memory pool; Which local uses that internal memory is illegal, which local internal memory that causes is revealed can to find out the browser of mobile terminal application program, thus can change accordingly avoid the use of internal memory illegal with the internal memory leakage.And when browser of mobile terminal application code logic goes wrong; Avoid crashing thereby can carry out corresponding modification in the position of can the record logic in the operating position of all memory nodes that print according to the attribute of memory pool and the internal memory illegal operation record ging wrong.In addition, when quoting internal memory, can add inspection, illegally can point out the user serious problems to occur, please relevant information fed back to the developer if be checked through refers to.
Embodiment 3
Referring to Fig. 3, the embodiment of the invention provides a kind of device of memory management, comprising:
Memory pool processing module 301 is used for obtaining the memory pool of the internal memory of a preset size as this locality through the memory applications DLL API of platform, and the initialization memory pool;
Memory node is provided with module 302, is used for behind memory pool processing module 301 initialization memory pools, according to memory pool memory node being set;
Memory allocating module 303 is used for when local arbitrary function of application need be used internal memory, distributing an internal memory for function of application and equaling the free memory node of the required internal memory of function of application.
Further, memory allocating module 303 specifically comprises:
Query unit is used for when local arbitrary function of application need be used internal memory audit memory node chained list;
Judging unit is used for when query unit audit memory node chained list, judging whether to inquire the first free memory node of an internal memory more than or equal to the required internal memory of function of application;
Allocation units; Judgment unit judges is used for when can inquire an internal memory more than or equal to the first free memory node of the required internal memory of function of application; The first free memory node is divided; Obtain the second free memory node that an internal memory equals the required internal memory of this function of application, the second free memory node is distributed to function of application.
Further, allocation units specifically comprise:
The deletion subelement is used for when judgment unit judges can inquire an internal memory more than or equal to the first free memory node of the required internal memory of function of application, the first free memory node being deleted from the memory node chained list;
The oidiospore unit; Be used for when the deletion subelement is deleted the first free memory node from the memory node chained list after; With the first free memory node splitting is the second free memory node that an internal memory equals the required internal memory of this function of application, and internal memory equals the 3rd free memory node of difference of internal memory of internal memory and the second free memory node of the first free memory node;
Distribute subelement; Be used for after the oidiospore unit is the second free memory node and the 3rd free memory node with the first free memory node splitting; The memory node state of the second free memory node is set to user mode; Distribute to function of application then, said the 3rd free memory node is inserted in the memory node chained list, the attribute of memory pool is changed.
Further, referring to Fig. 4, this device also comprises:
Internal memory release module 304; Be used for when local arbitrary function of application needs releasing memory; Obtain the physical location of the employed memory node of function of application; With the memory node status modifier of the employed memory node of function of application is idle condition, and revises the attribute of memory pool;
First judge module 305 is used for after internal memory release module 304 is revised the attribute of memory pools, judges in the adjacent memory node of the physics of the employed memory node of function of application whether idle memory node is arranged;
The first memory node processing module 306; Be used for when first judge module 305 judges that the adjacent memory node of physics of the employed memory node of function of application does not have the free memory node, the employed memory node of function of application being inserted in the memory node chained list.
Further, referring to Fig. 5, this device also comprises:
Memory node merges module 307; Be used for when first judge module 305 judges that the adjacent memory node of physics of the employed memory node of function of application has idle memory node, the free memory node that the employed memory node of function of application is adjacent with its physics is merged into a memory node;
Second judge module 308; Be used for after memory node merges the module 307 free memory node that employed memory node is adjacent with its physics with function of application and merges into a memory node, judge in the adjacent memory node of the physics of the memory node that merging obtains whether idle memory node is arranged;
The second memory node processing module 309 is used for when second judge module 308 judges that the adjacent memory node of physics that merges the memory node that obtains does not have the free memory node, and the memory node that merging is obtained is inserted in the memory node chained list.
Further, referring to Fig. 6, this device also comprises:
Notification module 310; Be used for when second judge module 308 judges that the adjacent memory node of physics that merges the memory node that obtains has idle memory node; The free memory node that the memory node that merging is obtained is adjacent with its physics is merged into a memory node, notifies second judge module 308 to carry out to judge the step whether idle memory node is arranged in the adjacent memory node of the physics that merges the memory node that obtains then.
Further, referring to Fig. 7, this device also comprises:
Memory pool release module 311 is used for when this locality is withdrawed from, and prints the operating position and the internal memory illegal operation record of all memory nodes according to the attribute of memory pool, and the memory applications DLL API of calling platform discharges memory pool.
The device of the described memory management of the embodiment of the invention; Preset the memory pool of the internal memory of size through obtaining one as this locality; And the mode of passing through memory node is that local different application function is distributed or releasing memory; Realize that this locality oneself internally deposits into the administration-management reason, thereby conveniently between different platform, transplant.Internal memory through obtaining a preset size is as the memory pool of this locality, and be that local different application function is distributed or releasing memory through the mode of memory node, is convenient to the operating position of internal memory is followed the tracks of the situation of avoiding the internal memory use to cross the border.The operating position and the internal memory illegal operation record of all memory nodes that print according to the attribute of memory pool; Which local uses that internal memory is illegal, which local internal memory that causes is revealed can to find out the browser of mobile terminal application program, thus can change accordingly avoid the use of internal memory illegal with the internal memory leakage.And when the local program code logic goes wrong, avoid crashing thereby can carry out corresponding modification in the position of can the record logic in the operating position of all memory nodes that print according to the attribute of memory pool and the internal memory illegal operation record ging wrong.In addition, when quoting internal memory, can add inspection, illegally can point out the user serious problems to occur, please relevant information fed back to the developer if be checked through refers to.
All or part of content in the technical scheme that above embodiment provides can realize that through software programming its software program is stored in the storage medium that can read, storage medium for example: the hard disk in the computing machine, CD or floppy disk.
The above is merely preferred embodiment of the present invention, and is in order to restriction the present invention, not all within spirit of the present invention and principle, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (14)

1. the method for a memory management is characterized in that, said method comprises:
Memory applications DLL API through platform obtains the memory pool of the internal memory of a preset size as this locality, and the said memory pool of initialization;
According to said memory pool memory node is set;
When arbitrary function of application of this locality need be used internal memory, distribute an internal memory for said function of application and equal the free memory node of the required internal memory of said function of application.
2. the method for memory management according to claim 1; It is characterized in that; When arbitrary function of application of this locality need be used internal memory, distribute an internal memory for said function of application and equal the free memory node of the required internal memory of said function of application, specifically comprise:
When arbitrary function of application of this locality need be used internal memory, audit memory node chained list;
Judge whether to inquire the first free memory node of an internal memory more than or equal to the required internal memory of said function of application;
If can, then the said first free memory node is divided, obtain the second free memory node that an internal memory equals the required internal memory of said function of application, the said second free memory node is distributed to said function of application.
3. the method for memory management according to claim 2; It is characterized in that; The said first free memory node is divided; Obtain the second free memory node that an internal memory equals the required internal memory of this function of application, the second free memory node distributed to this function of application, specifically comprise:
The said first free memory node is deleted from the memory node chained list;
With the said first free memory node splitting is the second free memory node that an internal memory equals the required internal memory of this function of application, and internal memory equals the 3rd free memory node of difference of internal memory of internal memory and the said second free memory node of the said first free memory node;
The memory node state of the said second free memory node is set to user mode, distributes to said function of application then, and said the 3rd free memory node is inserted in the memory node chained list, and the attribute of said memory pool is changed.
4. the method for memory management according to claim 1 is characterized in that, said method also comprises:
When arbitrary function of application of this locality needs releasing memory; Obtain the physical location of the employed memory node of said function of application; With the memory node status modifier of the employed memory node of said function of application is idle condition, and revises the attribute of memory pool;
Judge in the adjacent memory node of the physics of the employed memory node of said function of application whether idle memory node is arranged;
If no, then the employed memory node of said function of application is inserted in the memory node chained list.
5. the method for memory management according to claim 4 is characterized in that, said method also comprises:
When in the adjacent memory node of the physics of judging the employed memory node of said function of application idle memory node being arranged, the free memory node that the employed memory node of said function of application is adjacent with its physics is merged into a memory node;
Judge to merge in the adjacent memory node of the physics of the memory node that obtains whether idle memory node is arranged;
If the memory node that no, then merging is obtained is inserted in the memory node chained list.
6. the method for memory management according to claim 5 is characterized in that, said method also comprises:
When in the adjacent memory node of the physics of judging the memory node that merging obtains idle memory node being arranged; The free memory node that the memory node that merging is obtained is adjacent with its physics is merged into a memory node, carries out whether said judgement merges has idle memory node in the adjacent memory node of the physics of the memory node that obtains step then.
7. according to the method for any described memory management of claim among the claim 1-6, it is characterized in that said method also comprises:
When this locality is withdrawed from, print the operating position and the internal memory illegal operation record of all memory nodes according to the attribute of said memory pool, the memory applications DLL API of calling platform discharges said memory pool.
8. the device of a memory management is characterized in that, said device comprises:
The memory pool processing module is used for obtaining the memory pool of the internal memory of a preset size as this locality through the memory applications DLL API of platform, and the said memory pool of initialization;
Memory node is provided with module, is used for behind the said memory pool of said memory pool processing module initialization, according to said memory pool memory node being set;
Memory allocating module is used for when local arbitrary function of application need be used internal memory, distributing an internal memory for said function of application and equaling the free memory node of the required internal memory of said function of application.
9. the device of memory management according to claim 8 is characterized in that, said memory allocating module specifically comprises:
Query unit is used for when local arbitrary function of application need be used internal memory audit memory node chained list;
Judging unit is used for when said query unit audit memory node chained list, judging whether to inquire the first free memory node of an internal memory more than or equal to the required internal memory of said function of application;
Allocation units; Said judgment unit judges is used for when can inquire an internal memory more than or equal to the first free memory node of the required internal memory of said function of application; The said first free memory node is divided; Obtain the second free memory node that an internal memory equals the required internal memory of said function of application, the said second free memory node is distributed to said function of application.
10. the device of memory management according to claim 9 is characterized in that, said allocation units specifically comprise:
The deletion subelement is used for when said judgment unit judges can inquire an internal memory more than or equal to the first free memory node of the required internal memory of said function of application, the said first free memory node being deleted from the memory node chained list;
The oidiospore unit; Be used for when said deletion subelement is deleted the said first free memory node from the memory node chained list after; With the said first free memory node splitting is the second free memory node that an internal memory equals the required internal memory of this function of application, and internal memory equals the 3rd free memory node of difference of internal memory of internal memory and the said second free memory node of the said first free memory node;
Distribute subelement; Be used for after said oidiospore unit is the second free memory node and the 3rd free memory node with the said first free memory node splitting; The memory node state of the said second free memory node is set to user mode; Distribute to said function of application then, said the 3rd free memory node is inserted in the memory node chained list, the attribute of said memory pool is changed.
11. the device of memory management according to claim 8 is characterized in that, said device also comprises:
The internal memory release module; Be used for when local arbitrary function of application needs releasing memory; Obtain the physical location of the employed memory node of said function of application; With the memory node status modifier of the employed memory node of said function of application is idle condition, and revises the attribute of memory pool;
First judge module is used for after said internal memory release module is revised the attribute of memory pool, judges in the adjacent memory node of the physics of the employed memory node of said function of application whether idle memory node is arranged;
The first memory node processing module; Be used for when said first judge module judges that the adjacent memory node of physics of the employed memory node of said function of application does not have the free memory node, the employed memory node of said function of application being inserted in the memory node chained list.
12. the device of memory management according to claim 11 is characterized in that, said device also comprises:
Memory node merges module; Be used for when said first judge module judges that the adjacent memory node of physics of the employed memory node of said function of application has idle memory node, the free memory node that the employed memory node of said function of application is adjacent with its physics is merged into a memory node;
Second judge module; Be used for after said memory node merges the module free memory node that the employed memory node of said function of application is adjacent with its physics and merges into a memory node, judge in the adjacent memory node of the physics of the memory node that merging obtains whether idle memory node is arranged;
The second memory node processing module is used for when said second judge module judges that the adjacent memory node of physics that merges the memory node that obtains does not have the free memory node, and the memory node that merging is obtained is inserted in the memory node chained list.
13. the device of memory management according to claim 12 is characterized in that, said device also comprises:
Notification module; Be used for when said second judge module judges that the adjacent memory node of physics that merges the memory node that obtains has idle memory node; The free memory node that the memory node that merging is obtained is adjacent with its physics is merged into a memory node, notifies said second judge module to carry out whether said judgement merges has idle memory node in the adjacent memory node of the physics of the memory node that obtains step then.
14. the device of any described memory management of claim is characterized in that according to Claim 8-13, said device also comprises:
The memory pool release module is used for when this locality is withdrawed from, and prints the operating position and the internal memory illegal operation record of all memory nodes according to the attribute of said memory pool, and the memory applications DLL API of calling platform discharges said memory pool.
CN201110104991.4A 2011-04-26 2011-04-26 A kind of method and apparatus of memory management Active CN102760080B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110104991.4A CN102760080B (en) 2011-04-26 2011-04-26 A kind of method and apparatus of memory management

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110104991.4A CN102760080B (en) 2011-04-26 2011-04-26 A kind of method and apparatus of memory management

Publications (2)

Publication Number Publication Date
CN102760080A true CN102760080A (en) 2012-10-31
CN102760080B CN102760080B (en) 2016-08-03

Family

ID=47054545

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110104991.4A Active CN102760080B (en) 2011-04-26 2011-04-26 A kind of method and apparatus of memory management

Country Status (1)

Country Link
CN (1) CN102760080B (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103218307A (en) * 2013-04-18 2013-07-24 海信集团有限公司 Memory management system and memory management method
CN103870259A (en) * 2012-12-14 2014-06-18 腾讯科技(深圳)有限公司 Method and device for data processing
CN104965795A (en) * 2015-06-16 2015-10-07 重庆邮电大学 Allocation method for embedded system static memory pool
CN105988823A (en) * 2015-01-27 2016-10-05 阿里巴巴集团控股有限公司 Memory allocation method and system during starting of application in terminal
CN105988876A (en) * 2015-03-27 2016-10-05 杭州迪普科技有限公司 Memory allocation method and apparatus
CN106155917A (en) * 2015-04-28 2016-11-23 北京信威通信技术股份有限公司 EMS memory management process and device
CN106294731A (en) * 2016-08-09 2017-01-04 四川网达科技有限公司 Enter management method and the device of database data
CN106502783A (en) * 2016-09-23 2017-03-15 深圳市金立通信设备有限公司 A kind of EMS memory management process and terminal device
CN106648943A (en) * 2016-09-22 2017-05-10 郑州云海信息技术有限公司 Memory optimization method for performance test of smart rack system
CN106844046A (en) * 2016-12-31 2017-06-13 昊宏广泰(北京)科技有限公司 Bandwidth carrier memory management algorithm
CN107168890A (en) * 2017-04-01 2017-09-15 杭州联吉技术有限公司 The management method and device of a kind of memory pool
CN104182351B (en) * 2013-05-22 2017-12-19 格芯公司 For the method and system of the chained list distributed without lock memory
CN109101438A (en) * 2018-07-25 2018-12-28 百度在线网络技术(北京)有限公司 Method and apparatus for storing data
CN109710408A (en) * 2018-12-24 2019-05-03 杭州迪普科技股份有限公司 EMS memory management process and device
CN110555890A (en) * 2018-05-30 2019-12-10 珠海全志科技股份有限公司 Memory management method and system
CN113010457A (en) * 2021-03-24 2021-06-22 北京百度网讯科技有限公司 Resource management method and device and mobile terminal

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1427342A (en) * 2001-12-21 2003-07-02 上海贝尔有限公司 Internal storage management system and its distribution method
CN1532708A (en) * 2003-03-19 2004-09-29 华为技术有限公司 Static internal storage management method
CN101221536A (en) * 2008-01-25 2008-07-16 中兴通讯股份有限公司 Internal memory managing method and device of embedded system
CN101630992A (en) * 2008-07-14 2010-01-20 中兴通讯股份有限公司 Method for managing shared memory

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1427342A (en) * 2001-12-21 2003-07-02 上海贝尔有限公司 Internal storage management system and its distribution method
CN1532708A (en) * 2003-03-19 2004-09-29 华为技术有限公司 Static internal storage management method
CN101221536A (en) * 2008-01-25 2008-07-16 中兴通讯股份有限公司 Internal memory managing method and device of embedded system
CN101630992A (en) * 2008-07-14 2010-01-20 中兴通讯股份有限公司 Method for managing shared memory

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103870259A (en) * 2012-12-14 2014-06-18 腾讯科技(深圳)有限公司 Method and device for data processing
CN103218307B (en) * 2013-04-18 2016-03-30 海信集团有限公司 Internal storage management system and EMS memory management process
CN103218307A (en) * 2013-04-18 2013-07-24 海信集团有限公司 Memory management system and memory management method
CN104182351B (en) * 2013-05-22 2017-12-19 格芯公司 For the method and system of the chained list distributed without lock memory
CN105988823B (en) * 2015-01-27 2019-10-22 阿里巴巴集团控股有限公司 Memory allocation method and its system when in terminal using starting
CN105988823A (en) * 2015-01-27 2016-10-05 阿里巴巴集团控股有限公司 Memory allocation method and system during starting of application in terminal
CN105988876A (en) * 2015-03-27 2016-10-05 杭州迪普科技有限公司 Memory allocation method and apparatus
CN105988876B (en) * 2015-03-27 2019-09-17 杭州迪普科技股份有限公司 Memory allocation method and device
CN106155917A (en) * 2015-04-28 2016-11-23 北京信威通信技术股份有限公司 EMS memory management process and device
CN104965795A (en) * 2015-06-16 2015-10-07 重庆邮电大学 Allocation method for embedded system static memory pool
CN104965795B (en) * 2015-06-16 2018-02-27 重庆邮电大学 The distribution method in embedded system static memory pond
CN106294731A (en) * 2016-08-09 2017-01-04 四川网达科技有限公司 Enter management method and the device of database data
CN106648943A (en) * 2016-09-22 2017-05-10 郑州云海信息技术有限公司 Memory optimization method for performance test of smart rack system
CN106502783A (en) * 2016-09-23 2017-03-15 深圳市金立通信设备有限公司 A kind of EMS memory management process and terminal device
CN106844046B (en) * 2016-12-31 2021-06-11 北京市腾河智慧能源科技有限公司 Broadband carrier memory management method
CN106844046A (en) * 2016-12-31 2017-06-13 昊宏广泰(北京)科技有限公司 Bandwidth carrier memory management algorithm
CN107168890A (en) * 2017-04-01 2017-09-15 杭州联吉技术有限公司 The management method and device of a kind of memory pool
CN107168890B (en) * 2017-04-01 2021-03-19 杭州联吉技术有限公司 Memory pool management method and device
CN110555890A (en) * 2018-05-30 2019-12-10 珠海全志科技股份有限公司 Memory management method and system
CN110555890B (en) * 2018-05-30 2023-10-20 珠海全志科技股份有限公司 Memory management method and system
CN109101438A (en) * 2018-07-25 2018-12-28 百度在线网络技术(北京)有限公司 Method and apparatus for storing data
CN109710408A (en) * 2018-12-24 2019-05-03 杭州迪普科技股份有限公司 EMS memory management process and device
CN109710408B (en) * 2018-12-24 2020-08-04 杭州迪普科技股份有限公司 Memory management method and device
CN113010457A (en) * 2021-03-24 2021-06-22 北京百度网讯科技有限公司 Resource management method and device and mobile terminal
CN113010457B (en) * 2021-03-24 2024-07-05 北京百度网讯科技有限公司 Resource management method and device and mobile terminal

Also Published As

Publication number Publication date
CN102760080B (en) 2016-08-03

Similar Documents

Publication Publication Date Title
CN102760080A (en) Memory management method and device
KR20190020105A (en) Method and device for distributing streaming data
CN108614976A (en) Authority configuring method, device and storage medium
CN103309796A (en) Monitoring method and device of component object model (COM) object
CN105718319A (en) Memory pool layout analysis method and memory pool device
CN100392606C (en) Method for leaking memory of positioning virtual operation system
CN112256457A (en) Data loading acceleration method and device based on shared memory, electronic equipment and storage medium
CN104182182B (en) Intelligent terminal and data backup method thereof
CN104423982A (en) Request processing method and device
CN106250244A (en) Method and device for releasing mutual exclusion lock and electronic equipment
CN109597707A (en) Clone volume data copying method, device and computer readable storage medium
CN109491962A (en) A kind of file directory tree management method and relevant apparatus
CN106326014A (en) Resource access method and device
CN104951370A (en) Memory management method and device
CN111506500A (en) Memory leak detection method and device, electronic equipment and readable storage medium
CN106383826A (en) Database checking method and apparatus
CN104517067A (en) Method, device and system for data access
CN111736776B (en) Data storage and reading method and device
US9047299B1 (en) Reclaiming blocks from a directory
CN112799588A (en) Data storage method for loading container cluster application data by using external storage
CN105677347A (en) Method and device for processing data
CN114493598A (en) Computing resource management method, device, computer equipment and storage medium
CN106326094B (en) Check the method and system of pointer exception
CN104715349A (en) Method and system for calculating e-commerce freight
CN114610644A (en) Method and device for testing database

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