[all-commits] [llvm/llvm-project] 0c10bd: [libc] Lazily initialize freelist malloc using sym...

Daniel Thornburgh via All-commits all-commits at lists.llvm.org
Thu Jul 25 13:38:27 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0c10bdc05f0f90ae173f29854f03796e92ed76e4
      https://github.com/llvm/llvm-project/commit/0c10bdc05f0f90ae173f29854f03796e92ed76e4
  Author: Daniel Thornburgh <dthorn at google.com>
  Date:   2024-07-25 (Thu, 25 Jul 2024)

  Changed paths:
    M libc/config/baremetal/config.json
    M libc/config/config.json
    M libc/docs/configure.rst
    M libc/src/__support/freelist_heap.h
    M libc/src/stdlib/CMakeLists.txt
    M libc/src/stdlib/freelist_malloc.cpp
    M libc/test/src/__support/CMakeLists.txt
    A libc/test/src/__support/fake_heap.s
    M libc/test/src/__support/freelist_heap_test.cpp
    M libc/test/src/__support/freelist_malloc_test.cpp

  Log Message:
  -----------
  [libc] Lazily initialize freelist malloc using symbols (#99254)

This requires the user to set the upper bounds of the heap by defining
the symbol `__libc_heap_limit`. The heap begins at `_end` and ends
`__libc_heap_limit` bytes afterwards. This prevents a completely unused
heap from requiring any space, and it prevents the heap from being
zeroed at initialization time as part of BSS. It also allows users to
customize the available heap location without recompiling libc.
    
I'd think this should eventually be replaced with an implemenation based
on a morecore() library. This would allow the same implementation to use
sbrk() on POSIX, `_end` and `__libc_heap_limit` on embedded, and a
buffer in tests. It would also provide better "wilderness" behavior that
tends to decrease heap fragementation (see Wilson et al.)

See #98096



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