Method, device and system for allocating and releasing memory

A memory allocation and memory release technology, applied in the field of memory management, can solve the problems of poor memory allocation and release scalability, frequent memory fragmentation, etc., so as to reduce the search time, reduce the number, and improve the utilization rate.

Inactive Publication Date: 2013-03-13
融创天下(上海)科技发展有限公司
View PDF4 Cites 13 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] The technical problem to be solved by the present invention is to provide a method, device and system for memory allocation and release based on a fixed memory allocation amount, so as to solve the technical problems of frequent generation of memory fragments and poor scalability in the process of memory allocation and release in the prior art

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method, device and system for allocating and releasing memory
  • Method, device and system for allocating and releasing memory
  • Method, device and system for allocating and releasing memory

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0047] figure 1 It is the flowchart of the memory allocation method of the specific embodiment of the present invention, such as figure 1 As shown, the method includes the steps of,

[0048]S101, requesting at least two memory heap areas preset with a fixed memory allocation amount from the operating system, and assigning a serial number to each memory heap area in an increasing order of the fixed memory allocation amount;

[0049] The fixed memory allocation amount is arranged in an arithmetic sequence according to a preset arithmetic coefficient;

[0050] The preset fixed memory allocation in the memory heap area can be set according to the preset arithmetic difference coefficient; the arithmetic difference coefficient means that if a sequence starts from the second item, the difference between each item and its previous item The difference is equal to the same constant, and this constant is called the differential coefficient; all allocated memory heap areas assign sequen...

Embodiment 2

[0109] Figure 4 It is a flowchart of a memory release method in a specific embodiment of the present invention. Such as Figure 4 As shown, the method comprises the steps of:

[0110] S401, acquire a memory release request;

[0111] S402, judging whether the memory release length required by the memory release request exceeds the maximum value of the fixed memory allocation preset in the memory heap area, if not, proceed to step S403, and if yes, proceed to step S405;

[0112] S403. Obtain a sequence number according to the length;

[0113] The sequence label is calculated according to the following formula (1), so that the length of the requested memory release is larger than the fixed memory allocation of the previous memory heap area, and smaller than the fixed memory allocation of the current memory heap area,

[0114] i=(A+k) / k (1)

[0115] Wherein, i represents the serial number of the memory heap area matched with the memory release request; A represents the lengt...

Embodiment 3

[0129] The system includes a memory allocation device and a memory release device; the memory allocation device is connected to the memory release device;

[0130] The memory allocation device includes a preset heap module, a first request module, a first judgment module, a heap allocation module and a system allocation module;

[0131] The preset heap area module is connected to the first request module, and is used to request allocation of at least two memory heap areas preset with a fixed memory allocation amount;

[0132] The first request module is connected to the preset heap module and the first judgment module, and is used to obtain a memory allocation request;

[0133] The first judgment module is connected to the first request module, the heap area allocation module and the system allocation module, and is used to determine whether the length of the memory allocated by the memory allocation request exceeds the fixed memory allocation in the memory heap area If not, ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a method, a device and a system for allocating and releasing a memory. The method comprises the following steps of: acquiring fixed memory allocation quantities which conforms to an arithmetic sequence by virtue of preset equidifferent coefficients; then marking memory heap area allocation sequences according to the fixed memory allocation quantities; and acquiring corresponding sequence mark numbers according to a memory allocation request; acquiring memory heap areas according to the sequence mark numbers; and finally allocating memory blocks according to the fixed memory allocation quantities in the memory heap areas and allocating memories in the memory blocks. The invention is based on the fixed memory allocation quantities, dynamic extension on the memory accumulated region is realized, and when mmory allocation require is received, memory with proper length can be rapidly obtained by application, and quantity of memory fragments can be reduced. Meanwhile, the released memories in the memory heap areas are optimally allocated by virtue of a list structure in a management area, the search time is reduced, and the utilization ratio of memory space and the memory management efficiency are improved.

Description

technical field [0001] The invention relates to the technical field of memory management, in particular to a method, device and system for memory allocation and release based on a fixed memory allocation amount. Background technique [0002] In the existing system tests, it is often found that after the system has been running for a long time, the memory usage rate is getting higher and higher, and even the memory allocation fails, which eventually leads to the program crash. The occurrence of this situation is generally caused by memory fragmentation. [0003] Memory fragmentation is a very troublesome problem. Even when there is in fact a lot of free memory in a system, memory fragmentation can eventually lead to out-of-memory conditions. Run out of memory. This situation is unacceptable in many embedded systems, especially in high availability systems. Some software environments, such as the OSE real-time operating system, already have good tools for avoiding memory f...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F12/02
Inventor 熊剑
Owner 融创天下(上海)科技发展有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products