Renesas M3T-MR100 用户手册

下载
页码 304
   
- 51 - 
 
4.1.10 
Variable-size Memory Pool Management Function 
A variable-size memory pool refers to the one in which a memory block of any desired size can be acquired from the mem-
ory pool. The MR100 permits one of the following two memory pool management methods to be selected before the mem-
ory pool is used. 
 
1.  Normal block method 
2. Small 
block 
method 
 
Each of these methods are explained below. 
 
[[Normal Block Method]] 
 
The technique that allows you to arbitrary define the size of memory block acquirable from the memory pool is termed Va-
riable-size scheme. The MR100 manages memory in terms of four fixed-size memory block sizes. 
The MR100 calculates the size of individual blocks based on the maximum memory block size to be acquired. You specify 
the maximum memory block size using the configuration file. 
• 
Equation for calculating four kinds of block sizes 
 
a = (((max_memsize+(X-1))/ X 
× 8)+1) × 8 
b = a 
× 2 
c = a 
× 4 
d = a 
× 8 
 
max_memsize: the value specified in the configuration file 
X: data size for block control (8 byte) 
 
• 
Example of a configuration file 
 
 
 variable_memorypool[]{ 
 
  
max_memsize 
= 400; <---- Maximum size 
 
  
heap_size 
= 5000; 
 
 }; 
 
 
If a variable-size memory pool is defined as shown above, the four kinds of fixed length block sizes are obtained from the 
define value of max_memsize as 56, 112, 224 and 448, respectively. Furthermore, the MR100 calculates the memory re-
quested by the user based on a specified size to select the appropriate size from the four kinds of fixed length block sizes as 
it allocates the requested memory. In no event will a memory block other than these four kinds of size be allocated. 
 
[[Small block method]] 
Unlike the normal block method where memory is managed in four kinds of fixed length block sizes, the small block me-
thod manages memory in 12 kinds of fixed length block sizes. Since the block sizes in this method are prefixed as shown 
below, there is no need to specify a maximum size during configuration as in the normal block method. 
The block sizes managed by the small block method are the following 12, beginning with the smallest:   
24 bytes, 56 bytes, 120 bytes, 248 bytes, 504 bytes, 1,016 bytes, 2,040 bytes, 4,088 bytes, 8,184 byte, 16,376 bytes, 32,760 
bytes and 65,528 bytes.