Skip to content

Commit 9f0e975

Browse files
committed
debug: Only report byte accessable free heap.
ESP.getFreeHeap() includes memory that can only be accessed with 32 bit alignment. However malloc etc. will never allocate from this memory. espressif/arduino-esp32#5346 (comment)
1 parent 6d3bbca commit 9f0e975

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: software/modules/backend/debug/debug.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ void Debug::setup()
4848

4949
task_scheduler.scheduleWithFixedDelay("update_debug_state", [this](){
5050
debug_state.get("uptime")->updateUint(millis());
51-
debug_state.get("free_heap")->updateUint(ESP.getFreeHeap());
52-
debug_state.get("largest_free_heap_block")->updateUint(ESP.getMaxAllocHeap());
51+
debug_state.get("free_heap")->updateUint(heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT));
52+
debug_state.get("largest_free_heap_block")->updateUint(heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT));
5353
}, 1000, 1000);
5454

5555
initialized = true;

0 commit comments

Comments
 (0)