Summary of the invention
In view of this, the embodiment of the present application provides a kind of distribution method of memory address and device, calculates equipment and deposit
Storage media, to solve technological deficiency existing in the prior art.
The embodiment of the present application provides a kind of distribution method of memory address, which comprises
The label of each class is defined, and distributes corresponding first internal storage location list for the label of each class, wherein
The first internal storage location list includes multiple first memory cell address;
According to the label of each class and corresponding first internal storage location list, the label corresponding of each class is generated
The instruction of one Memory Allocation.
Optionally, the method also includes:
In the case where receiving object generation instruction, the corresponding class of the object is determined;
According to the corresponding first Memory Allocation instruction of the label lookup of the class, and instructed according to first Memory Allocation
Determine the corresponding first internal storage location list of the label of the class;
It is described right that unappropriated first memory cell address in the first internal storage location list is distributed to
As.
Optionally, the method also includes:
According to the label of class, the specifications parameter of class is generated;
According to the first memory cell address number of the first internal storage location list, corresponding first memory block size ginseng is generated
Number;
It is raw according to the label of each class, the specifications parameter of class, the first memory block size parameter and the first internal storage location list
It is instructed at the first Memory Allocation.
Optionally, the first internal storage location list includes N number of first memory cell address, wherein N >=2;
It is described right that unappropriated first memory cell address in the first internal storage location list is distributed to
As, comprising:
S1, check whether i-th of first memory cell address in the first internal storage location list are occupied, if so, executing
Step S2, if it is not, executing step S3, wherein 1≤i≤N;
S2, i is added to 1 certainly, whether i of the judgement from after adding 1 is less than N, if so, execution step S1, if it is not, execution step S4;
S3, i-th of first memory cell address are distributed into the object;
S4, distribution failure notification is returned.
Optionally, the method also includes:
Determining all occupied feelings of the first memory cell address in the corresponding first internal storage location list of the class
It is again that such label distributes corresponding second internal storage location list under condition, wherein the second internal storage location list includes
Multiple second memory cell address;
According to the label of each class and corresponding second internal storage location list, the label corresponding of each class is generated
The instruction of two Memory Allocations.
Optionally, the method also includes:
In the case where receiving object generation instruction, the corresponding class of the object is determined;
According to the corresponding second Memory Allocation instruction of the label lookup of the class, and instructed according to second Memory Allocation
Determine the corresponding second internal storage location list of the label of the class;
It is described right that unappropriated second memory cell address in the second internal storage location list is distributed to
As.
Optionally, the method also includes:
According to the label of class, the specifications parameter of class is generated;
According to the second memory cell address number of the second internal storage location list, the second memory block size parameter is generated;
It is raw according to the label of each class, the specifications parameter of class, the second memory block size parameter and the second internal storage location list
It is instructed at the second Memory Allocation.
Optionally, each first memory cell address includes multiple memory address, and first internal storage location arranges
Multiple first memory cell address in table are continuous memory address;
Each second memory cell address includes multiple memory address, and more in the second internal storage location list
A second memory cell address is continuous memory address.
The embodiment of the present application discloses a kind of distributor of memory address, and described device includes:
Internal storage location distribution module is configured as defining the label of each class, and is the distribution pair of the label of each class
The the first internal storage location list answered, wherein the first internal storage location list includes multiple first memory cell address;
Memory Allocation directive generation module is configured as label and corresponding first internal storage location according to each class
List generates the corresponding first Memory Allocation instruction of label of each class.
Optionally, described device further include:
First kind determining module is configured as determining that the object is corresponding in the case where receiving object generation instruction
Class;
First searching module is configured as the corresponding first Memory Allocation instruction of label lookup according to the class, and root
The corresponding first internal storage location list of label of the class is determined according to first Memory Allocation instruction;
First object distribution module is configured as one unappropriated first in the first internal storage location list
Memory cell address distributes to the object.
Optionally, the Memory Allocation directive generation module is also configured to
According to the label of class, the specifications parameter of class is generated;
According to the first memory cell address number of the first internal storage location list, corresponding first memory block size ginseng is generated
Number;
It is raw according to the label of each class, the specifications parameter of class, the first memory block size parameter and the first internal storage location list
It is instructed at the first Memory Allocation.
Optionally, the first internal storage location list includes N number of first memory cell address, wherein N >=2;
The first object distribution module is specifically configured to:
S1, check whether i-th of first memory cell address in the first internal storage location list are occupied, if so, executing
Step S2, if it is not, executing step S3, wherein 1≤i≤N;
S2, i is added to 1 certainly, whether i of the judgement from after adding 1 is less than N, if so, execution step S1, if it is not, execution step S4;
S3, i-th of first memory cell address are distributed into the object;
S4, distribution failure notification is returned.
Optionally, the internal storage location distribution module is also configured to determining corresponding first internal storage location of the class
The first memory cell address in list is all that such label distributes corresponding second memory in occupied situation again
Unit list, wherein the second internal storage location list includes multiple second memory cell address;
Memory Allocation directive generation module is also configured to according to deposit receipt in the label of each class and corresponding second
First list generates the corresponding second Memory Allocation instruction of label of each class.
Optionally, described device further include:
Second class determining module is configured as determining that the object is corresponding in the case where receiving object generation instruction
Class;
Second searching module is configured as the corresponding second Memory Allocation instruction of label lookup according to the class, and root
The corresponding second internal storage location list of label of the class is determined according to second Memory Allocation instruction;
Second object distribution module is configured as one unappropriated second in the second internal storage location list
Memory cell address distributes to the object.
Optionally, the Memory Allocation directive generation module is also configured to the label according to class, generates the specification ginseng of class
Number;According to the second memory cell address number of the second internal storage location list, the second memory block size parameter is generated;According to each
The label of class, the specifications parameter of class, the second memory block size parameter and the second internal storage location list generate the second Memory Allocation and refer to
It enables.
Optionally, each first memory cell address includes multiple memory address, and first internal storage location arranges
Multiple first memory cell address in table are continuous memory address;
Each second memory cell address includes multiple memory address, and more in the second internal storage location list
A second memory cell address is continuous memory address.
The embodiment of the present application discloses a kind of calculating equipment, including memory, processor and storage are on a memory and can
The computer instruction run on a processor, the processor realize the distribution of memory address as described above when executing described instruction
The step of method.
The embodiment of the present application discloses a kind of computer readable storage medium, is stored with computer instruction, the instruction quilt
The step of processor realizes the distribution method of memory address as described above when executing.
The distribution method and device of memory address provided by the present application distribute corresponding the by the label of each class
One internal storage location list generates the label of each class then according to the label of each class and corresponding first internal storage location list
Corresponding first Memory Allocation instruction, the label for only needing to combine memory cell address that such can be obtained at the time of reading are not necessarily to
Class label is indicated using ID or V-table as prior art, so that the memory space for this tag along sort has been saved,
Greatly improve data access and treatment effeciency.
In addition, under the first memory cell address all occupied situation, the method for the present embodiment can also be further according to
The label of class distributes corresponding second internal storage location list, guarantees that such each object can be assigned to corresponding interior deposit receipt
First address.
Specific embodiment
Many details are explained in the following description in order to fully understand the application.But the application can be with
Much it is different from other way described herein to implement, those skilled in the art can be without prejudice to the application intension the case where
Under do similar popularization, therefore the application is not limited by following public specific implementation.
The term used in this specification one or more embodiment be only merely for for the purpose of describing particular embodiments,
It is not intended to be limiting this specification one or more embodiment.In this specification one or more embodiment and appended claims
The "an" of singular used in book, " described " and "the" are also intended to including most forms, unless context is clearly
Indicate other meanings.It is also understood that term "and/or" used in this specification one or more embodiment refers to and includes
One or more associated any or all of project listed may combine.
It will be appreciated that though may be retouched using term first, second etc. in this specification one or more embodiment
Various information are stated, but these information should not necessarily be limited by these terms.These terms are only used to for same type of information being distinguished from each other
It opens.For example, first can also be referred to as second, class in the case where not departing from this specification one or more scope of embodiments
As, second can also be referred to as first.Depending on context, word as used in this " if " can be construed to
" ... when " or " when ... " or " in response to determination ".
Firstly, the vocabulary of terms being related to one or more embodiments of the invention explains.
Class (class): the abstract of object with identical characteristic (data element) and behavior () is exactly class.Class is practical
Upper is exactly a kind of data type.Class is a static concept, and class itself does not carry any data.It is created when not for class any
When object, class itself is not present in memory headroom.Class has label, it is the abstract of the state of object, with data structure come
The attribute of class is described.
Object (object): object is the anything that people will be studied, it can not only indicate specific things, also
It can indicate abstract rule, plan or event.Object has state, and an object describes its state with data value.Class with
The relationship of object is as the relationship of mold and casting, and the result of the materialization of class is exactly object, and the abstract result of object is exactly
Class.
In this application, the distribution method and device, calculating equipment and storage medium of a kind of memory address are provided, under
It is described in detail one by one in the embodiment in face.
Fig. 1 is to show the structural block diagram of the calculating equipment 100 according to one embodiment of this specification.The calculating equipment 100
Component include but is not limited to memory 110 and processor 120.Processor 120 is connected with memory 110 by bus 130,
Database 150 is for saving data.
Calculating equipment 100 further includes access device 140, access device 140 enable calculate equipment 100 via one or
Multiple networks 160 communicate.The example of these networks includes public switched telephone network (PSTN), local area network (LAN), wide area network
(WAN), the combination of the communication network of personal area network (PAN) or such as internet.Access device 140 may include wired or wireless
One or more of any kind of network interface (for example, network interface card (NIC)), such as IEEE802.11 wireless local area
Net (WLAN) wireless interface, worldwide interoperability for microwave accesses (Wi-MAX) interface, Ethernet interface, universal serial bus (USB) connect
Mouth, cellular network interface, blue tooth interface, near-field communication (NFC) interface, etc..
In one embodiment of this specification, other unshowned portions in the above-mentioned component and Fig. 1 of equipment 100 are calculated
Part can also be connected to each other, such as pass through bus.It should be appreciated that calculating device structure block diagram shown in FIG. 1 merely for the sake of
Exemplary purpose, rather than the limitation to this specification range.Those skilled in the art can according to need, and increases or replaces it
His component.
Calculating equipment 100 can be any kind of static or mobile computing device, including mobile computer or mobile meter
Calculate equipment (for example, tablet computer, personal digital assistant, laptop computer, notebook computer, net book etc.), movement
Phone (for example, smart phone), wearable calculating equipment (for example, smartwatch, intelligent glasses etc.) or other kinds of shifting
Dynamic equipment, or the static calculating equipment of such as desktop computer or PC.Calculating equipment 100 can also be mobile or state type
Server.
Wherein, processor 120 can execute the step in method shown in Fig. 2.Fig. 2 is to show to be implemented according to the application one
The schematic flow chart of the distribution method of the memory address of example, including step 201 is to step 202.
201, the label of each class is defined, and distributes corresponding first internal storage location list for the label of each class,
Wherein, the first internal storage location list includes multiple first memory cell address.
In the present embodiment, memory cell address can be divided by memory allocator (Memory Allocator)
Match.
Wherein, when creating a class, it is necessary to while such label is created, for indicating such.Such as " Person "
Class mark is " people " this class, such may include many individual (objects), and " Person " is such label.
Memory address generally uses 4 16 systems and 8 16 systems to indicate.By taking 4 16 systems as an example, memory address
0x0001 indicates to be to number the memory address for being 1;By taking 8 16 systems as an example, memory address 0x00000001 expression is to compile
Number be 1 memory address.
Specifically, each first memory cell address includes multiple memory address, the label of each class corresponding
The first memory cell address that one internal storage location list includes can be continuous, or discrete.It is specific at one
Implementation in, the label of a class is A, the memory address of such corresponding first internal storage location be 0x0001~
0x0005, the memory address of second internal storage location are 0x0006~0x0010.
202, according to the label of each class and corresponding first internal storage location list, the label for generating each class is corresponding
The first Memory Allocation instruction.
The distribution method of memory address provided in this embodiment passes through the label and corresponding first memory according to each class
Unit list generates the corresponding first Memory Allocation instruction of label of each class, only needs to combine memory cell address at the time of reading
Such label can be obtained, without indicating class label using ID or V-table as prior art, be used for save
The memory space of this tag along sort, greatly improves data access and treatment effeciency.
In addition, in specific application, for each class, can also further be given birth to after generating the instruction of the first Memory Allocation
In pairs as.Referring to Fig. 3, the method also includes:
301, in the case where receiving object generation instruction, the corresponding class of the object is determined.
302, it is instructed according to corresponding first Memory Allocation of the label lookup of the class, and according to first Memory Allocation
Instruction determines the corresponding first internal storage location list of label of the class.
303, unappropriated first memory cell address in the first internal storage location list is distributed into institute
State object.
It should be noted that only distributing first memory cell address every time for each object.In this way, initial
During generating Memory Allocation instruction, need to pre-set for the memory address that each first memory cell address includes
Number, such as it includes 8 memory address that each first memory cell address, which is arranged,.
Specifically, the first internal storage location list includes N number of first memory cell address, wherein N >=2, step 303 include
Following step 401~404:
401, check whether i-th of first memory cell address in the first internal storage location list are occupied, if so, executing
Step 402, if it is not, executing step 403, wherein 1≤i≤N.
402, by i from adding 1, whether i of the judgement from after adding 1 is less than N, if so, step 401 is executed, if it is not, execution step
404。
403, i-th of first memory cell address are distributed into the object.
404, distribution failure notification is returned.
In addition, the first Memory Allocation instruction generated removes the label for including class and corresponding first internal storage location of label arranges
Further include the specifications parameter and the first memory block size parameter of class except table, characterize respectively space size shared by the label of class and
The size of first internal storage location.
The method also includes:
S11, the label according to class, generate the specifications parameter of class.
It is big to generate corresponding first memory block by S12, the first memory cell address number according to the first internal storage location list
Small parameter.
S13, it is arranged according to the label of each class, the specifications parameter of class, the first memory block size parameter and the first internal storage location
Table generates the instruction of the first Memory Allocation.
It is the schematic diagram of the first Memory Allocation instruction generated using the distribution method of the present embodiment referring to Fig. 5, Fig. 5.?
In the first Memory Allocation instruction of diagram, the instruction of the first Memory Allocation includes:
The label (Type) of class: A;
The specifications parameter (Typesize) of class: 17;
First memory block size parameter (countperchunk): 6;
First internal storage location list (freecell): 0x10000000~(0x10000000+6*17).
One embodiment of the application discloses a kind of distribution method of memory address, referring to Fig. 6, comprising:
601, the label of each class is defined, and distributes corresponding first internal storage location list for the label of each class,
Wherein, the first internal storage location list includes multiple first memory cell address.
602, according to the label of each class and corresponding first internal storage location list, the label for generating each class is corresponding
The first Memory Allocation instruction.
Wherein, step 601~602 are identical as the step 201 of previous embodiment~202, and the present embodiment just repeats no more.
603, in the case where receiving object generation instruction, the corresponding class of the object is determined.
604, it is instructed according to corresponding first Memory Allocation of the label lookup of the class, and according to first Memory Allocation
Instruction determines the corresponding first internal storage location list of label of the class.
605, check whether the first memory cell address in the first internal storage location list is all occupied, if so, executing
Step 606, if it is not, executing step 607.
606, unappropriated first memory cell address in the first internal storage location list is distributed into institute
State object.
It should be noted that only distributing second memory cell address every time for each object.In this way, initial
During generating Memory Allocation instruction, need to pre-set for the memory address that each second memory cell address includes
Number, such as it includes 8 memory address that each second memory cell address, which is arranged,.
Specifically, the second internal storage location list includes M the second memory cell address, wherein M >=2, step 606 include
Following step S6061~S6064:
S6061, check whether j-th of second memory cell address in the second internal storage location list are occupied, if so, holding
Row step S6062, if it is not, executing step S6063, wherein 1≤j≤M.
S6062, j is added to 1 certainly, whether j of the judgement from after adding 1 is less than M, if so, execution step S6061, if it is not, executing step
Rapid S6064.
S6063, j-th of second memory cell address are distributed into the object.
S6064, distribution failure notification is returned.
In the second memory cell address all in occupied situation of the second internal storage location list, can also further give birth to
At the corresponding third internal storage location list of the label of class.Wherein, deposit receipt in the generation method of third internal storage location list and second
First list is similar, and the present embodiment just repeats no more.
607, corresponding second internal storage location list is distributed for such label again, wherein second internal storage location
List includes multiple second memory cell address.
Optionally, each second memory cell address includes multiple memory address, and more in the second internal storage location list
A second memory cell address is continuous memory address.
608, according to the label of each class and corresponding second internal storage location list, the label for generating each class is corresponding
The second Memory Allocation instruction.
In addition, the second Memory Allocation instruction generated removes the label for including class and corresponding second internal storage location of label arranges
Further include the specifications parameter and the second memory block size parameter of class except table, characterize respectively space size shared by the label of class and
The size of first internal storage location.
The method also includes:
S21, the label according to class, generate the specifications parameter of class.
S22, the second memory cell address number according to the second internal storage location list generate the second memory block size ginseng
Number.
S23, it is arranged according to the label of each class, the specifications parameter of class, the second memory block size parameter and the second internal storage location
Table generates the instruction of the second Memory Allocation.
It is the first Memory Allocation instruction generated using the distribution method of the present embodiment and the second memory referring to Fig. 7, Fig. 7
Distribute the schematic diagram of instruction.In the first Memory Allocation instruction of diagram, the instruction of the first Memory Allocation includes:
The label (Type) of class: B;
The specifications parameter (Typesize) of class: 30;
First memory block size parameter (countperchunk): 3;
First internal storage location list (freecell): 0,1,2.
Wherein, 0,1,2 be the first internal storage location serial number.
Second Memory Allocation instructs
The label (Type) of class: B;
The specifications parameter (Typesize) of class: 30;
Second memory block size parameter (countperchunk): 3;
Second internal storage location list (freecell): 3,4,5.
Wherein, 3,4,5 be the first internal storage location serial number.
As it can be seen that being instructed for the second Memory Allocation, the label of class, the specifications parameter of class and the second memory block size parameter
With the label of class, the specifications parameter of class and the first uniform cause of memory block size parameter of the instruction of the first Memory Allocation.
The distribution method of memory address provided by the present application distributes corresponding first memory by the label of each class
Unit list, then according to the label of each class and corresponding first internal storage location list, the label for generating each class is corresponding
The instruction of first Memory Allocation, the label for only needing to combine memory cell address that such can be obtained at the time of reading, without such as existing
Technology uses ID or V-table to indicate class label like that and mentions significantly to save the memory space for this tag along sort
Data access and treatment effeciency are risen.
In addition, though increasing the field of the label of class in the application in memory allocator, a part of memory is occupied,
But compared with the prior art in the label of each class is indicated by additional ID or V-table, the quantity of especially class is very big
In the case where, memory can be saved.
In addition, under the first memory cell address all occupied situation, the method for the present embodiment can also be further according to
The label of class distributes corresponding second internal storage location list, guarantees that such each object can be assigned to corresponding interior deposit receipt
First address.
One embodiment of the application also discloses a kind of distributor of memory address, and referring to Fig. 8, described device includes:
Internal storage location distribution module 801 is configured as defining the label of each class, and distributes for the label of each class
Corresponding first internal storage location list, wherein the first internal storage location list includes multiple first memory cell address;
Memory Allocation directive generation module 802 is configured as label and corresponding first memory according to each class
Unit list generates the corresponding first Memory Allocation instruction of label of each class.
Optionally, described device further include:
First kind determining module 803 is configured as determining the object pair in the case where receiving object generation instruction
The class answered;
First searching module 804 is configured as the corresponding first Memory Allocation instruction of label lookup according to the class, and
The corresponding first internal storage location list of label of the class is determined according to first Memory Allocation instruction;
First object distribution module 805 is configured as one in the first internal storage location list is unappropriated
First memory cell address distributes to the object.
Optionally, the Memory Allocation directive generation module 802 is also configured to
According to the label of class, the specifications parameter of class is generated;
According to the first memory cell address number of the first internal storage location list, corresponding first memory block size ginseng is generated
Number;
It is raw according to the label of each class, the specifications parameter of class, the first memory block size parameter and the first internal storage location list
It is instructed at the first Memory Allocation.
Optionally, the first internal storage location list includes N number of first memory cell address, wherein N >=2;
The first object distribution module 805 is specifically configured to:
S1, check whether i-th of first memory cell address in the first internal storage location list are occupied, if so, executing
Step S2, if it is not, executing step S3, wherein 1≤i≤N;
S2, i is added to 1 certainly, whether i of the judgement from after adding 1 is less than N, if so, execution step S1, if it is not, execution step S4;
S3, i-th of first memory cell address are distributed into the object;
S4, distribution failure notification is returned.
Optionally, the internal storage location distribution module 801 is also configured to determining deposit receipt in the class corresponding first
The first memory cell address in first list is all in occupied situation, again in such label distribution corresponding second
Memory cell list, wherein the second internal storage location list includes multiple second memory cell address;
Memory Allocation directive generation module 802 is also configured to according in the label of each class and corresponding second
Memory cell list generates the corresponding second Memory Allocation instruction of label of each class.
Optionally, described device further include:
Second class determining module 806 is configured as determining the object pair in the case where receiving object generation instruction
The class answered;
Second searching module 807 is configured as the corresponding second Memory Allocation instruction of label lookup according to the class, and
The corresponding second internal storage location list of label of the class is determined according to second Memory Allocation instruction;
Second object distribution module 808 is configured as one in the second internal storage location list is unappropriated
Second memory cell address distributes to the object.
Optionally, the Memory Allocation directive generation module 802 is also configured to the label according to class, generates the rule of class
Lattice parameter;According to the second memory cell address number of the second internal storage location list, the second memory block size parameter is generated;According to
The label of each class, the specifications parameter of class, the second memory block size parameter and the second internal storage location list generate the second memory point
With instruction.
Optionally, each first memory cell address includes multiple memory address, and first internal storage location arranges
Multiple first memory cell address in table are continuous memory address;Each second memory cell address includes in multiple
Address is deposited, and multiple second memory cell address in the second internal storage location list are continuous memory address.
The distributor of memory address provided in this embodiment passes through the label and corresponding first memory according to each class
Unit list generates the corresponding first Memory Allocation instruction of label of each class, only needs to combine memory cell address at the time of reading
Such label can be obtained, without indicating class label using ID or V-table as prior art, be used for save
The memory space of this tag along sort, greatly improves data access and treatment effeciency.
One embodiment of the application also provides a kind of computer readable storage medium, is stored with computer instruction, the instruction
The step of distribution method of memory address as previously described is realized when being executed by processor.
A kind of exemplary scheme of above-mentioned computer readable storage medium for the present embodiment.It should be noted that this is deposited
The technical solution of the technical solution of storage media and the distribution method of above-mentioned memory address belongs to same design, the skill of storage medium
The detail content that art scheme is not described in detail may refer to the description of the technical solution of the distribution method of above-mentioned memory address.
The computer instruction includes computer program code, the computer program code can for source code form,
Object identification code form, executable file or certain intermediate forms etc..The computer-readable medium may include: that can carry institute
State any entity or device, recording medium, USB flash disk, mobile hard disk, magnetic disk, CD, the computer storage of computer program code
Device, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory),
Electric carrier signal, telecommunication signal and software distribution medium etc..It should be noted that the computer-readable medium include it is interior
Increase and decrease appropriate can be carried out according to the requirement made laws in jurisdiction with patent practice by holding, such as in certain jurisdictions of courts
Area does not include electric carrier signal and telecommunication signal according to legislation and patent practice, computer-readable medium.
It should be noted that for the various method embodiments described above, describing for simplicity, therefore, it is stated as a series of
Combination of actions, but those skilled in the art should understand that, the application is not limited by the described action sequence because
According to the application, certain steps can use other sequences or carry out simultaneously.Secondly, those skilled in the art should also know
It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules might not all be this Shen
It please be necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment
Point, it may refer to the associated description of other embodiments.
The application preferred embodiment disclosed above is only intended to help to illustrate the application.There is no detailed for alternative embodiment
All details are described, are not limited the invention to the specific embodiments described.Obviously, according to the content of this specification,
It can make many modifications and variations.These embodiments are chosen and specifically described to this specification, is in order to preferably explain the application
Principle and practical application, so that skilled artisan be enable to better understand and utilize the application.The application is only
It is limited by claims and its full scope and equivalent.