malloc behaviour on an embedded system
问题 I'm currently working on an embedded project (STM32F103RB, CooCox CoIDE v.1.7.6 with arm-none-eabi-gcc 4.8 2013q4) and I'm trying to understand how malloc() behaves on plain C when the RAM is full. My STM32 has 20kB = 0x5000Bytes of RAM, 0x200 are used for the stack. #include <stdlib.h> #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 !=