How to calculate RAM which the project used?
-
- Posts: 15
- Joined: Fri Jun 09, 2017 3:06 am
How to calculate RAM which the project used?
I am a freshman in ESP platform. Now,i have a task which is to get the total of used RAM in examples .Do some people know it ?
Re: How to calculate RAM which the project used?
There is an ESP-IDF API called esp_get_free_heap_size() which returns the current number of bytes available on the heap for your application to use. When we talk about RAM, we usually think of heap from which can be carved malloc() storage. Another type of RAM usage is "stack" which is per task. The amount of storage allocated to a task is specified when the task is created and is under application control. To the best of my knowledge, when a new task is created, the storage for the stack is itself carved from the heap.
Of the 512K RAM available on an ESP32, about 200K is available to the heap when you app starts. Also remember that some system functions such as WiFi, sockets and Bluetooth connections will also eat into your heap allocation.
You can log the output of esp_get_free_heap_size() at the start of your application and when it it has reached its operational steady state to determine how much your own application has used.
Of the 512K RAM available on an ESP32, about 200K is available to the heap when you app starts. Also remember that some system functions such as WiFi, sockets and Bluetooth connections will also eat into your heap allocation.
You can log the output of esp_get_free_heap_size() at the start of your application and when it it has reached its operational steady state to determine how much your own application has used.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
-
- Posts: 15
- Joined: Fri Jun 09, 2017 3:06 am
Re: How to calculate RAM which the project used?
Thank you very much, it is helpful to me.kolban wrote:There is an ESP-IDF API called esp_get_free_heap_size() which returns the current number of bytes available on the heap for your application to use. When we talk about RAM, we usually think of heap from which can be carved malloc() storage. Another type of RAM usage is "stack" which is per task. The amount of storage allocated to a task is specified when the task is created and is under application control. To the best of my knowledge, when a new task is created, the storage for the stack is itself carved from the heap.
Of the 512K RAM available on an ESP32, about 200K is available to the heap when you app starts. Also remember that some system functions such as WiFi, sockets and Bluetooth connections will also eat into your heap allocation.
You can log the output of esp_get_free_heap_size() at the start of your application and when it it has reached its operational steady state to determine how much your own application has used.
-
- Posts: 15
- Joined: Fri Jun 09, 2017 3:06 am
Re: How to calculate RAM which the project used?
Thank you.WiFive wrote:viewtopic.php?t=1556
Who is online
Users browsing this forum: Bing [Bot] and 81 guests