LittleVGL DEV-6.0 out_of_memory LV_LABEL_LONG_ROLL_CIRC

Using a small code with LV_LABEL_LONG_ROLL_CIRC I have out_of_memory msg.

switching to LV_LABEL_LONG_EXPAND is OK.

void main_screen(void)
{
	// Create a Screen
	Tela_Principal = lv_obj_create(NULL, NULL);
	lv_scr_load(Tela_Principal);
	// Imagem de Fundo
	img_fundo = lv_img_create(Tela_Principal, NULL);
    	lv_img_set_src(img_fundo, "P:/EX3000-XT/img/tela0.bin");
	lv_obj_set_protect(img_fundo, LV_PROTECT_POS);

	// Area de RDS
	static lv_style_t style_txt_rds;
	lv_style_copy(&style_txt_rds, &lv_style_plain);
	style_txt_rds.text.font = &lv_font_eurostile_24;
	style_txt_rds.text.letter_space = 1;
	style_txt_rds.text.line_space = 1;
	style_txt_rds.text.color = LV_COLOR_WHITE;
	// Cria um novo rotulo
	lv_obj_t * txt_rds = lv_label_create(Tela_Principal, NULL);
	lv_obj_set_style(txt_rds, &style_txt_rds); 			// Configura o estilo criado
	lv_label_set_long_mode(txt_rds, LV_LABEL_LONG_ROLL_CIRC);	// Quebra as linhas longas
	lv_label_set_recolor(txt_rds, true); 				// Ativa recolorizar por comandos no texto
	lv_label_set_align(txt_rds, LV_ALIGN_IN_TOP_LEFT); 		// Centraliza linhas alinhadas
	lv_label_set_text(txt_rds, "JOVEM PAN - RADIO DO BRASIL");
	lv_obj_set_width(txt_rds, 150); 				// Configuura o comprimento
	lv_obj_align(txt_rds, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 34); 	// Alinha ao centro}
}

Hi,

I’ve tested it and works well for me. Could you reproduce it in simulator on PC?

Hello,

code was used in the simulator, presenting the problem.

It looks like you are already very low on memory as it is, and LV_LABEL_LONG_ROLL_CIRC, that allocates a bit more. Increase LV_MEM_SIZE in lv_conf.h, or if you are using a custom allocator, its heap size.

increasing LV_MEM_SIZE, increases the time to problem.

Every 3 seconds the memory allocation increases by +/- 1.5K

@rdsantos18 Then you must be creating an object or something like that over and over. On its own, LittlevGL doesn’t increase it’s memory usage unless you ask it to do something.

@embeddedt Exchanging LV_LABEL_LONG_ROLL_CIRC for LV_LABEL_LONG_EXPAND does not occur

Are you creating objects over and over in a loop? That will slowly eat all of your memory. Like I said, the memory leak is 99% likely to be caused by your code. Do you call main_screen more than once?

The error only occurs if you have a background image

I’ve tested with only this code:


    static lv_style_t style_txt_rds;
    lv_style_copy(&style_txt_rds, &lv_style_plain);
    style_txt_rds.text.font = &lv_font_roboto_28;
    style_txt_rds.text.letter_space = 1;
    style_txt_rds.text.line_space = 1;
    style_txt_rds.text.color = LV_COLOR_BLACK;

    // Cria um novo rotulo
    lv_obj_t * txt_rds = lv_label_create(lv_scr_act(), NULL);
    lv_obj_set_style(txt_rds, &style_txt_rds);          // Configura o estilo criado
    lv_label_set_long_mode(txt_rds, LV_LABEL_LONG_ROLL_CIRC);   // Quebra as linhas longas
    lv_label_set_recolor(txt_rds, true);                // Ativa recolorizar por comandos no texto
    lv_label_set_align(txt_rds, LV_ALIGN_IN_TOP_LEFT);      // Centraliza linhas alinhadas
    lv_label_set_text(txt_rds, "JOVEM PAN - RADIO DO BRASIL");
    lv_obj_set_width(txt_rds, 150);                 // Configuura o comprimento
    lv_obj_align(txt_rds, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 34);  // Alinha ao centro}

I added breakpoints in lv_mem.c to the beginning of

  • lv_mem_alloc
  • lv_mem_free
  • lv_mem_realloc

After everything was created (only the animation was running) I didn’t see any memory allocation.

But I suppose you should will see some allocations. Please check where they occur.

@kisvegabor

By testing only this code I do not see any memory allocation.

Now including image I have memory allocation.

copy the same excerpt from the example in LV_TUTORIAL_IMAGES.

And I have memory allocation.

Trace: lv_img_design: start to draw image (…/lvgl/src/lv_objx/lv_img.c # 363)

static lv_style_t style_txt_rds;
lv_style_copy(&style_txt_rds, &lv_style_plain);
style_txt_rds.text.font = &lv_font_roboto_28;
style_txt_rds.text.letter_space = 1;
style_txt_rds.text.line_space = 1;
style_txt_rds.text.color = LV_COLOR_BLACK;

// Cria um novo rotulo
lv_obj_t * txt_rds = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style(txt_rds, &style_txt_rds);          // Configura o estilo criado
lv_label_set_long_mode(txt_rds, LV_LABEL_LONG_ROLL_CIRC);   // Quebra as linhas longas
lv_label_set_recolor(txt_rds, true);                // Ativa recolorizar por comandos no texto
lv_label_set_align(txt_rds, LV_ALIGN_IN_TOP_LEFT);      // Centraliza linhas alinhadas
lv_label_set_text(txt_rds, "JOVEM PAN - RADIO DO BRASIL");
lv_obj_set_width(txt_rds, 150);                 // Configuura o comprimento
lv_obj_align(txt_rds, NULL, LV_ALIGN_IN_TOP_LEFT, 16, 34);  // Alinha a

Thank you for testing it. I’ve found a memory leak when files were used as images. Should be fixed in dev-6.0. How is it working now?