4 years, 2 months ago.

How can I check for available RAM?

I was wondering if there is any free memory library available, similar to the Memory Free one in Arduino ( There is one older thread on the topic (, but I was wondering if anything was developed meanwhile.

There isn't really a simple answer, since it also depepends on the size of the data you are trying to allocate, but have a look at:, for some more recent comments on it, including a way to increase your available RAM.

posted by Erik Olieman 22 Apr 2014
Comment on this question

1 Answer

4 years, 2 months ago.

That is not a simple question to answer in the general case. The problem is that internally an allocator might allocate more memory than requested via malloc(), so simply counting how many bytes you're allocating is often not enough. To further confuse matters, this behaviour is highly dependent on your toolchain. Some allocators offer an interface to their internal implementation (see for example mallinfo()), but again, that's dependent on the allocator. We are going to implement a custom allocator in mbed to handle this kind of situation, but I don't know when that will be ready.

To post an answer, please log in.