3 years, 4 months ago.

Memory leaks all around with simple programms.

Hello everybody,

I'm using a STM32F072VB on a custom board. 128KB Flash, 16KB RAM. After some testing i figuered out, that mbed uses about 7KB RAM with just a simple test programm. After some adjustments to Main-Stack-Size (down to 2KB) and Thread-Stack-Size(down to 512Byte) I am able to creat 3 Threats. That's it. Even if I try to create an additional EventQueue I get the message "Operator new[] out of memory"

include the mbed library with this snippet

#include "mbed.h"
Serial myserial (PA_9, PA_10, 115200);
Thread t1,t2,t3;
//EventQueue queue;

void schreibe_a(Serial *seriell){
	for(;;){
		seriell->putc('a');
		Thread::wait(500);
	}
}

void schreibe_b(Serial *seriell){
	for(;;){
			seriell->putc('b');
			Thread::wait(500);
	}
}

void schreibe_c(Serial *seriell){
	for(;;){
			seriell->putc('c');
			Thread::wait(500);
	}
}

int main() {
	t1.start(callback(schreibe_a, &myserial));
	t2.start(callback(schreibe_b, &myserial));
	t3.start(callback(schreibe_c, &myserial));
}

Compiler Message: Invoking: Cross ARM GNU Create Flash Image Invoking: Cross ARM GNU Print Size arm-none-eabi-objcopy -O ihex "mbed-dorobo.elf" "mbed-dorobo.hex" arm-none-eabi-size format=berkeley "mbed-dorobo.elf" text data bss dec hex filename 71136 2688 5952 79776 137a0 mbed-dorobo.elf Finished building: mbed-dorobo.siz Finished building: mbed-dorobo.hex <</code>>

The reference isnt very helpfull and I havent any idea why its consuming so much RAM. Main-Thread: 2KB 3x512Byte 1,5KB mbed: 7KB --- 10KB

So why does the EventQueue kills my programm? There are about 3-4 KB left for this????????

Be the first to answer this question.