Skip to content

Commit

Permalink
libc/picolibc: Only enable malloc when required
Browse files Browse the repository at this point in the history
When malloc is included in the build, the heap initialization code will be
pulled in even if the application doesn't actually use malloc. This
increases the size of executables by a few hundred bytes and delays system
startup.

Select COMMON_LIBC_MALLOC only when applications indicate that they require
malloc by setting REQUIRES_MALLOC.

Signed-off-by: Keith Packard <[email protected]>
  • Loading branch information
keith-packard committed Nov 16, 2023
1 parent 33ab196 commit 1d7105b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/libc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ config PICOLIBC
imply THREAD_LOCAL_STORAGE if ARCH_HAS_THREAD_LOCAL_STORAGE && TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE
select LIBC_ERRNO if THREAD_LOCAL_STORAGE
select NEED_LIBC_MEM_PARTITION
imply COMMON_LIBC_MALLOC
select COMMON_LIBC_MALLOC if REQUIRES_MALLOC
depends on !NATIVE_APPLICATION
depends on PICOLIBC_SUPPORTED
help
Expand Down

0 comments on commit 1d7105b

Please sign in to comment.