main: access minimumEverFreeHeap only when needed

This commit is contained in:
Reinhold Gschweicher 2023-05-03 20:40:41 +02:00
parent 7c2ea617f9
commit 310dc029a0

View File

@ -882,8 +882,8 @@ public:
if (print_memory_usage) { if (print_memory_usage) {
auto currentFreeHeap = xPortGetFreeHeapSize(); auto currentFreeHeap = xPortGetFreeHeapSize();
auto minimumEverFreeHeap = xPortGetMinimumEverFreeHeapSize();
if (currentFreeHeap != lastFreeHeapSize) { if (currentFreeHeap != lastFreeHeapSize) {
auto minimumEverFreeHeap = xPortGetMinimumEverFreeHeapSize();
// 14KiB is the LVGL memory size used in InfiniTime // 14KiB is the LVGL memory size used in InfiniTime
constexpr uint32_t pinetime_heap_memory = configTOTAL_HEAP_SIZE; constexpr uint32_t pinetime_heap_memory = configTOTAL_HEAP_SIZE;
uint32_t mem_used = pinetime_heap_memory - currentFreeHeap; uint32_t mem_used = pinetime_heap_memory - currentFreeHeap;