lv_mem.h

API reference for lv_mem.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_mem_private.h

Functions

lv_mem_init

Initialize to use malloc/free/realloc etc

 
void lv_mem_init(void)

lv_mem_deinit

Drop all dynamically allocated memory and reset the memory pools' state

 
void lv_mem_deinit(void)

lv_mem_add_pool

 
lv_mem_pool_t lv_mem_add_pool(void *mem, size_t bytes)
Parameters
NameType
memvoid *
bytessize_t

lv_mem_remove_pool

 
void lv_mem_remove_pool(lv_mem_pool_t pool)
Parameters
NameType
poollv_mem_pool_t

lv_malloc

Allocate memory dynamically

 
void * lv_malloc(size_t size)
Parameters
NameTypeDescription
sizesize_trequested size in bytes

Returns: void * — pointer to allocated uninitialized memory, or NULL on failure

lv_calloc

Allocate a block of zeroed memory dynamically

 
void * lv_calloc(size_t num, size_t size)
Parameters
NameTypeDescription
numsize_trequested number of element to be allocated.
sizesize_trequested size of each element in bytes.

Returns: void * — pointer to allocated zeroed memory, or NULL on failure

lv_zalloc

Allocate zeroed memory dynamically

 
void * lv_zalloc(size_t size)
Parameters
NameTypeDescription
sizesize_trequested size in bytes

Returns: void * — pointer to allocated zeroed memory, or NULL on failure

lv_malloc_zeroed

Allocate zeroed memory dynamically

 
void * lv_malloc_zeroed(size_t size)
Parameters
NameTypeDescription
sizesize_trequested size in bytes

Returns: void * — pointer to allocated zeroed memory, or NULL on failure

lv_free

Free an allocated data

 
void lv_free(void *data)
Parameters
NameTypeDescription
datavoid *pointer to an allocated memory

lv_realloc

Reallocate a memory with a new size. The old content will be kept.

 
void * lv_realloc(void *data_p, size_t new_size)
Parameters
NameTypeDescription
data_pvoid *pointer to an allocated memory. Its content will be copied to the new memory block and freed
new_sizesize_tthe desired new size in byte

Returns: void * — pointer to the new memory, NULL on failure

lv_reallocf

Reallocate a memory with a new size. The old content will be kept. In case of failure, the old pointer is free'd.

 
void * lv_reallocf(void *data_p, size_t new_size)
Parameters
NameTypeDescription
data_pvoid *pointer to an allocated memory. Its content will be copied to the new memory block and freed
new_sizesize_tthe desired new size in byte

Returns: void * — pointer to the new memory, NULL on failure

lv_malloc_core

Used internally to execute a plain malloc operation

 
void * lv_malloc_core(size_t size)
Parameters
NameTypeDescription
sizesize_tsize in bytes to malloc

lv_free_core

Used internally to execute a plain free operation

 
void lv_free_core(void *p)
Parameters
NameTypeDescription
pvoid *memory address to free

lv_realloc_core

Used internally to execute a plain realloc operation

 
void * lv_realloc_core(void *p, size_t new_size)
Parameters
NameTypeDescription
pvoid *memory address to realloc
new_sizesize_tsize in bytes to realloc

lv_mem_monitor_core

Used internally by lv_mem_monitor() to gather LVGL heap state information.

 
void lv_mem_monitor_core(lv_mem_monitor_t *mon_p)
Parameters
NameTypeDescription
mon_plv_mem_monitor_t *pointer to lv_mem_monitor_t object to be populated.

lv_mem_test_core

 
lv_result_t lv_mem_test_core(void)

lv_mem_test

Tests the memory allocation system by allocating and freeing a block of memory.

 
lv_result_t lv_mem_test(void)

Returns: lv_result_t — LV_RESULT_OK if the memory allocation system is working properly, or LV_RESULT_INVALID if there is an error.

lv_mem_monitor

Give information about the work memory of dynamic allocation

 
void lv_mem_monitor(lv_mem_monitor_t *mon_p)
Parameters
NameTypeDescription
mon_plv_mem_monitor_t *pointer to a lv_mem_monitor_t variable, the result of the analysis will be stored here

Structs

struct

lv_mem_monitor_t

Heap information structure.

MemberTypeDescription
total_sizesize_tTotal heap size
free_cntsize_t
free_sizesize_tSize of available memory
free_biggest_sizesize_t
used_cntsize_t
max_usedsize_tMax size of Heap memory used
used_pctuint8_tPercentage used
frag_pctuint8_tAmount of fragmentation
Used by 2 functions
  • lv_mem_monitor_core — param mon_p
  • lv_mem_monitor — param mon_p

Typedefs

lv_mem_pool_t

 
typedef void* lv_mem_pool_t
Used by 1 function
  • lv_mem_remove_pool — param pool

Dependencies

How is this guide?

Last updated on

On this page