Skip to content

end of unsorted bin loop, tcache allocation #7

@k4lizen

Description

@k4lizen

Lastly here, it will check if it actually inserted a chunk into the tcache that will serve as a reallocation for the requested size, it will allocate it from the tcache.

This part of the code is shown:

    ++tcache_unsorted_count;
    if (return_cached
       && mp_.tcache_unsorted_limit > 0
       && tcache_unsorted_count > mp_.tcache_unsorted_limit)
    {
       return tcache_get (tc_idx);
    }

That if statement only passes if mp_.tcache_unsorted_limit > 0, by default, mp_.tcache_unsorted_limit is equal to zero: https://elixir.bootlin.com/glibc/glibc-2.39/source/malloc/malloc.c#L1928
The actual check and allocation of a tcache chunks happens after the loop is finished: https://elixir.bootlin.com/glibc/glibc-2.39/source/malloc/malloc.c#L4246

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions