fix(stdlib): fix issues when using LVGL TLSF memory pool to manage more than 4 GiB of memory (#5720)

This commit is contained in:
Kenji Mouri (Qi Lu)
2024-02-24 21:06:31 +08:00
committed by GitHub
parent f5ca15b321
commit 10f9d98419
18 changed files with 39 additions and 39 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
#include "../../lv_conf_internal.h"
#include "../../lv_conf_internal.h"
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
#ifndef LV_TLSF_H
@@ -60,8 +60,8 @@ typedef struct {
lv_mutex_t mutex;
#endif
lv_tlsf_t tlsf;
uint32_t cur_used;
uint32_t max_used;
size_t cur_used;
size_t max_used;
lv_ll_t pool_ll;
} lv_tlsf_state_t;
+6 -6
View File
@@ -74,9 +74,9 @@ void * lv_malloc(size_t size)
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO
lv_mem_monitor_t mon;
lv_mem_monitor(&mon);
LV_LOG_INFO("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d",
(int)(mon.total_size - mon.free_size), mon.used_pct, mon.frag_pct,
(int)mon.free_biggest_size);
LV_LOG_INFO("used: %zu (%3d %%), frag: %3d %%, biggest free: %zu",
mon.total_size - mon.free_size, mon.used_pct, mon.frag_pct,
mon.free_biggest_size);
#endif
return NULL;
}
@@ -103,9 +103,9 @@ void * lv_malloc_zeroed(size_t size)
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO
lv_mem_monitor_t mon;
lv_mem_monitor(&mon);
LV_LOG_INFO("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d",
(int)(mon.total_size - mon.free_size), mon.used_pct, mon.frag_pct,
(int)mon.free_biggest_size);
LV_LOG_INFO("used: %zu (%3d %%), frag: %3d %%, biggest free: %zu",
mon.total_size - mon.free_size, mon.used_pct, mon.frag_pct,
mon.free_biggest_size);
#endif
return NULL;
}
+7 -7
View File
@@ -1,4 +1,4 @@
/**
/**
* @file lv_mem.h
*
*/
@@ -35,12 +35,12 @@ typedef void * lv_mem_pool_t;
* Heap information structure.
*/
typedef struct {
uint32_t total_size; /**< Total heap size*/
uint32_t free_cnt;
uint32_t free_size; /**< Size of available memory*/
uint32_t free_biggest_size;
uint32_t used_cnt;
uint32_t max_used; /**< Max size of Heap memory used*/
size_t total_size; /**< Total heap size*/
size_t free_cnt;
size_t free_size; /**< Size of available memory*/
size_t free_biggest_size;
size_t used_cnt;
size_t max_used; /**< Max size of Heap memory used*/
uint8_t used_pct; /**< Percentage used*/
uint8_t frag_pct; /**< Amount of fragmentation*/
} lv_mem_monitor_t;