-
Notifications
You must be signed in to change notification settings - Fork 3k
significantly higher memory consumption and binary size with mbed 5.1 #2635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Some information about the different ROM sizes:
The default stack size has increased from 128x4 to 512x4 so this will take a chunk of that as well as a fixed size main stack. Also, GCC has some allocation for buffering in the stdlib. Lots of work ongoing right now around memory optimizations. Thanks for the detailed report. Any more finding, please report them here! |
ARM Internal Ref: IOTMORF-452 |
@mfiore02 There are three patches in the work which will bring memory consumption back to mbed 2.0-like levels (4.8K decrease in RAM for blinky), plus we're making the stack size configurable in #2646 so you can reclaim some memory there as well. We'll be publishing a blog post with some background and hard numbers when merged, but I'll send you a draft. |
@janjongboom that's great news! We've manually tweaked stack sizes for our platform for now, but it's good to know there's a global resolution coming! |
I've got similar out of memory issues using mbed 5.1 with an nRF51-DK (256KB flash / 32KB RAM). Checking one app with a similar "
Meaning that I only have about 1K of RAM left to use in my program. On another app I'm working on, the initial allocations succeed at boot time and tell me:
But the minute I try one more Hope these memory reduction patches make it to the mainline soon! |
@nuket Yeah, I've seen the same issues on the nRF51, but with these patches we managed to fit BLE + mbed TLS + RTOS + application into 32K again, similar profile as on mbed 2. |
@janjongboom This sounds pretty excellent. |
@janjongboom Are the patches associated with this stable / getting closer to being merged? |
ping @pan- |
I've made three different PR to solve some issues we currently have with the memory consumption: #2715 #2741 and #2745. Here is some good practices to optimize the application for size:
{
"macros": [
"NDEBUG=1",
"OS_TASKCNT=XXX",
"..."
]
} the main macros to override are:
|
@pan- I see these fixes have been merged into master branch. Looks like we should expect to see them in mbed-os-5.2? Is there a release date for mbed-os-5.2? |
estimated mid October. |
Hello, mbed5.2.1 uses even more RAM in comparison with the 5.1. I have to reduce the heap size to get in the static part. See below build output:
|
Could you list the mbed modules used by your application and post your configuration file ? |
I assume the feature in the target.json file:
|
the tools/memap.py with option -d gives a good readable output where you can see which module consume how much memory. See also https://github.com/ARMmbed/mbed-os/blob/master/docs/memap.md |
@bogdanm This has been on my list and I finally got to it. I ran the same test as the original post using latest mbed-os: 5.3.4/rev 2740. Compiled online for NUCLEO-L152RE. So flash consumption has gone down significantly, but RAM only about 1kB. |
GitHib issue review: Closed due to inactivity. Please re-file if critical issues found. |
We are currently developing a platform using the STM32L151CC processor - 32kB of RAM and 256kB of flash. We added platform support to mbed 2.0 during the transition to 5.x and are now adding support to 5.x so we can make a pull request and have our platform enabled.
We've noticed significantly higher memory consumption in mbed 5.x vs mbed 2.0. This is a problem for us because our application (an AT parser and a LoRa stack) currently can't run due to the system running out of memory during initialization.
We've done some testing with a similar platform to ours, NUCLEO-L152RE. We took the same main.cpp and built it with mbed-os revision 2244, mbed 125 & rtos 121, and mbed 121 & rtos 117. All of these builds were using the mbed online compiler. The main from the app is below:
Our results are as follows:
with mbed revision 121 mbed-rtos revision 117
binary size: 20kB
free memory: 74752
with mbed revision 125 mbed-rtos revision 121
binary size: 29K
free memory: 66816
with mbed-os revision 2244
binary size: 37kB
free memory: 65792
When I compile our LoRa stack (offline) for our new platform with mbed 2.0, I'm able to allocate over 13kB before the system runs out of memory. When I compile (offline) with mbed 5.1, I'm only able to allocate 2kB.
I'm hoping there are some switches in mbed 5.x that I can flip to reduce memory consumption. Reducing the consumption of our application and stack will be time-consuming and is considered a last resort.
Any ideas or insight appreciated.
The text was updated successfully, but these errors were encountered: