ABSTRACT

This chapter focuses on two ThreadX memory management resources that provide a good deal of flexibility: memory byte pools and memory block pools. A memory byte pool is a contiguous block of bytes. Memory byte pools are flexible and can be used for thread stacks and other resources that require memory. A memory block pool is also a contiguous block of bytes, but it is organized into a collection of fixed-size memory blocks. ThreadX allocates memory from the memory byte pool in a first-fit manner, i.e., it uses the first free memory block that is large enough to satisfy the request. The characteristics of each memory byte pool are found in its Control Block. It contains useful information such as the number of available bytes in the pool. Although memory byte pools provide the most flexible memory allocation, they also suffer from somewhat nondeterministic behavior.