9 months, 1 week ago.
The system is out of memory - LPC1768
Hi everyone, I am new to mbed OS. Could you please explain step by step, what should I do to solve this problem?
7 months, 4 weeks ago.
You provide no details, so it is hard to help. But there are a few things to offer -
- LPC1768 has 2 x 32K of RAM - for everything. Depending on what you do this isn't enough.
- Why did I write 2 x 32K? Because these are not contiguous 32K chunks, so you cannot create any object > 32K in size.
- The first 32K chunk includes all overhead - such as data and stack, os thread management, and so on. Depending on the OS version you are using, you might only have from 8 to 12K available for your application data requirements.
The 2nd 32K chunk is used quite heavily by Ethernet and possibly other services, so if you use Ethernet, you should keep your needs out of that chunk. If you hunt the site you'll find the method to place something in that 2nd 32K space.
And then there is the case where your code works, but after a while it fails. This is typically an indication of a memory leak until all unused memory is consumed. What typically happens then is that the stack frame (which I think starts at high memory on the ARM parts and grows downward ) and the data and heap ram (which starts at low memory and grows upward) overlap. Then the program fails. Finding these is a challenge - if your code is large or uses many libraries you didn't author. And on the LPC1768, it is difficult at best to monitor for the memory usage, let alone finding the source of the leakage.