Repository navigation
Backport upstream LVGL #8658: close the image decoder in lv_draw_image (SVG leak) - #32
Merged
Merged
Conversation
eduardo-ambiq
requested review from
mengzhang-ambiq,
zhichao-ambiq and
zwang-ambiq
as code owners
November 13, 2026 14:03
zwang-ambiq
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 normalpath, 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: calllv_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_ambiquses SVG images on Apollo5, where the heap is small andpartitioned. A leak per redraw eventually runs it out of memory.