Tag: out of memory

嵌入式系统上的malloc行为

我目前正在开发一个嵌入式项目(STM32F103RB,CooCox CoIDE v.1.7.6 with arm-none-eabi-gcc 4.8 2013q4),我正在尝试理解当RAM满时malloc()在纯C上的行为。 我的STM32有20kB = 0x5000Bytes的RAM,0x200用于堆栈。 #include #include “stm32f10x.h” struct list_el { char weight[1024]; }; typedef struct list_el item; int main(void) { item * curr; // allocate until RAM is full do { curr = (item *)malloc(sizeof(item)); } while (curr != NULL); // I know, free() is missing. Program is supposed […]