Skip to content

Commit

Permalink
[libc][stdlib] Add Block class
Browse files Browse the repository at this point in the history
A block represents a chunk of memory used by the freelist allocator. It
contains header information denoting the usable space and pointers as
offsets to the next and previous block.

On it's own, this doesn't do much. This is a part of
#94270 to land in smaller
patches.

This is a subset of pigweed's freelist allocator implementation.
  • Loading branch information
PiJoules committed Jun 7, 2024
1 parent e20b904 commit 4ed98b0
Show file tree
Hide file tree
Showing 4 changed files with 1,077 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libc/src/stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,18 @@ elseif(LIBC_TARGET_OS_IS_GPU)
aligned_alloc
)
else()
add_header_library(
block
HDRS
block.h
DEPENDS
libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
libc.src.__support.CPP.new
libc.src.__support.CPP.optional
libc.src.__support.CPP.span
libc.src.__support.CPP.type_traits
)
add_entrypoint_external(
malloc
)
Expand Down
Loading

0 comments on commit 4ed98b0

Please sign in to comment.