Under what condition would tlsf_assert(block_size(block) >= size) occur


I’m using LVGL 8.1, and meet below assertion.
tlsf_assert(block_size(block) >= size);
I wonder under what condition that this assertion would happen, and how should I fix/avoid such problem.

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

What LVGL version are you using?


What do you want to achieve?

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

static block_header_t * block_locate_free(control_t * control, size_t size)
    int fl = 0, sl = 0;
    block_header_t * block = 0;

    if(size) {
        mapping_search(size, &fl, &sl);

        ** mapping_search can futz with the size, so for excessively large sizes it can sometimes wind up
        ** with indices that are off the end of the block array.
        ** So, we protect against that here, since this is the only callsite of mapping_search.
        ** Note that we don't need to check sl, since it comes from a modulo operation that guarantees it's always in range.
        if(fl < FL_INDEX_COUNT) {
            block = search_suitable_block(control, &fl, &sl);

    if(block) {
        tlsf_assert(block_size(block) >= size);
        remove_free_block(control, block, fl, sl);

    return block;

Any suggestion is appreciated.
Many Thanks.