2018-09-28 04:39 AM
Before you say it, I know dynamic allocation is usually a bad idea with embedded software, this is more of a technical question.
If I create a new blank C++ project based on my Nucleo-L152RE in SW4STM32, the "text" portion of my compiled project read by the "size" command is about 1kB. If I then add the lines:
int* p = new int;
delete p;
text size becomes 75kB. data and BSS are basically unaffected.
Why is it so?
2018-09-28 05:00 AM
.text is code, so it's the libraries pulled in. Look at the mapfile.
JW
2018-09-28 08:40 AM
Perhaps new pulls in exception handling code? As Jan said, check the map file.
2018-09-28 09:52 AM
and frankly pulling in anything the constructors/destructors touch or are dependent on