Do I need to free the canvas'memory manually?

for example:

static lv_res_t custom_obj_signal(lv_obj_t * canvas, lv_signal_t sign, void * param)
    if(sign == LV_SIGNAL_CLEANUP) {
        lv_img_dsc_t* img = lv_canvas_get_img(canvas);
        img->data = NULL;
    return LV_RES_OK;

lv_obj_t* lv_custom_obj_create(lv_obj_t* parent, lv_coord_t size)
    uint32_t buf_size = LV_CANVAS_BUF_SIZE_INDEXED_1BIT(size, size);
    uint8_t* buf = lv_mem_alloc(buf_size);
    lv_obj_t* canvas = lv_canvas_create(parent, NULL);
    lv_canvas_set_buffer(canvas, buf, size, size, LV_IMG_CF_INDEXED_1BIT);
    lv_obj_set_signal_cb(canvas, custom_obj_signal);

    return canvas;

I free the buffer while this obj will be deleted, It’s right?

Hi @zhan,

Yes this looks correct to me.

Kind Regards,