Skip to content

Conversation

@asiekierka
Copy link
Contributor

@asiekierka asiekierka commented Jan 5, 2026

As of today, picolibc has dropped support for the newlib fork of dlmalloc1. While nano-malloc has code size advantages, it is noticeably slower for environments with more desktop-like, heavy allocation patterns. As such, this commit pulls the latest version of dlmalloc into libnds, which is formally supported by picolibc's maintainer2.

This has a few other advantages; in particular, additional safety validations can now be included in the debug libnds build.

Other, leaner allocators, such as tlsf, may be evaluated in the future, but this is the easiest way to unblock picolibc updates going forward.

As dlmalloc has not seen updates in over 13 years, I feel confident just pulling it into the repository, without a submodule.

Comes with an unfortunate ~3 KiB (!) code size regression, but considerably faster performance in turn.

As of today, picolibc has dropped support for the newlib fork of dlmalloc[1].
While nano-malloc has code size advantages, it is noticeably slower for
environments with more desktop-like, heavy allocation patterns. As such,
this commit pulls the latest version of dlmalloc into libnds, which is
formally supported by picolibc's maintainer[2].

This has a few other advantages; in particular, additional safety validations
can now be included in the debug libnds build.

Other, leaner allocators, such as tlsf, may be evaluated in the future, but
this is the easiest way to unblock picolibc updates going forward.

[1]: picolibc/picolibc#1155
[2]: DragonMinded/libdragon#535 (comment)
The ARM7 has very limited memory available; as such, it is unlikely to see
significant allocation overhead. Use nano-malloc on that platform once
the Wonderful picolibc build is adjusted to provide that by default.
@AntonioND AntonioND merged commit d075758 into blocksds:master Jan 8, 2026
@AntonioND
Copy link
Member

AntonioND commented Jan 8, 2026

Thanks! I've added a patch on top of this to fix/silence some warnings and to add SPDX headers to the files so that it's easier to know the license of each file: 603dab7

I've tested Bunjalloo with this PR applied and it seems to work just fine (it uses dynamic allocations heavily, so it's a reasonable test).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants