Skip to content

Commit 49fbff4

Browse files
committed
Provide proper memory caps total size
1 parent d42f94a commit 49fbff4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Diff for: cores/esp32/Esp.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,7 @@ void EspClass::restart(void)
134134

135135
uint32_t EspClass::getHeapSize(void)
136136
{
137-
multi_heap_info_t info;
138-
heap_caps_get_info(&info, MALLOC_CAP_INTERNAL);
139-
return info.total_free_bytes + info.total_allocated_bytes;
137+
return heap_caps_get_total_size(MALLOC_CAP_INTERNAL);
140138
}
141139

142140
uint32_t EspClass::getFreeHeap(void)
@@ -157,9 +155,7 @@ uint32_t EspClass::getMaxAllocHeap(void)
157155
uint32_t EspClass::getPsramSize(void)
158156
{
159157
if(psramFound()){
160-
multi_heap_info_t info;
161-
heap_caps_get_info(&info, MALLOC_CAP_SPIRAM);
162-
return info.total_free_bytes + info.total_allocated_bytes;
158+
return heap_caps_get_total_size(MALLOC_CAP_SPIRAM)
163159
}
164160
return 0;
165161
}

0 commit comments

Comments
 (0)