CN112114961A - Memory allocation method and device - Google Patents

Memory allocation method and device Download PDF

Info

Publication number
CN112114961A
CN112114961A CN202010852162.3A CN202010852162A CN112114961A CN 112114961 A CN112114961 A CN 112114961A CN 202010852162 A CN202010852162 A CN 202010852162A CN 112114961 A CN112114961 A CN 112114961A
Authority
CN
China
Prior art keywords
memory
rate
created
create
creation
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
CN202010852162.3A
Other languages
Chinese (zh)
Other versions
CN112114961B (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202010852162.3A priority Critical patent/CN112114961B/en
Publication of CN112114961A publication Critical patent/CN112114961A/en
Application granted granted Critical
Publication of CN112114961B publication Critical patent/CN112114961B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5011Pool

Abstract

The invention discloses a memory allocation method and a device, wherein the method comprises the following steps: synchronously placing the memory allocation request into a created object waiting pool in response to receiving the memory allocation request of the object to be created; asynchronously determining an object creation rate, an object destruction rate, and a memory limit in a memory by a creation rate control scheduler, and synchronously determining a wait time for a memory allocation request to be held in a created object wait pool; asynchronously distributing memory for the object to be created to create the object; and asynchronously counting the object creation information, the object destruction information and the memory occupation information in the memory to determine the object creation rate, the object destruction rate and the memory limitation again and update the object creation rate, the object destruction rate and the memory limitation to the creation rate control scheduler. By the technical scheme of the invention, the object creation rate can be controlled, the normal work of the memory is ensured, and the system stability is improved.

Description

Memory allocation method and device
Technical Field
The present invention relates to the field of memory allocation, and more particularly, to a method and an apparatus for memory allocation.
Background
In the development of java code at the server side of a web application, the situation is encountered: under the condition of a large number of requests or tasks, a new object is applied for creation, and at the moment, an old object is not destroyed in time, namely the object creation rate is higher than the object destruction rate, so that the total number of created objects is more and more, the occupied memory is more and more, and finally, the memory reaches the limited maximum value, and the application cannot be normally used. This is not a memory leak, which means that the memory requested cannot be released, and here, the memory occupied by the requested object has not yet been released and a new object is created. Because the object cannot be released during the use process (there are references), the memory space cannot be released. The garbage collection mechanism of the java virtual machine can only collect unreferenced objects (obsolete objects).
Aiming at the problem that the garbage collection mechanism of java in the prior art cannot deal with memory overflow caused by too many objects, no effective solution is available at present.
Disclosure of Invention
In view of this, an object of the embodiments of the present invention is to provide a method and an apparatus for allocating a memory, which can control an object creation rate, ensure that the memory works normally, and improve system stability.
In view of the foregoing, a first aspect of the embodiments of the present invention provides a memory allocation method, including the following steps:
in response to the fact that a memory allocation request of an object to be created is received and a preset client is configured not to create the object immediately, the memory allocation request is synchronously placed into a created object waiting pool;
asynchronously determining an object creation rate, an object destruction rate, and a memory constraint in the memory by the creation rate control scheduler, and synchronously determining a wait time for which the memory allocation request is to be maintained in the created object wait pool based on the object creation rate, the object destruction rate, and the memory constraint;
asynchronously allocating memory for the object to be created to create the object in response to the memory allocation request having been held in the created object wait pool for a wait time;
in response to receiving a memory allocation request of an object to be created and a preset client is configured not to create the object immediately, object creation information, object destruction information and memory occupation information in the memory are asynchronously counted to determine an object creation rate, an object destruction rate and a memory limit again and updated to the creation rate control scheduler.
In some embodiments, the method further comprises: in response to receiving a memory allocation request for an object to be created and the client being configured to create the object immediately, memory is synchronously allocated directly for the object to be created to create the object immediately.
In some embodiments, the method further comprises: and asynchronously counting the object creating information, the object destroying information and the memory occupation information in the memory to determine the object creating rate, the object destroying rate and the memory limitation again and update the object creating rate, the object destroying rate and the memory limitation to the creating rate control scheduler in response to the object to be created being synchronously or asynchronously distributed with the memory and completing the creation of the object.
In some embodiments, synchronously determining, by the create rate control scheduler, a wait time that the memory allocation request will remain in the create object wait pool based on the object creation rate, the object destruction rate, and the memory limit comprises:
in response to the rate of object creation being greater than the rate of object destruction, determining a wait time expectation until the rate of object creation will be expected to be less than the rate of object destruction;
determining a latency expectation until the memory footprint will be less than the memory limit in response to the memory footprint having reached the memory limit;
determining the wait time as a maximum of the wait time expectations in response to generating at least one wait time expectation;
in response to not generating any latency expectation, the latency is determined to be zero.
In some embodiments, asynchronously counting the object creation information, the object destruction information, and the memory usage information in the memory includes: acquiring the time, the number and the size of the object to be created, and overlaying the time, the number and the size of the object to be created to the object creation information; acquiring the time, the number and the size of the destroyed objects, and overlaying the time, the number and the size of the destroyed objects to object destruction information; and scanning the memory to obtain memory occupation information.
In some embodiments, re-determining and updating the object creation rate, the object destruction rate, and the memory limit to the creation rate control scheduler comprises: the update is asynchronous to the create rate control scheduler and the updated object create rate, object destroy rate, and memory limit are used to determine the latency of the memory allocation request.
In some embodiments, the object to be created is a java object.
A second aspect of the embodiments of the present invention provides a memory allocation apparatus, including:
a processor; and
a memory storing program code executable by the processor, the program code when executed performing the steps of:
in response to the fact that a memory allocation request of an object to be created is received and a preset client is configured not to create the object immediately, the memory allocation request is synchronously placed into a created object waiting pool;
asynchronously determining an object creation rate, an object destruction rate, and a memory constraint in the memory by the creation rate control scheduler, and synchronously determining a wait time for which the memory allocation request is to be maintained in the created object wait pool based on the object creation rate, the object destruction rate, and the memory constraint;
asynchronously allocating memory for the object to be created to create the object in response to the memory allocation request having been held in the created object wait pool for a wait time;
in response to receiving a memory allocation request of an object to be created and a preset client is configured not to create the object immediately, object creation information, object destruction information and memory occupation information in the memory are asynchronously counted to determine an object creation rate, an object destruction rate and a memory limit again and updated to the creation rate control scheduler.
In some embodiments, synchronously determining, by the create rate control scheduler, a wait time that the memory allocation request will remain in the create object wait pool based on the object creation rate, the object destruction rate, and the memory limit comprises:
in response to the rate of object creation being greater than the rate of object destruction, determining a wait time expectation until the rate of object creation will be expected to be less than the rate of object destruction;
determining a latency expectation until the memory footprint will be less than the memory limit in response to the memory footprint having reached the memory limit;
determining the wait time as a maximum of the wait time expectations in response to generating at least one wait time expectation;
in response to not generating any latency expectation, the latency is determined to be zero.
In some embodiments, asynchronously counting the object creation information, the object destruction information, and the memory usage information in the memory includes: acquiring the time, the number and the size of the object to be created, and overlaying the time, the number and the size of the object to be created to the object creation information; acquiring the time, the number and the size of the destroyed objects, and overlaying the time, the number and the size of the destroyed objects to object destruction information; scanning the memory to obtain memory occupation information;
re-determining and updating the object creation rate, the object destruction rate, and the memory limit to the creation rate control scheduler comprises: the update is asynchronous to the create rate control scheduler and the updated object create rate, object destroy rate, and memory limit are used to determine the latency of the memory allocation request.
The invention has the following beneficial technical effects: according to the memory allocation method and device provided by the embodiment of the invention, the memory allocation request is synchronously placed into the object creation waiting pool by responding to the received memory allocation request of the object to be created and the preset client configuration not to immediately create the object; asynchronously determining an object creation rate, an object destruction rate, and a memory constraint in the memory by the creation rate control scheduler, and synchronously determining a wait time for which the memory allocation request is to be maintained in the created object wait pool based on the object creation rate, the object destruction rate, and the memory constraint; asynchronously allocating memory for the object to be created to create the object in response to the memory allocation request having been held in the created object wait pool for a wait time; in response to the fact that a memory allocation request of an object to be created is received and a preset client configuration is adopted to not create the object immediately, the technical scheme that object creation information, object destruction information and memory occupation information in a memory are counted asynchronously to determine an object creation rate, an object destruction rate and memory limitation again and update the object creation rate, the object destruction rate and the memory limitation to a creation rate control scheduler is adopted, the object creation rate can be controlled, normal operation of the memory is guaranteed, and system stability is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a memory allocation method according to the present invention;
fig. 2 is a detailed flowchart of the memory allocation method provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
In view of the foregoing, a first aspect of the embodiments of the present invention provides an embodiment of a memory allocation method capable of controlling an object creation rate, ensuring that a memory works normally, and improving system stability. Fig. 1 is a schematic flow chart of a memory allocation method provided in the present invention.
The memory allocation method, as shown in fig. 1, includes the following steps:
step S101: in response to the fact that a memory allocation request of an object to be created is received and a preset client is configured not to create the object immediately, the memory allocation request is synchronously placed into a created object waiting pool;
step S103: asynchronously determining an object creation rate, an object destruction rate, and a memory constraint in the memory by the creation rate control scheduler, and synchronously determining a wait time for which the memory allocation request is to be maintained in the created object wait pool based on the object creation rate, the object destruction rate, and the memory constraint;
step S105: asynchronously allocating memory for the object to be created to create the object in response to the memory allocation request having been held in the created object wait pool for a wait time;
step S107: in response to receiving a memory allocation request of an object to be created and a preset client is configured not to create the object immediately, object creation information, object destruction information and memory occupation information in the memory are asynchronously counted to determine an object creation rate, an object destruction rate and a memory limit again and updated to the creation rate control scheduler.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program to instruct relevant hardware to perform the processes, and the processes can be stored in a computer readable storage medium, and when executed, the processes can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a Random Access Memory (RAM), or the like. Embodiments of the computer program may achieve the same or similar effects as any of the preceding method embodiments to which it corresponds.
In some embodiments, the method further comprises: in response to receiving a memory allocation request for an object to be created and the client being configured to create the object immediately, memory is synchronously allocated directly for the object to be created to create the object immediately.
In some embodiments, the method further comprises: and asynchronously counting the object creating information, the object destroying information and the memory occupation information in the memory to determine the object creating rate, the object destroying rate and the memory limitation again and update the object creating rate, the object destroying rate and the memory limitation to the creating rate control scheduler in response to the object to be created being synchronously or asynchronously distributed with the memory and completing the creation of the object.
In some embodiments, synchronously determining, by the create rate control scheduler, a wait time that the memory allocation request will remain in the create object wait pool based on the object creation rate, the object destruction rate, and the memory limit comprises:
in response to the rate of object creation being greater than the rate of object destruction, determining a wait time expectation until the rate of object creation will be expected to be less than the rate of object destruction;
determining a latency expectation until the memory footprint will be less than the memory limit in response to the memory footprint having reached the memory limit;
determining the wait time as a maximum of the wait time expectations in response to generating at least one wait time expectation;
in response to not generating any latency expectation, the latency is determined to be zero.
In some embodiments, asynchronously counting the object creation information, the object destruction information, and the memory usage information in the memory includes: acquiring the time, the number and the size of the object to be created, and overlaying the time, the number and the size of the object to be created to the object creation information; acquiring the time, the number and the size of the destroyed objects, and overlaying the time, the number and the size of the destroyed objects to object destruction information; and scanning the memory to obtain memory occupation information.
In some embodiments, re-determining and updating the object creation rate, the object destruction rate, and the memory limit to the creation rate control scheduler comprises: the update is asynchronous to the create rate control scheduler and the updated object create rate, object destroy rate, and memory limit are used to determine the latency of the memory allocation request.
In some embodiments, the object to be created is a java object.
The following further illustrates an embodiment of the present invention in accordance with the embodiment shown in fig. 2.
The embodiment of the invention adds a switch before the java object is created, namely whether the object is created immediately or not. This switch is a custom configuration that controls whether or not an object is created immediately. If the object is created immediately, the previous java object creation business logic is still left without any change. If the object is set not to be created immediately, the main business logic of the invention is entered: and putting the application for creating the object into a created object waiting pool, waiting for the task scheduling of the 'created rate control scheduler', and finally creating the object at a proper time. The main responsibility of the "create rate control scheduler" is to determine whether to create an object immediately or how long to wait for it according to the current creation, release and current memory usage of the object in the application. The optimal control objective is to balance the rate of object creation with the efficiency of object release, be memory stable, and be less than the memory limit, so that our application will not crash, nor will the task execute too slowly.
Meanwhile, when the java objects are applied for each time, if the objects are not created immediately, each object creation needs to be recorded, the conditions of time, number, size and the like of object creation are counted, meanwhile, when the objects are recycled, the conditions of time, number, size and the like of object destruction are also counted, and an available dynamic object creation rate is calculated by combining the current total memory occupation amount and the external memory limitation condition, wherein the rate is the maximum value of the object creation rate and is used as a scheduling basis of a creation rate control scheduler under the condition that the memory is not crashed.
As can be seen from the foregoing embodiments, in the memory allocation method provided in the embodiments of the present invention, in response to receiving a memory allocation request of an object to be created and configuring a preset client as not to create the object immediately, the memory allocation request is synchronously placed into a created object waiting pool; asynchronously determining an object creation rate, an object destruction rate, and a memory constraint in the memory by the creation rate control scheduler, and synchronously determining a wait time for which the memory allocation request is to be maintained in the created object wait pool based on the object creation rate, the object destruction rate, and the memory constraint; asynchronously allocating memory for the object to be created to create the object in response to the memory allocation request having been held in the created object wait pool for a wait time; in response to the fact that a memory allocation request of an object to be created is received and a preset client configuration is adopted to not create the object immediately, the technical scheme that object creation information, object destruction information and memory occupation information in a memory are counted asynchronously to determine an object creation rate, an object destruction rate and memory limitation again and update the object creation rate, the object destruction rate and the memory limitation to a creation rate control scheduler is adopted, the object creation rate can be controlled, normal operation of the memory is guaranteed, and system stability is improved.
It should be particularly noted that, all the steps in the embodiments of the memory allocation method described above may be mutually intersected, replaced, added, or deleted, and therefore, the memory allocation method with these reasonable permutation and combination transformations shall also belong to the scope of the present invention, and shall not limit the scope of the present invention to the described embodiments.
In view of the foregoing, a second aspect of the embodiments of the present invention provides an embodiment of a memory allocation apparatus capable of controlling an object creation rate, ensuring that a memory works normally, and improving system stability. The memory allocation device comprises:
a processor; and
a memory storing program code executable by the processor, the program code when executed performing the steps of:
in response to the fact that a memory allocation request of an object to be created is received and a preset client is configured not to create the object immediately, the memory allocation request is synchronously placed into a created object waiting pool;
asynchronously determining an object creation rate, an object destruction rate, and a memory constraint in the memory by the creation rate control scheduler, and synchronously determining a wait time for which the memory allocation request is to be maintained in the created object wait pool based on the object creation rate, the object destruction rate, and the memory constraint;
asynchronously allocating memory for the object to be created to create the object in response to the memory allocation request having been held in the created object wait pool for a wait time;
in response to receiving a memory allocation request of an object to be created and a preset client is configured not to create the object immediately, object creation information, object destruction information and memory occupation information in the memory are asynchronously counted to determine an object creation rate, an object destruction rate and a memory limit again and updated to the creation rate control scheduler.
In some embodiments, synchronously determining, by the create rate control scheduler, a wait time that the memory allocation request will remain in the create object wait pool based on the object creation rate, the object destruction rate, and the memory limit comprises:
in response to the rate of object creation being greater than the rate of object destruction, determining a wait time expectation until the rate of object creation will be expected to be less than the rate of object destruction;
determining a latency expectation until the memory footprint will be less than the memory limit in response to the memory footprint having reached the memory limit;
determining the wait time as a maximum of the wait time expectations in response to generating at least one wait time expectation;
in response to not generating any latency expectation, the latency is determined to be zero.
In some embodiments, asynchronously counting the object creation information, the object destruction information, and the memory usage information in the memory includes: acquiring the time, the number and the size of the object to be created, and overlaying the time, the number and the size of the object to be created to the object creation information; acquiring the time, the number and the size of the destroyed objects, and overlaying the time, the number and the size of the destroyed objects to object destruction information; scanning the memory to obtain memory occupation information;
re-determining and updating the object creation rate, the object destruction rate, and the memory limit to the creation rate control scheduler comprises: the update is asynchronous to the create rate control scheduler and the updated object create rate, object destroy rate, and memory limit are used to determine the latency of the memory allocation request.
As can be seen from the foregoing embodiments, in the memory allocation apparatus provided in the embodiments of the present invention, in response to receiving a memory allocation request of an object to be created and configuring a preset client not to create the object immediately, the memory allocation request is synchronously placed into a created object waiting pool; asynchronously determining an object creation rate, an object destruction rate, and a memory constraint in the memory by the creation rate control scheduler, and synchronously determining a wait time for which the memory allocation request is to be maintained in the created object wait pool based on the object creation rate, the object destruction rate, and the memory constraint; asynchronously allocating memory for the object to be created to create the object in response to the memory allocation request having been held in the created object wait pool for a wait time; in response to the fact that a memory allocation request of an object to be created is received and a preset client configuration is adopted to not create the object immediately, the technical scheme that object creation information, object destruction information and memory occupation information in a memory are counted asynchronously to determine an object creation rate, an object destruction rate and memory limitation again and update the object creation rate, the object destruction rate and the memory limitation to a creation rate control scheduler is adopted, the object creation rate can be controlled, normal operation of the memory is guaranteed, and system stability is improved.
It should be particularly noted that, the above embodiment of the memory allocation apparatus adopts the embodiment of the memory allocation method to specifically describe the working process of each module, and those skilled in the art can easily think that these modules are applied to other embodiments of the memory allocation method. Of course, since the steps in the embodiment of the memory allocation method may be mutually intersected, replaced, added, and deleted, these reasonable permutations and combinations should also fall within the scope of the present invention for the memory allocation apparatus, and should not limit the scope of the present invention to the embodiment.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the present disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also technical features in the above embodiment or in different embodiments may be combined and there are many other variations of the different aspects of an embodiment of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.

Claims (10)

1. A memory allocation method is characterized by comprising the following steps:
in response to the fact that a memory allocation request of an object to be created is received and a preset client is configured not to create the object immediately, the memory allocation request is synchronously placed into a created object waiting pool;
asynchronously determining, by a create rate control scheduler, an object create rate, an object destroy rate, and a memory constraint in a memory, and synchronously determining a wait time for the memory allocation request to remain in the create object wait pool based on the object create rate, the object destroy rate, and the memory constraint;
asynchronously allocating memory for the object to be created to create an object in response to the memory allocation request having been held in the created object wait pool for the wait time;
in response to receiving a memory allocation request of an object to be created and a preset client is configured not to create the object immediately, object creation information, object destruction information and memory occupation information in a memory are asynchronously counted to determine the object creation rate, the object destruction rate and the memory limit again and updated to the creation rate control scheduler.
2. The method of claim 1, further comprising: and synchronously and directly allocating the memory for the object to be created to immediately create the object in response to receiving the memory allocation request of the object to be created and configuring the client to immediately create the object.
3. The method of claim 2, further comprising: and asynchronously counting object creating information, object destroying information and memory occupation information in the memory to determine the object creating rate, the object destroying rate and the memory limit again and updating the object creating rate, the object destroying rate and the memory limit to the creating rate control scheduler in response to the object to be created being synchronously or asynchronously allocated with the memory and completing creating the object.
4. The method of claim 1, wherein determining, by a create rate control scheduler, a wait time for the memory allocation request to remain in the create object wait pool based synchronously on the object creation rate, the object destruction rate, and the memory limit comprises:
in response to the object creation rate being greater than the object destruction rate, determining a wait time expectation until the object creation rate will be expected to be less than the object destruction rate;
determining a latency expectation until the memory footprint will be less than the memory limit in response to the memory footprint having reached the memory limit;
determining the wait time as a maximum of the wait time expectations in response to generating at least one wait time expectation;
in response to not generating any latency expectation, determining the latency to be zero.
5. The method of claim 1, wherein asynchronously counting object creation information, object destruction information, and memory usage information in memory comprises:
acquiring the time, the number and the size of the object to be created, and overlaying the time, the number and the size of the object to be created to the object creation information;
acquiring the time, the number and the size of the destroyed objects, and overlaying the time, the number and the size of the destroyed objects to the object destruction information;
and scanning the memory to obtain the memory occupation information.
6. The method of claim 5, wherein re-determining and updating the object creation rate, the object destruction rate, and the memory limit to the creation rate control scheduler comprises:
asynchronously update to the create rate control scheduler and determine the latency of the memory allocation request using the updated object create rate, the object destroy rate, and the memory limit.
7. The method of claim 1, wherein the object to be created is a java object.
8. A memory allocation apparatus, comprising:
a processor; and
a memory storing program code executable by the processor, the program code when executed performing the steps of:
in response to the fact that a memory allocation request of an object to be created is received and a preset client is configured not to create the object immediately, the memory allocation request is synchronously placed into a created object waiting pool;
asynchronously determining, by a create rate control scheduler, an object create rate, an object destroy rate, and a memory constraint in a memory, and synchronously determining a wait time for the memory allocation request to remain in the create object wait pool based on the object create rate, the object destroy rate, and the memory constraint;
asynchronously allocating memory for the object to be created to create an object in response to the memory allocation request having been held in the created object wait pool for the wait time;
in response to receiving a memory allocation request of an object to be created and a preset client is configured not to create the object immediately, object creation information, object destruction information and memory occupation information in a memory are asynchronously counted to determine the object creation rate, the object destruction rate and the memory limit again and updated to the creation rate control scheduler.
9. The apparatus of claim 8, wherein determining, by a create rate control scheduler, a wait time for the memory allocation request to remain in the create object wait pool based synchronously on the object creation rate, the object destruction rate, and the memory limit comprises:
in response to the object creation rate being greater than the object destruction rate, determining a wait time expectation until the object creation rate will be expected to be less than the object destruction rate;
determining a latency expectation until the memory footprint will be less than the memory limit in response to the memory footprint having reached the memory limit;
determining the wait time as a maximum of the wait time expectations in response to generating at least one wait time expectation;
in response to not generating any latency expectation, determining the latency to be zero.
10. The apparatus of claim 8, wherein asynchronously counting the object creation information, the object destruction information, and the memory usage information in the memory comprises: acquiring the time, the number and the size of the object to be created, and overlaying the time, the number and the size of the object to be created to the object creation information; acquiring the time, the number and the size of the destroyed objects, and overlaying the time, the number and the size of the destroyed objects to the object destruction information; scanning the memory to obtain the memory occupation information;
determining again the object creation rate, the object destruction rate, and the memory limit and updating to the creation rate control scheduler comprises: asynchronously update to the create rate control scheduler and determine the latency of the memory allocation request using the updated object create rate, the object destroy rate, and the memory limit.
CN202010852162.3A 2020-08-21 2020-08-21 Memory allocation method and device Active CN112114961B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010852162.3A CN112114961B (en) 2020-08-21 2020-08-21 Memory allocation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010852162.3A CN112114961B (en) 2020-08-21 2020-08-21 Memory allocation method and device

Publications (2)

Publication Number Publication Date
CN112114961A true CN112114961A (en) 2020-12-22
CN112114961B CN112114961B (en) 2022-05-31

Family

ID=73805391

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010852162.3A Active CN112114961B (en) 2020-08-21 2020-08-21 Memory allocation method and device

Country Status (1)

Country Link
CN (1) CN112114961B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101706801A (en) * 2009-11-17 2010-05-12 广州从兴电子开发有限公司 Method and system for managing memory database data
CN104536905A (en) * 2015-01-14 2015-04-22 浪潮(北京)电子信息产业有限公司 Memory management method and system
CN111427550A (en) * 2019-01-10 2020-07-17 武汉瓯越网视有限公司 Object creating method, terminal device and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101706801A (en) * 2009-11-17 2010-05-12 广州从兴电子开发有限公司 Method and system for managing memory database data
CN104536905A (en) * 2015-01-14 2015-04-22 浪潮(北京)电子信息产业有限公司 Memory management method and system
CN111427550A (en) * 2019-01-10 2020-07-17 武汉瓯越网视有限公司 Object creating method, terminal device and storage medium

Also Published As

Publication number Publication date
CN112114961B (en) 2022-05-31

Similar Documents

Publication Publication Date Title
US9361034B2 (en) Transferring storage resources between snapshot storage pools and volume storage pools in a distributed network
CN113037794B (en) Method, device and system for computing resource allocation scheduling
US20050005018A1 (en) Method and apparatus for performing application virtualization
JP2012094030A (en) Computer system and processing control method
US20230004416A1 (en) CPU Resource Reservation Method and Apparatus, and Related Device Thereof
CN111427675B (en) Data processing method and device and computer readable storage medium
CN108959118B (en) Data writing method and device
US10891150B2 (en) Storage control method and storage controller for user individual service environment
US20140281060A1 (en) Low-contention update buffer queuing for large systems
CN112114961B (en) Memory allocation method and device
CN114385349A (en) Container group deployment method and device
CN1092358C (en) Computor system with detecting point function
CN106533961A (en) Flow control method and device
US20220206836A1 (en) Method and Apparatus for Processing Virtual Machine Migration, Method and Apparatus for Generating Virtual Machine Migration Strategy, Device and Storage Medium
US6970893B2 (en) System and method for regeneration of methods and garbage collection of unused methods
CN112130995A (en) Real-time data processing method and device
CN109491987B (en) Data management method and device
CN114442955B (en) Data storage space management method and device for full flash memory array
CN110618863A (en) Operation scheduling method based on Raft algorithm
JP3688286B2 (en) Information storage control device, information storage control method, and information storage control program
CN110750330A (en) Virtual machine creating method, system, electronic equipment and storage medium
CN110569259A (en) Method and device for processing mass data
KR20190061241A (en) Mesos process apparatus for unified management of resource and method for the same
EP3933582B1 (en) Distributed storage method and device, electronic apparatus and computer-readable medium
CN114020208B (en) Data garbage collection method, device, computer equipment and storage medium

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