USER_DATA free user data function


what to do do clean user data.

What MCU/Processor/Board and compiler are you using?

STM32H7 serie

What LVGL version are you using?

7.8.1 DEV


is it important to implement to free user data function ( i dont use it now ).

What is the impact if i dont implement it ?

How should i do it if needed it ?

My custom data type is void* and i always pass the same struct to it

	struct param_s{
		float value; 
		int32_t valueInt;
		float asign; 
                lv_obj_t *myobj;

The impact depends on what your user data is. If it’s being allocated from a heap, it’ll slowly continue using up memory as you create objects till memory runs out. In general, if it’s possible to free anything you are not using, do so.

so my user data type is void pointer.
And i pass a pointer to a static structure to it.

How should i clean it ?

If the structure is static (not allocated dynamically), there is no need to free it.

Here is structure i pass as pointer

struct param_s param{
float num1;
float num2;

struct data_t{
	 lv_obj_t * arc;
	 lv_obj_t * label;
	 lv_obj_t * labelVal;
	 struct param_s *param;
	 lv_obj_t * knob;

struct data_t myData;

lv_obj_set_user_data(pot_t->arc, (void*)&myData);