1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

metric for heap fragmentation (#5090)

* +Esp.getHeapUnfragness()

* only in debug mode

* default value

* always enable, 64->32, light 32 integer square root, comments

* fix when debugging is disabled

* give credits

* cosmetics

* fragmentation metric updates (doc, better api, added getMaxFreeBlockSize())

* api reworked, +example

* fixe types, fix names

* coding style fix

* use astyle for example
This commit is contained in:
david gauchard
2018-09-10 06:50:01 +02:00
committed by Develo
parent bbaea5a358
commit ce28a76a24
11 changed files with 227 additions and 5 deletions

View File

@ -291,9 +291,12 @@ Memory, memory, memory
rely on exceptions for error handling, which is not available for the ESP, and in any
case there is no access to the underlying code.
Instrumenting the code with the OOM debug option and calls to ``ESP.getFreeHeap()`` will
help the process of finding leaks. Now is time to re-read about the
`exception decoder <#exception-decoder>`__.
Instrumenting the code with the OOM debug option and calls to
``ESP.getFreeHeap()`` / ``ESP.getHeapFragmentation()`` /
``ESP.getMaxFreeBlockSize()`` will help the process of finding memory issues.
Now is time to re-read about the `exception decoder
<#exception-decoder>`__.
*Some techniques for reducing memory usage*

View File

@ -83,6 +83,10 @@ Some ESP-specific APIs related to deep sleep, RTC and flash memories are availab
``ESP.getFreeHeap()`` returns the free heap size.
``ESP.getHeapFragmentation()`` returns the fragmentation metric (0% is clean, more than ~50% is not harmless)
``ESP.getMaxFreeBlockSize()`` returns the maximum allocatable ram block regarding heap fragmentation
``ESP.getChipId()`` returns the ESP8266 chip ID as a 32-bit integer.
``ESP.getCoreVersion()`` returns a String containing the core version.