Skip to content

Backport upstream LVGL #8658: close the image decoder in lv_draw_image (SVG leak) - #32

Merged
zwang-ambiq merged 1 commit into
ambiq-stablefrom
fix-9.3-svg-leak
Nov 16, 2026
Merged

zwang-ambiq merged 1 commit into
ambiq-stablefrom
fix-9.3-svg-leak

Conversation

@eduardo-ambiq

Copy link
Copy Markdown
Collaborator

What

Backports upstream LVGL PR #8658 onto ambiq-stable (v9.3 line).

lv_draw_image() opened an image decoder but never closed it on the normal
path, so every draw leaked the decoder's state. With the SVG decoder that is
the parsed document and its render buffers, so memory grows on every redraw
of an SVG image.

Changes

  • src/draw/lv_draw_image.c: call lv_image_decoder_close(&decoder_dsc)
    once the image has been drawn.
  • tests/src/test_cases/libs/test_svg_decoder.c: each SVG test (decoder,
    decoder from file, snapshot) now runs twice. After each run it cleans the
    screen and drops the image cache, then asserts that the second run doesn't
    lower free memory (TEST_ASSERT_MEM_LEAK_LESS_THAN).

Why

lv_port_ambiq uses SVG images on Apollo5, where the heap is small and
partitioned. A leak per redraw eventually runs it out of memory.

@zwang-ambiq
zwang-ambiq merged commit 5b84743 into ambiq-stable Nov 16, 2026
20 checks passed
@zwang-ambiq
zwang-ambiq deleted the fix-9.3-svg-leak branch November 16, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants