54 if (
Alignment < (
int)
sizeof(
unsigned char *)) {
58 int alignmentBit = 0x1;
61 for (i = 0; i < 31; i++) {
69 #ifndef CPP_FREERTOS_NO_EXCEPTIONS 72 configASSERT(!
"MemoryPool Bad Alignment");
106 unsigned char *address = (
unsigned char *)malloc(
ItemSize * itemCount);
108 if (address == NULL) {
109 #ifndef CPP_FREERTOS_NO_EXCEPTIONS 112 configASSERT(!
"MemoryPool malloc Failed");
116 for (
int i = 0; i < itemCount; i++) {
126 void *preallocatedMemory,
127 int preallocatedMemorySize,
136 unsigned char *address = (
unsigned char *)preallocatedMemory;
138 while (preallocatedMemorySize >=
ItemSize) {
172 unsigned char *address = (
unsigned char *)malloc(
ItemSize * itemCount);
174 if (address == NULL) {
175 #ifndef CPP_FREERTOS_NO_EXCEPTIONS 178 configASSERT(!
"MemoryPool AddMemory Failed");
182 for (
int i = 0; i < itemCount; i++) {
193 int preallocatedMemorySize)
195 unsigned char *address = (
unsigned char *)preallocatedMemory;
197 while (preallocatedMemorySize >=
ItemSize) {
std::list< void * > FreeItems
MemoryPool(int itemSize, int itemCount, int alignment)
void CalculateValidAlignment()
void AddMemory(int itemCount)