Lines Matching refs:memory

5 …he OS, manages the memory resources of the system. Memory management primarily involves initializi…
8memory management module manages the memory usage of users and the OS by allocating and releasing
11 …nHarmony LiteOS-M kernel memory management involves static and dynamic memory management, and prov…
14 - Dynamic memory: memory blocks of user-specified size allocated in the dynamic memory pool.
16 - Disadvantage: Fragments may occur in the memory pool.
18 - Static memory: memory blocks of the fixed size (preset during initialization) allocated in the st…
19 …: Memory is allocated and released efficiently, and there is no memory fragment in the memory pool.
20 …- Disadvantage: Only the memory blocks of the fixed size can be allocated. Memory cannot be alloca…
26 The static memory is a static array. The block size in the static memory pool is set during initial…
28memory pool consists of a control block **LOS_MEMBOX_INFO** and several memory blocks **LOS_MEMBOX…
30 **Figure 1** Static memory
32 ![](figures/static-memory.png "static-memory")
40 Use static memory allocation to obtain memory blocks of the fixed size. When the memory is no longe…
45 The following table describes APIs available for OpenHarmony LiteOS-M static memory management. For…
47 **Table 1** APIs of the static memory module
51 …e static memory pool| **LOS_MemboxInit**: initializes a static memory pool, that is, sets the star…
52 | Clearing static memory blocks| **LOS_MemboxClr**: clears the memory blocks allocated from the sta…
53memory| **LOS_MemboxAlloc**: allocates a memory block from a specified static memory pool.<br>**LO…
54memory pool information| **LOS_MemboxStatisticsGet**: obtains information about a specified static…
57memory blocks in the memory pool after initialization is not equal to the total memory size divide…
62 The typical development process of static memory is as follows:
64 1. Plan a memory area as a static memory pool.
66 2. Call **LOS_MemboxInit** to initialize the static memory pool.
67memory space specified by the input parameter is divided into multiple blocks (the number of block…
69 3. Call **LOS_MemboxAlloc** to allocate the static memory.
70 … obtains the first free block from the free list and returns the start address of the memory block.
73 Clear the memory block corresponding to the address contained in the input parameter.
76 Add the memory block to the free list.
83 1. Initialize a static memory pool.
85 2. Allocate a memory block from the static memory pool.
87 3. Store a piece of data in a memory block.
89 4. Print the data in the memory block.
91 5. Clear the data in the memory block.
93 6. Release the memory block.
113 /* Initialize the memory pool. */
122 /* Request a memory block. */
130 /*Verify the read and write operations on the memory address. */
134 /* Clear the memory. */
138 / Release the memory. */
170memory management allows memory blocks of any size to be allocated from a large contiguous memory
172memory of the OpenHarmony LiteOS-M has optimized the memory space partitioning based on the Two-Le…
174 **Figure 2** Dynamic memory algorithm for mini systems
176 ![](figures/dynamic-memory-algorithm-for-mini-systems.png "dynamic-memory-algorithm-for-mini-system…
178 …e lists are used for management based on the size of the free memory block. The free memory blocks…
180memory in the range of [4, 127](lower part in the figure) is equally divided into 31 parts. The si…
182 2. The memory greater than 127 bytes is managed in power of two increments. The size of each range …
184memory to a free list. The 40-byte free memory corresponds to the 10th free list in the range of […
186 The figure below shows the memory management structure.
188 **Figure 3** Dynamic memory management structure for mini systems
190 ![](figures/dynamic-memory-management-structure-for-mini-systems.png "dynamic-memory-management-str…
193memory pool header contains the memory pool information, bitmap flag array, and free list array. T…
196 …d end node. Each memory node maintains the size and use flag of the memory node and a pointer to t…
198memory needs to be used because the on-chip RAMs of some chips cannot meet requirements. The OpenH…
200 **Figure 4** Integrating discontiguous memory regions
202 ![](figures/integrating-discontiguous-memory-regions.png "integrating-discontiguous-memory-regions")
204 The discontiguous memory regions are integrated into a unified memory pool as follows:
206 1. Call **LOS_MemInit** to initialize the first memory region of multiple discontiguous memory regi…
208 …s and length of the next memory region, and calculate the **gapSize** between the current memory r…
210 3. Set the size of the end node of the previous memory region to the sum of **gapSize** and **OS_ME…
212 4. Divide the current memory region into a free memory node and an end node, insert the free memory
214 5. Repeat 2 to 4 to integrate more discontiguous memory regions.
222memory management allocates and manages memory resources requested by users dynamically. It is a g…
227 The following table describes APIs available for OpenHarmony LiteOS-M dynamic memory management. Fo…
229 **Table 2** APIs of the dynamic memory module
233 …or deleting a memory pool| **LOS_MemInit**: initializes a dynamic memory pool of the specified siz…
234memory| **LOS_MemAlloc**: allocates memory of the specified size from the dynamic memory pool.<br>…
235memory pool information| **LOS_MemPoolSizeGet**: obtains the total size of the specified dynamic m…
236memory block information| **LOS_MemFreeNodeShow**: prints the size and number of free memory block…
237 | Checking memory pool integrity| **LOS_MemIntegrityCheck**: checks the integrity of a memory pool.…
238memory regions| **LOS_MemRegionsAdd**: logically integrates multiple discontiguous memory regions …
241 > - The dynamic memory module manages memory through control block structures, which consume extra
243 …s consume extra memory for memory alignment, which may cause memory loss. When the memory used for…
245memory regions passed by the **LosMemRegion** array to the **LOS_MemRegionsAdd** API must be sorte…
250 The typical development process of dynamic memory is as follows:
252 1. Call **LOS_MemInit** to initialize a memory pool.
253memory pool is initialized, a memory pool control header and end node will be generated, and the r…
255 1. Call **LOS_MemAlloc** to allocate dynamic memory of any size.
256memory pool has free memory blocks greater than the requested size. If yes, the system allocates a…
258 1. Call **LOS_MemFree** to release dynamic memory.
259 … released memory block can be reused. When **LOS_MemFree** is called, the memory block will be rec…
266 1. Initialize a dynamic memory pool.
268 2. Allocate a memory block from the dynamic memory pool.
270 3. Store a piece of data in the memory block.
272 4. Print the data in the memory block.
274 5. Release the memory block.
294 /* Initialize the memory pool. */
303 /* Request a memory block. */
311 /*Verify the read and write operations on the memory address. */
315 / Release the memory. */