[all-commits] [llvm/llvm-project] c3207c: [libc] Use best-fit binary trie to make malloc log...

Daniel Thornburgh via All-commits all-commits at lists.llvm.org
Wed Nov 20 13:54:22 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c3207c31fce8afa4e5ae728804f18b4e863197e7
      https://github.com/llvm/llvm-project/commit/c3207c31fce8afa4e5ae728804f18b4e863197e7
  Author: Daniel Thornburgh <dthorn at google.com>
  Date:   2024-11-20 (Wed, 20 Nov 2024)

  Changed paths:
    M libc/fuzzing/__support/CMakeLists.txt
    A libc/fuzzing/__support/freelist_heap_fuzz.cpp
    M libc/src/__support/CMakeLists.txt
    M libc/src/__support/block.h
    A libc/src/__support/freelist.cpp
    M libc/src/__support/freelist.h
    M libc/src/__support/freelist_heap.h
    A libc/src/__support/freestore.h
    A libc/src/__support/freetrie.cpp
    A libc/src/__support/freetrie.h
    M libc/src/stdlib/freelist_malloc.cpp
    M libc/test/src/__support/CMakeLists.txt
    M libc/test/src/__support/block_test.cpp
    M libc/test/src/__support/freelist_heap_test.cpp
    M libc/test/src/__support/freelist_malloc_test.cpp
    M libc/test/src/__support/freelist_test.cpp
    A libc/test/src/__support/freestore_test.cpp
    A libc/test/src/__support/freetrie_test.cpp

  Log Message:
  -----------
  [libc] Use best-fit binary trie to make malloc logarithmic (#106259)

This reworks the free store implementation in libc's malloc to use a
dlmalloc-style binary trie of circularly linked FIFO free lists. This
data structure can be maintained in logarithmic time, but it still
permits a relatively small implementation compared to other
logarithmic-time ordered maps.

The implementation doesn't do the various bitwise tricks or
optimizations used in actual dlmalloc; it instead optimizes for
(relative) readability and minimum code size. Specific optimization can
be added as necessary given future profiling.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list