CN110032529A - A kind of EMS memory management process and relevant apparatus - Google Patents

A kind of EMS memory management process and relevant apparatus Download PDF

Info

Publication number
CN110032529A
CN110032529A CN201810028037.3A CN201810028037A CN110032529A CN 110032529 A CN110032529 A CN 110032529A CN 201810028037 A CN201810028037 A CN 201810028037A CN 110032529 A CN110032529 A CN 110032529A
Authority
CN
China
Prior art keywords
memory
data
target
target memory
management
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
CN201810028037.3A
Other languages
Chinese (zh)
Other versions
CN110032529B (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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810028037.3A priority Critical patent/CN110032529B/en
Publication of CN110032529A publication Critical patent/CN110032529A/en
Application granted granted Critical
Publication of CN110032529B publication Critical patent/CN110032529B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/14Protection against unauthorised use of memory or access to memory
    • G06F12/1408Protection against unauthorised use of memory or access to memory by using cryptography

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

The embodiment of the invention discloses a kind of EMS memory management process and relevant apparatus to avoid that RAM leakage occurs, and carry out encryption/decryption to the data in memory, improve safety for being automatically performed the application and release of memory.This method comprises: obtaining the memory request instruction of user, the memory request instruction carries the preset capacity size of memory needed for user;It is instructed in response to the memory request, creates a management class, the management class is used for the application and release of managing internal memory;According to the Memory Allocation request instruction, pass through the target memory of preset capacity size described in the management class application;Receive the data manipulation instruction of the user;In response to the data manipulation instruction of the user, data management and the encryption of data and/or decryption oprerations are carried out to the target memory, and record the position of the target memory;After stopping using the target memory, the target memory is discharged by the management class.

Description

A kind of EMS memory management process and relevant apparatus
Technical field
The present invention relates to field of computer technology more particularly to a kind of EMS memory management process and relevant apparatus.
Background technique
With the rapid development of computer, the requirement with people to computer performance is continuously improved, in order to adapt to calculate The demand of the improvement of other hardware devices of machine, the memory of computer is also increasing, in addition to that can be changed in memory size Into, can also in the case where memory size is constant, internally deposit into row efficiently utilize.
Currently, application developer is worked using memory, various parts or global change can be generally defined Amount is handled to store ephemeral data, memory while needs to write-in data with data are read.Storing data is then needed First to file memory headroom passes through the memory headroom of manual operation active release busy again after the completion of use.
Work as application developer, has applied for memory use, and have forgotten releasing memory after the completion of use, will lead to interior Deposit leakage;Or be in program process, mistake occur causes follow-up process to be not carried out, and lets out to generate memory Dew.It then will lead to program internal memory under RAM leakage serious situation to have used and generated collapse, while if for one piece of memory If release repeatedly also results in program crashing.Simultaneously for some programs, the data in memory are sensitive informations, if used Then there is the risk of safety in stored in clear, may be by if stored in clear for example, the encrypted message etc. of user's input Hacker is easy to search the data of memory using memory research tool, thus internal storage data of easily modifying.
Summary of the invention
The present invention provides a kind of EMS memory management process and relevant apparatus, for being automatically performed the application and release of memory, It avoids that RAM leakage occurs, and encryption/decryption is carried out to the data in memory, improve safety.
First aspect present invention provides a kind of EMS memory management process, comprising:
The memory request instruction of user is obtained, the preset capacity that the memory request instruction carries memory needed for user is big It is small;
Instructed in response to the memory request, create a management class, the management class for managing internal memory application with Release;
According to the Memory Allocation request instruction, in the target by preset capacity size described in the management class application It deposits;
Receive the data manipulation instruction of the user;
In response to the data manipulation instruction of the user, data management and the encryption of data are carried out to the target memory And/or decryption oprerations, and record the position of the target memory;
After stopping using the target memory, the target memory is discharged by the management class.
Optionally, described that data management and the encryption of data and/or decryption oprerations are carried out to the target memory, and remember The position for recording the target memory includes:
The target memory is read out by the management class and decryption oprerations, and/or write-in and cryptographic operation, and Record the position of the target memory.
Optionally, described the target memory to be read out by the management class and decryption oprerations, and/or write-in and Cryptographic operation, and the position for recording the target memory includes:
It calls write-in stencil function that first object data are written to the target memory by the management class, calls encryption Function encrypts the first object data, and records the position for being written with the target memory of the first object data It sets;And/or call reading stencil function to read the second target data in the target memory by the management class, it calls Second target data is decrypted in decryption function, and records the target memory for reading second target data Position.
Optionally, the target memory by preset capacity size described in the management class application includes:
By the target memory of preset capacity size described in the management class application, and call constructed fuction to the target Memory is managed.
Optionally, it is described by the management class to the target memory carry out release include:
Destructor function is called to discharge the target memory by the management class.
Second aspect of the present invention provides a kind of memory management device, comprising:
Acquiring unit, the memory request for obtaining user instruct, and the memory request instruction carries in needed for user The preset capacity size deposited;
Creating unit creates a management class, the management class is for managing for instructing in response to the memory request The application and release of memory;
Application unit, for passing through preset capacity described in the management class application according to the Memory Allocation request instruction The target memory of size;
Receiving unit, for receiving the data manipulation instruction of the user;
Processing unit carries out data management to the target memory for the data manipulation instruction in response to the user And the encryption and/or decryption oprerations of data, and record the position of the target memory;
Releasing unit, after stopping using the target memory, for by the management class to the target memory into Row release.
Optionally, the processing unit includes:
Processing module, for being read out by the management class to the target memory and decryption oprerations, and/or write-in And cryptographic operation, and record the position of the target memory.
Optionally, the processing module is specifically used for:
It calls write-in stencil function that first object data are written to the target memory by the management class, calls encryption Function encrypts the first object data, and records the position for being written with the target memory of the first object data It sets;And/or call reading stencil function to read the second target data in the target memory by the management class, it calls Second target data is decrypted in decryption function, and records the target memory for reading second target data Position.
Third aspect present invention provides a kind of electronic equipment, including memory, processor, which is characterized in that the place Reason device realizes the memory management as described in above-mentioned any one when being used to execute the computer management class method stored in memory The step of method.
Fourth aspect present invention provides a kind of computer readable storage medium, is stored thereon with computer management class Sequence, it is characterised in that: the memory as described in above-mentioned any one is realized when the computer management class method is executed by processor The step of management method.
Detailed description of the invention
Fig. 1 is one embodiment schematic diagram of EMS memory management process in the embodiment of the present invention;
Fig. 2 is one embodiment schematic diagram of memory management device in the embodiment of the present invention;
Fig. 3 is another embodiment schematic diagram of memory management device in the embodiment of the present invention;
Fig. 4 is a kind of hardware structural diagram of memory management device in the embodiment of the present invention;
Fig. 5 is another hardware structural diagram of memory management device in the embodiment of the present invention.
Specific embodiment
The present invention provides a kind of EMS memory management process and relevant apparatus, for being automatically performed the application and release of memory, It avoids that RAM leakage occurs, and encryption/decryption is carried out to the data in memory, improve safety.
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.
Referring to Fig. 1, Fig. 1 is one embodiment schematic diagram of EMS memory management process provided in an embodiment of the present invention, comprising:
101, the memory request instruction of user is obtained, the preset capacity that memory request instruction carries memory needed for user is big It is small.
The memory request instruction of user is obtained, memory request instructs the preset capacity size for carrying memory needed for user.
It is understood that user can according to actual needs, memory management device application memory, the size of the memory by User determines, and the preset capacity size carried in memory request instruction can be provided most no more than memory management device Large capacity.
It should be noted that memory management device also needs to define one before obtaining the memory request instruction of user Class and correlation function are managed, which can be used to complete the application and release operation of memory, and can complete to memory Data are written and read the operation of data, and automatically record the read and write position of memory.The embodiment of the present invention and subsequent embodiment In management class in correlation function may include interface function, for ease of description, the embodiment of the present invention and subsequent embodiment It is middle that interface function is referred to as interface.
It is implemented as follows:
The present invention defines the management class AutoMgrBuffer cached first:
class AutoMgrBuffer{
It is such, it is for managing internal memory application and release and to provide relevant interface.
Constructing definitions function is with the object properties for initializing class AutoMgrBuffer.
AutoMgrBuffer (size_t_size=256, char*pKey, int encodeType);
The present invention provides the memory sizes that an interface is used to be passed to an application, for having write when the memory of application Full data, when needing to apply again memory, the memory size of application causes memory to waste if too big, can if too small Frequent application memory, so user can insert the size of the data according to usage scenario.Wherein, char*pKey is then The KEY value used when for data encryption can then encrypt each memory using different KEY, further in this way Reinforce its safety.Which kind of provide a parameter int encodeType simultaneously to be used to be set using Encryption Algorithm, the present invention Also multiple encryption algorithms can be provided to carry out encryption and decryption to data, user can be according to the privacy degrees of the scene and data that use Come using different Encryption Algorithm.
Constructing definitions function is passed to the allocated memory buff.
Constructed fuction can be called when one object birth, destructor function can be then called when dead.
The interface of its destructor function is defined, wherein destructor function is mainly used for completing cleaning work, such as releasing memory is arranged, when For the AutoMgrBuffer object of creation in its scope after the completion of use, system can call its destructor function automatically, thus this The calling memory discharge operation of display is removed in release literary then that memory can be carried out in destructor function without user, from And user is avoided to forget releasing memory and lead to memory overflow.
~AutoMgrBuffer ();
The interface of the write-in caching of definition template:
template<class T>void Write(const T&_val);
Template<class T>is the statement for the template type that C Plus Plus provides, and representing this function is a template letter Number, template type is then T type.
This interface provides the interface of a write-in template object, to both can be written into type using this interface and be Int, char, uint, uchar, int32, int64, object type etc., then not needing to distinguish write-in data for user Type and call different interfaces, then directly can all call write-in (Write) template type interface herein.
The interface of the reading cache data of definition template:
template<class T>size_t Read(T&_val);
This interface provides the interface of a reading template object, to can both read type using this interface and be Int, char, uint, uchar, int32, int64, object type etc. read data then not needing to distinguish for user Type and call different interfaces, then directly can all call reading (Read) template type interface herein.
Defining interface is to obtain the size and capacity of current cache:
size_t Capacity()const;
This interface is used to return the memory size of application, so that user knows the application size of memory.
Defining interface is to obtain the remaining size of current cache:
size_t Length()const;
After this interface is used to return the memory write-in data of application, also lefting in great memory headroom can be written into data.
Defining interface is for resetting AutoMgrBuffer object.
When AutoMgrBuffer after use, need to carry out memory release, and situation its attribute, the present invention then provides one A interface is for resetting AutoMgrBuffer object.
void Reset();
This interface can then discharge the memory of application, and attribute is carried out situation.
}
Other constructed fuctions are defined as privately owned by defining interface, prevent object copies
private:
AutoMgrBuffer(const AutoMgrBuffer&_rhs);
AutoMgrBuffer&operator=(const AutoMgrBuffer&_rhs);
In the grammer of C Plus Plus, above-mentioned function is defined as privately owned, then can prevent user from copying to object Operation prevents from managing with a memory using 2 different AutoMgrBuffer objects.
Define data encryption interface:
Void Encode(char*buff,int nLen,char*key,int encodeType);
Wherein parameter char*buff is then the buff for needing the data encrypted.
Wherein parameter int nLen is then the data length for needing to encrypt.
Wherein parameter char*key is then to need to encrypt the key used.
Wherein parameter int encodeType is then the Encryption Algorithm used when needing to encrypt.
Define data deciphering interface:
Void Decode(char*buff,int nLen,char*key,int decodeType);
Wherein parameter char*buff is then the buff for needing data to be decrypted.
Wherein parameter int nLen is then the data length for needing to decrypt.
Wherein parameter char*key is then to need to decrypt the key used.
Wherein parameter int decodeType is then the decipherment algorithm used when needing to decrypt.
Encryption Algorithm must be matched with decipherment algorithm simultaneously, and the member variable of this paper can store currently used encryption The type of algorithm, so that algorithm will not be caused unpaired.
Define the member property data of AutoMgrBuffer class.
Need to record the memory address of current application for AutoMgrBuffer class, the amount of capacity of memory, currently The core position of data write-in, the still remaining memory headroom of the caching of current application.
unsigned char*m_pbuff;For recording the initial address of the application memory of memory.
size_t m_capacity;For recording the size for applying for memory every time.
size_t m_pos;For recording the position of current memory data write-in.
size_t m_length;Memory also how many capacity for recording application can write data.
size_t m_unitsize;For recording the size of application memory headroom every time.
102, it is instructed in response to memory request, creates a management class, management class is used for the application and release of managing internal memory.
It is instructed in response to memory request, creates a management class, management class is used for the application and release of managing internal memory.
It should be noted that including multiple functions in management class, specifically, can be for initialization definitions The constructed fuction of AutoMgrBuffer object, the embodiment of the invention provides two constructed fuctions and a destructor function, specifically It is accomplished by
For interface AutoMgrBuffer (size_t_size=256, char*pKey, int encodeType);Reality It is now as follows:
This interface then initializes member variable, and by parameter assignment to member variable.
It is used to store the KEY value used when encryption with addition of a m_pkey.
With addition of the types that a m_encodeType is used to store encryption.
For interface AutoMgrBuffer (void*buf, size_t_len, size_t_size=256, char*pKey, int encodeType);It is accomplished by
This interface is also to carry out assignment operation to member variable.
Interface~AutoMgrBuffer () is implemented as follows:
103, according to Memory Allocation request instruction, by the target memory for managing class application preset capacity size.
According to Memory Allocation request instruction, by the target memory for managing class application preset capacity size.
It should be noted that management class calls constructed fuction defined above big to memory managing device application preset capacity Small memory.
In the case of different, different constructed fuctions can be called, for example, when the memory of application has write full data, When needing to apply again memory, function AutoMgrBuffer (size_t_size=256, char*pKey, int are called encodeType);
Wherein, numerical value 256 can also be other numerical value, specifically herein without limitation.It can also be the interior of other applications Deposit size, it is to be understood that user can according to actual needs, memory management device application memory, the size of the memory by User determines, and the preset capacity size carried in memory request instruction can be provided most no more than memory management device Large capacity.It causes memory to waste if too big, can frequently apply for memory if too small, so user can be according to use Scene inserts the sizes of the data.
104, the data manipulation instruction of user is received.
Receive the data manipulation instruction of user.Specifically, the instruction that user is sent, for example, data are written into memory Data are either read from memory, details are not described herein again for the storage form of data in memory.
It should be noted that memory management equipment can also definition template before receiving the data manipulation instruction of user Function, stencil function include the interface that data are written, interface, the interface of encryption data and the connecing for ciphertext data for reading data Mouthful.
Concrete implementation is as follows:
The interface (encryption function) of encryption data, this interface can externally provide a variety of cipher modes, either quickly adding It is close, it is also possible to safer encryption.User can be selected according to the degree of protection to data using which kind of cipher mode.
Void Encode(char*buff,int nLen,char*key,int encodeType);
Interface of the invention is above-mentioned interface, selects encryption type by parameter encodeType.
3 kinds of encipherment schemes are provided in the embodiment of the present invention, it is to be understood that there can also be other encipherment schemes, Specifically herein without limitation.The function of encryption data is as follows:
If (encodeType==0)
{
When encryption type is 0, selection of the embodiment of the present invention encrypts data using xor operator, to rise Executing speed can ignore substantially.It is implemented as follows:
For (int I=0;I<nLen;i++)
{
Write a Do statement first the data of input are carried out with the encryption of each byte.
Buff [i]=buff [i] ^key [i];
Encryption is then to carry out XOR operation to the data of the key of data and input in buff to obtain encrypted result.
}
}
Else if (encodeType==1)
{
TEA.Encrypt(buff,nLen,key);
When encryption type is 1, the embodiment of the present invention then selects to encrypt data using TEA Encryption Algorithm, and And then calculating speed is fast for TEA Encryption Algorithm, encryption intensity is higher than xor operator.
}
Else if (encodeType==2)
{
DES.Encrypt(buff,nLen,key);
When encryption type is 2, the embodiment of the present invention then selects to encrypt data using des encryption algorithm, and And des encryption algorithm calculating speed is slow, encryption intensity ratio TEA operator is higher, and safety is more preferable.
The interface of encryption data is defined above, this interface can externally provide a variety of cipher modes, either quickly adding It is close, it is also possible to safer encryption.Which kind of encryption side user can select according to the degree of protection to data using Formula.
Void Decode(char*buff,int nLen,char*key,int decodeType);
The decryption interface (decryption function) of the embodiment of the present invention is above-mentioned interface, selects to solve by parameter decodeType Close type.
3 kinds of decryption schemes are provided in this embodiment of the present invention, the decryption scheme of certain embodiment of the present invention is and the side of encryption Case is one-to-one.
If (decodeType==0)
{
When decrypting type is 0, selection of the embodiment of the present invention is decrypted data using xor operator, to rise Executing speed can ignore substantially, because XOR operation, which executes 2 times, then obtains original data, be then equivalent to and carried out decryption number According to.It is implemented as follows:
For (int I=0;I<nLen;i++)
{
Write a Do statement first the data of input are carried out with the decryption of each byte.
Buff [i]=buff [i] ^key [i];
Decryption is then to carry out XOR operation to the data of the key of data and input in buff to obtain decrypted result.
}
}
Else if (decodeType==1)
{
TEA.Encrypt(buff,nLen,key);
When decrypting type is 1, the embodiment of the present invention then selects that data are decrypted using TEA decipherment algorithm, and And then calculating speed is fast for TEA decipherment algorithm, decryption and encryption correspond.
}
Else if (decodeType==2)
{
DES.Decrypt(buff,nLen,key);
When decrypting type is 2, the embodiment of the present invention then selects that data are decrypted using DES decipherment algorithm, and And then calculating speed is slow for DES decipherment algorithm, encryption intensity ratio TEA operator is higher, and safety is more preferable.
The interface of the write-in data of definition template function, this interface, which is then supplied to user, can be written into any type of number According to.
template<class T>void Write(const T&_val)
{
Write(&_val,sizeof(_val));
{
The length of write-in data can be judged first, if it exceeds the length that can be written into, then need to redistribute Memory, otherwise can be directly by data copy into caching.
For example, if it exceeds length, then redistribute memory, and it is single that the dynamics of distributing, which is with m_unitsize, Member is allocated, and is then specifically to call such as minor function to distribute:
Size_t mallocsize=((_ len+m_unitsize-1)
/m_unitsize)*m_unitsize;
The length for needing to distribute is calculated first, and the dynamics of distribution is that m_unitsize is unit.
After obtaining length, calling system function carrys out storage allocation.
Void*p=realloc (m_pbuff, mallocsize);
System function realloc is then to redistribute memory, and allocated size is then mallocsize.
M_pbuff=(unsigned char*) p;
And the new memory of distribution is assigned to member variable m_pbuff to save.
It is next then behind the data copy to the new memory of distribution that will need to be written after being assigned memory.
When data being written herein, then first the data of write-in can be encrypted, be then specifically that calling is defined above Interface is encrypted to realize.
Char*pData=(char*) &_val;
Encryption interface Encode is called to realize that the data to write-in encrypt.
Encode(pData,sizeof(_val),m_pkey,m_encodetype);
memcpy(m_pbuff+m_pos,&_val,sizeof(_val));
So as to complete the write-in functions to data.
}
}
The embodiment of the present invention provides the interface of the reading data of a template, to easily read any type of number According to.It is implemented as follows:
template<class T>size_t Read(T&_val)
{
Read(&_val,sizeof(_val));
{
It reads legitimacy to parameter first to judge, the pointer of reading is then directly returned if it is empty, is read unsuccessful; The pointer of reading if not empty, then copies data in memory from currently.
memcpy(pbuffer,m_pbuff+m_pos-readlen,readlen);
In pbuffer pointer to read data copy to needs.
It needs that the data of reading are decrypted herein and can just obtain original data, specific decryption is then that calling is above-mentioned fixed The decryption interface of justice.
Decode (pbuffer, readlen, m_pkey, m_encodetype);
The type wherein encrypted then corresponds to the type of same decipherment algorithm.To finally obtain in pbuffer Data are decrypted.
}
}
105, in response to the data manipulation instruction of user, to target memory carry out data management and the encryption of data and/ Or decryption oprerations, and record the position of target memory.
In response to the data manipulation instruction of user, data management and the encryption of data and/or solution are carried out to target memory Close operation, and record the position of target memory.
Specifically, calling write-in stencil function that first object data are written to target memory by management class, encryption is called Function encrypts the first object data, and records the position for being written with the target memory of first object data;With/ Or, calling the second target data read in stencil function reading target memory by management class, call decryption function to described Second target data is decrypted, and records the position for reading the target memory of the second target data.
Specifically, write-in stencil function is write-in data-interface defined above, interface is as follows:
Specifically, reading stencil function is reading data-interface defined above, interface is as follows:
It should be noted that the interface function of more other functions can also be defined, for example, available presently written The function of pointer position;The function of available currently allocated memory size, and the memory currently distributed is carried out Function of resetting etc..
106, after stopping using target memory, target memory is discharged by managing class.
After stopping using target memory, destructor function is called to discharge target memory by management class.
For example, when the definition and interface that complete memory management device and after realize, then the use that can be convenient. Its concrete practice is illustrated in the embodiment of the present invention, is implemented as follows:
For carrying out read/write memory without using memory management device, concrete operations are as follows:
One section of memory is distributed first, and data are then written, then read data.
Char*pBuff=new char [100];
Int nPos=0;
It is as follows that data are written:
Int nData=53;
It first has to judge whether current remaining memory can be written into this data.
If(sizeof(nData)>100–nPos)
Return;Then data cannot be written in explanation again.
Memcpy(pBuff+nPos,&nData,sizeof(nData));
It needs to go to update nPos simultaneously, to facilitate the write-in of next data.
NPos=nPos+sizeof (nData).
If a large amount of data are written, above-mentioned code can then become very huge, and have to variable nPos into Row assignment, otherwise data can by last data cover, and be written every time also to judge current write-in data whether be more than The memory of distribution.
Simultaneously after the completion of use, has to carry out memory release to the pBuff of distribution, otherwise will cause memory and let out Leakage.
When for using memory management device:
AutoMgrBuffer buff;
First according to the management class AutoMgrBuffer of definition.
Then data are written:
Int nData=53;
Buff.Write(nData);So management class, which only needs line code then, can complete the write-in of data, and interior Whether portion judges current memory can be written into the data, and if not enough writing can automatic storage allocation be written.
Int nRead=0;
Buff.Read(nRead);
It reads data and also only needs line code, then can read data.
After the completion of the management class use, after having exceeded its sphere of action, the memory of application can discharge automatically, not need user The calling shown goes to discharge, to avoid because user forgets to discharge and cause memory overflow.To be provided just for user Benefit.
The embodiment of the present invention is described from the angle of EMS memory management process above, below from memory management device The embodiment of the present invention is described in angle.
Referring to Fig. 2, Fig. 2 is one embodiment schematic diagram of memory management device provided in an embodiment of the present invention, this is interior Managing device is deposited, is specifically included:
Acquiring unit 201, the memory request for obtaining user instruct, and the memory request instruction carries needed for user The preset capacity size of memory;
Creating unit 202 creates a management class, the management class is used for for instructing in response to the memory request The application and release of managing internal memory;
Application unit 203, for passing through preset appearance described in the management class application according to the Memory Allocation request instruction Measure the target memory of size;
Receiving unit 204, for receiving the data manipulation instruction of the user;
Processing unit 205 carries out data pipe to the target memory for the data manipulation instruction in response to the user The encryption and/or decryption oprerations of reason and data, and record the position of the target memory;
Releasing unit 206 is used for through the management class after stopping using the target memory to the target memory It is discharged.
Such as Fig. 3, another embodiment schematic diagram of memory management device provided in an embodiment of the present invention, comprising:
Acquiring unit 301, the memory request for obtaining user instruct, and the memory request instruction carries needed for user The preset capacity size of memory;
Creating unit 302 creates a management class, the management class is used for for instructing in response to the memory request The application and release of managing internal memory;
Application unit 303, for passing through preset appearance described in the management class application according to the Memory Allocation request instruction Measure the target memory of size;
Receiving unit 304, for receiving the data manipulation instruction of the user;
Processing unit 305 carries out data pipe to the target memory for the data manipulation instruction in response to the user The encryption and/or decryption oprerations of reason and data, and record the position of the target memory;
Releasing unit 306 is used for through the management class after stopping using the target memory to the target memory It is discharged.
Optionally, the processing unit 305 includes:
Processing module 3051, for being read out by the management class to the target memory and decryption oprerations, and/or Write-in and cryptographic operation, and record the position of the target memory.
Optionally, processing module 3051 is specifically used for:
It calls write-in stencil function that first object data are written to the target memory by the management class, calls encryption Function encrypts the first object data, and records the position for being written with the target memory of the first object data It sets;And/or call reading stencil function to read the second target data in the target memory by the management class, it calls Second target data is decrypted in decryption function, and records the target memory for reading second target data Position.
The embodiment of the present invention, obtains the memory request instruction of user, and the memory request instruction carries in needed for user The preset capacity size deposited;It is instructed in response to the memory request, creates a management class, the management class is used for managing internal memory Application and release;According to the Memory Allocation request instruction, pass through the mesh of preset capacity size described in the management class application Mark memory;Receive the data manipulation instruction of the user;In response to the data manipulation instruction of the user, to the target memory Data management and the encryption of data and/or decryption oprerations are carried out, and record the position of the target memory;When stopping using After stating target memory, the target memory is discharged by the management class.Management class can be automatically performed the Shen of memory It please and discharge, avoid that RAM leakage occurs, and carry out encryption/decryption to the data in memory, improve safety.
Referring to Fig. 4, Fig. 4 is the embodiment schematic diagram of electronic equipment provided in an embodiment of the present invention.
As shown in figure 4, the embodiment of the invention provides a kind of electronic equipment, including memory 410, processor 420 and deposit The computer program 411 that can be run on memory 420 and on processor 420 is stored up, processor 420 executes computer program It is performed the steps of when 411
The memory request instruction of user is obtained, the preset capacity that the memory request instruction carries memory needed for user is big It is small;
Instructed in response to the memory request, create a management class, the management class for managing internal memory application with Release;
According to the Memory Allocation request instruction, in the target by preset capacity size described in the management class application It deposits;
Receive the data manipulation instruction of the user;
In response to the data manipulation instruction of the user, data management and the encryption of data are carried out to the target memory And/or decryption oprerations, and record the position of the target memory;
After stopping using the target memory, the target memory is discharged by the management class.
Optionally, described that data management and the encryption of data and/or decryption oprerations are carried out to the target memory, and remember The position for recording the target memory includes:
The target memory is read out by the management class and decryption oprerations, and/or write-in and cryptographic operation, and Record the position of the target memory.
Optionally, described the target memory to be read out by the management class and decryption oprerations, and/or write-in and Cryptographic operation, and the position for recording the target memory includes:
It calls write-in stencil function that first object data are written to the target memory by the management class, calls encryption Function encrypts the first object data, and records the position for being written with the target memory of the first object data It sets;And/or call reading stencil function to read the second target data in the target memory by the management class, it calls Second target data is decrypted in decryption function, and records the target memory for reading second target data Position.
Optionally, the target memory by preset capacity size described in the management class application includes:
By the target memory of preset capacity size described in the management class application, and call constructed fuction to the target Memory is managed.
Optionally, it is described by the management class to the target memory carry out release include:
Destructor function is called to discharge the target memory by the management class.
In the specific implementation process, when processor 420 executes computer program 411, the corresponding embodiment of Fig. 1 may be implemented Middle any embodiment.
Since the electronic equipment that the present embodiment is introduced is adopted by memory management device a kind of in the implementation embodiment of the present invention Equipment, so based on method described in the embodiment of the present invention, those skilled in the art can understand this implementation The specific embodiment and its various change form of the electronic equipment of example, so how to realize this for the electronic equipment herein Method in inventive embodiments is no longer discussed in detail, as long as those skilled in the art implement the method in the embodiment of the present invention Used equipment belongs to the range of the invention to be protected.
Referring to Fig. 5, Fig. 5 is a kind of embodiment signal of computer readable storage medium provided in an embodiment of the present invention Figure.
As shown in figure 5, present embodiments providing a kind of computer readable storage medium 500, it is stored thereon with computer journey Sequence 511, the computer program 511 realize following steps when being executed by processor:
The memory request instruction of user is obtained, the preset capacity that the memory request instruction carries memory needed for user is big It is small;
Instructed in response to the memory request, create a management class, the management class for managing internal memory application with Release;
According to the Memory Allocation request instruction, in the target by preset capacity size described in the management class application It deposits;
Receive the data manipulation instruction of the user;
In response to the data manipulation instruction of the user, data management and the encryption of data are carried out to the target memory And/or decryption oprerations, and record the position of the target memory;
After stopping using the target memory, the target memory is discharged by the management class.
Optionally, described that data management and the encryption of data and/or decryption oprerations are carried out to the target memory, and remember The position for recording the target memory includes:
The target memory is read out by the management class and decryption oprerations, and/or write-in and cryptographic operation, and Record the position of the target memory.
Optionally, described the target memory to be read out by the management class and decryption oprerations, and/or write-in and Cryptographic operation, and the position for recording the target memory includes:
It calls write-in stencil function that first object data are written to the target memory by the management class, calls encryption Function encrypts the first object data, and records the position for being written with the target memory of the first object data It sets;And/or call reading stencil function to read the second target data in the target memory by the management class, it calls Second target data is decrypted in decryption function, and records the target memory for reading second target data Position.
Optionally, the target memory by preset capacity size described in the management class application includes:
By the target memory of preset capacity size described in the management class application, and call constructed fuction to the target Memory is managed.
Optionally, it is described by the management class to the target memory carry out release include:
Destructor function is called to discharge the target memory by the management class.
It should be noted that in the above-described embodiments, all emphasizing particularly on different fields to the description of each embodiment, in some embodiment The part being not described in may refer to the associated description of other embodiments.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that each process in flowchart and/or the block diagram can be realized by computer program instructions And/or the combination of the process and/or box in box and flowchart and/or the block diagram.It can provide these computer programs to refer to Enable the processor of general purpose computer, special purpose computer, embedded computer or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic Concept, then additional changes and modifications may be made to these embodiments.So it includes preferred that the following claims are intended to be interpreted as Embodiment and all change and modification for falling into the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies Within, then the invention is also intended to include including these modification and variations.

Claims (10)

1. a kind of EMS memory management process characterized by comprising
The memory request instruction of user is obtained, the memory request instruction carries the preset capacity size of memory needed for user;
It is instructed in response to the memory request, creates a management class, the management class is used for the application and release of managing internal memory;
According to the Memory Allocation request instruction, pass through the target memory of preset capacity size described in the management class application;
Receive the data manipulation instruction of the user;
In response to the data manipulation instruction of the user, to the target memory carry out data management and the encryption of data and/ Or decryption oprerations, and record the position of the target memory;
After stopping using the target memory, the target memory is discharged by the management class.
2. EMS memory management process according to claim 1, which is characterized in that described to carry out data pipe to the target memory The encryption and/or decryption oprerations of reason and data, and the position for recording the target memory includes:
The target memory is read out by the management class and decryption oprerations, and/or write-in and cryptographic operation, and recorded The position of the target memory.
3. EMS memory management process according to claim 2, which is characterized in that it is described by the management class to the target Memory is read out and decryption oprerations, and/or write-in and cryptographic operation, and the position for recording the target memory includes:
It calls write-in stencil function that first object data are written to the target memory by the management class, calls encryption function The first object data are encrypted, and record the position for being written with the target memory of the first object data;
And/or call reading stencil function to read the second target data in the target memory by the management class, it calls Second target data is decrypted in decryption function, and records the target memory for reading second target data Position.
4. EMS memory management process according to claim 1, which is characterized in that described by pre- described in the management class application The target memory for setting amount of capacity includes:
By the target memory of preset capacity size described in the management class application, and call constructed fuction to the target memory It is managed.
5. EMS memory management process according to claim 1, which is characterized in that it is described by the management class to the target Memory carries out release
Destructor function is called to discharge the target memory by the management class.
6. a kind of memory management device characterized by comprising
Acquiring unit, the memory request for obtaining user instruct, and the memory request instruction carries memory needed for user Preset capacity size;
Creating unit creates a management class, the management class is used for managing internal memory for instructing in response to the memory request Application and release;
Application unit, for passing through preset capacity size described in the management class application according to the Memory Allocation request instruction Target memory;
Receiving unit, for receiving the data manipulation instruction of the user;
Processing unit, for the data manipulation instruction in response to the user, to the target memory carry out data management and The encryption and/or decryption oprerations of data, and record the position of the target memory;
Releasing unit, after stopping using the target memory, for being released by the management class the target memory It puts.
7. memory management device according to claim 6, which is characterized in that the processing unit includes:
Processing module for being read out by the management class to the target memory and decryption oprerations, and/or write-in and adds Close operation, and record the position of the target memory.
8. memory management device according to claim 7, which is characterized in that the processing module is specifically used for:
It calls write-in stencil function that first object data are written to the target memory by the management class, calls encryption function The first object data are encrypted, and record the position for being written with the target memory of the first object data; And/or call reading stencil function to read the second target data in the target memory by the management class, call decryption Second target data is decrypted in function, and records the position for reading the target memory of second target data It sets.
9. a kind of electronic equipment, including memory, processor, which is characterized in that the processor is deposited for executing in memory The step of EMS memory management process as described in any one of claim 1 to 5 is realized when the computer management class method of storage.
10. a kind of computer readable storage medium is stored thereon with computer management class method, it is characterised in that: the calculating Machine management class method realizes the step of the EMS memory management process as described in any one of claim 1 to 5 when being executed by processor Suddenly.
CN201810028037.3A 2018-01-11 2018-01-11 Memory management method and related device Active CN110032529B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810028037.3A CN110032529B (en) 2018-01-11 2018-01-11 Memory management method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810028037.3A CN110032529B (en) 2018-01-11 2018-01-11 Memory management method and related device

Publications (2)

Publication Number Publication Date
CN110032529A true CN110032529A (en) 2019-07-19
CN110032529B CN110032529B (en) 2021-11-09

Family

ID=67234334

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810028037.3A Active CN110032529B (en) 2018-01-11 2018-01-11 Memory management method and related device

Country Status (1)

Country Link
CN (1) CN110032529B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110442404A (en) * 2019-08-13 2019-11-12 武汉斗鱼鱼乐网络科技有限公司 A kind of object method for releasing, device, equipment and storage medium

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060095699A1 (en) * 2000-06-02 2006-05-04 Renesas Technology Corp. Nonvolatile semiconductor memory and method of managing information in information distribution system
CN101110042A (en) * 2006-07-20 2008-01-23 中兴通讯股份有限公司 Method for detecting memory accessing outside
CN101470665A (en) * 2007-12-27 2009-07-01 Tcl集团股份有限公司 Method and system for internal memory management of application system without MMU platform
CN101702813A (en) * 2009-10-12 2010-05-05 中兴通讯股份有限公司 Memory operating managing method and memory operating managing device
CN101853215A (en) * 2010-06-01 2010-10-06 恒生电子股份有限公司 Memory allocation method and device
CN102209318A (en) * 2011-05-18 2011-10-05 武汉天喻信息产业股份有限公司 Real-time mobile phone encrypted conversation method and device based on intelligent TF (Transflash) card
CN103019964A (en) * 2012-12-24 2013-04-03 北京搜狐新媒体信息技术有限公司 Cache data access method and data cache system
CN105354147A (en) * 2014-08-20 2016-02-24 腾讯科技(深圳)有限公司 Memory pool management method and management system
CN105825143A (en) * 2016-03-07 2016-08-03 乐视移动智能信息技术(北京)有限公司 Application program data writing and reading method and device
CN105933111A (en) * 2016-05-27 2016-09-07 华南师范大学 Bitslicing-KLEIN rapid implementation method based on OpenCL
CN106293510A (en) * 2016-07-21 2017-01-04 中国农业银行股份有限公司 A kind of data sharing method towards MVS and system
CN106598882A (en) * 2016-12-09 2017-04-26 武汉斗鱼网络科技有限公司 Secure memory data protection method and device
CN107086908A (en) * 2016-02-15 2017-08-22 阿里巴巴集团控股有限公司 A kind of quantum key delivering method and device
CN107087002A (en) * 2017-05-15 2017-08-22 武汉斗鱼网络科技有限公司 A kind of encipher-decipher method of data, device and electronic equipment
CN107092815A (en) * 2017-03-31 2017-08-25 武汉斗鱼网络科技有限公司 The method and server of a kind of protection module file
CN107153576A (en) * 2017-04-10 2017-09-12 广东欧珀移动通信有限公司 The distribution method and terminal device of a kind of memory source

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060095699A1 (en) * 2000-06-02 2006-05-04 Renesas Technology Corp. Nonvolatile semiconductor memory and method of managing information in information distribution system
CN101110042A (en) * 2006-07-20 2008-01-23 中兴通讯股份有限公司 Method for detecting memory accessing outside
CN101470665A (en) * 2007-12-27 2009-07-01 Tcl集团股份有限公司 Method and system for internal memory management of application system without MMU platform
CN101702813A (en) * 2009-10-12 2010-05-05 中兴通讯股份有限公司 Memory operating managing method and memory operating managing device
CN101853215A (en) * 2010-06-01 2010-10-06 恒生电子股份有限公司 Memory allocation method and device
CN102209318A (en) * 2011-05-18 2011-10-05 武汉天喻信息产业股份有限公司 Real-time mobile phone encrypted conversation method and device based on intelligent TF (Transflash) card
CN103019964A (en) * 2012-12-24 2013-04-03 北京搜狐新媒体信息技术有限公司 Cache data access method and data cache system
CN105354147A (en) * 2014-08-20 2016-02-24 腾讯科技(深圳)有限公司 Memory pool management method and management system
CN107086908A (en) * 2016-02-15 2017-08-22 阿里巴巴集团控股有限公司 A kind of quantum key delivering method and device
CN105825143A (en) * 2016-03-07 2016-08-03 乐视移动智能信息技术(北京)有限公司 Application program data writing and reading method and device
CN105933111A (en) * 2016-05-27 2016-09-07 华南师范大学 Bitslicing-KLEIN rapid implementation method based on OpenCL
CN106293510A (en) * 2016-07-21 2017-01-04 中国农业银行股份有限公司 A kind of data sharing method towards MVS and system
CN106598882A (en) * 2016-12-09 2017-04-26 武汉斗鱼网络科技有限公司 Secure memory data protection method and device
CN107092815A (en) * 2017-03-31 2017-08-25 武汉斗鱼网络科技有限公司 The method and server of a kind of protection module file
CN107153576A (en) * 2017-04-10 2017-09-12 广东欧珀移动通信有限公司 The distribution method and terminal device of a kind of memory source
CN107087002A (en) * 2017-05-15 2017-08-22 武汉斗鱼网络科技有限公司 A kind of encipher-decipher method of data, device and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
冯朝胜;秦志光;袁丁: "云数据安全存储技术", 《计算机学报》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110442404A (en) * 2019-08-13 2019-11-12 武汉斗鱼鱼乐网络科技有限公司 A kind of object method for releasing, device, equipment and storage medium
CN110442404B (en) * 2019-08-13 2022-07-05 武汉斗鱼鱼乐网络科技有限公司 Object release method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN110032529B (en) 2021-11-09

Similar Documents

Publication Publication Date Title
CN108932297B (en) Data query method, data sharing method, device and equipment
US7392401B2 (en) Data storage apparatus
US8302178B2 (en) System and method for a dynamic policies enforced file system for a data storage device
CN102016863B (en) Embedded licenses for content
CN105993018B (en) Content item encryption in mobile device
KR950029930A (en) Method and device for securing file access
KR20020065855A (en) Storage device including a non-volatile memory
CN108197504B (en) Controllable data encryption and decryption system and method
CN104951706B (en) Method and apparatus for storage content
JP7089303B2 (en) Inference device, processing system, inference method and inference program
JP5645725B2 (en) Data processing apparatus, data processing system, and control method therefor
CN105283921A (en) Non-volatile memory operations
CN109040134A (en) A kind of design method and relevant apparatus of information encryption
CN110650191A (en) Data read-write method of distributed storage system
CN114172746B (en) Secure acquisition method and device of three-party intersection data
CN107306254A (en) Digital literary property protection method and system based on double layer encryption
CN103246852A (en) Enciphered data access method and device
US7757297B2 (en) System for the storage and retrieval of confidential information
CN110032529A (en) A kind of EMS memory management process and relevant apparatus
CN105608147B (en) A kind of method and device of hiding picture original address
US9411984B2 (en) Cryptographic processing apparatus, cryptographic processing system, and cryptographic processing method
CN101889285A (en) Method and device for digital rights protection
CN106250783A (en) A kind of database data encryption, decryption method and device
CN115357930A (en) Data deleting method and electronic equipment
CN106100829A (en) The method and device of encryption storage

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant