We have a memory usage regression since the migration from elftoolchain’s strings to the LLVM’s version: It seems the LLVM’s version isn’t able to mmap while used in a pipe, so it copy ALL the file into memory. Example: $ dd if=/dev/urandom of=/tmp/test.file bs=1M count=1024 $ cat /tmp/test.file | strings > /dev/null & Now with elftoolchain’s strings: $ ps -o pid,command,vsz,rss | grep strings 53243 strings 12992 2556 And with LLVM’strings: $ ps -o pid,command,vsz,rss | grep strings 41791 strings 5027836 3413864 And with our use-case, we are using strings on GB files (like core dump), and it is now consumming all our memory. Peraps commit "81fa5c4a828bec9f1ead280c59c31bd423e6eeea" (llvm-strings: Install as strings when WITH_LLVM_BINUTILS=YES) should be reverted until fixed.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=fbd7087b0be2f327f806a85b92789a719138df8c commit fbd7087b0be2f327f806a85b92789a719138df8c Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2025-04-30 13:35:54 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-05-05 19:38:06 +0000 strings: Unconditionally install ELF Tool Chain's strings llvm-strings may consume a large amount of memory while reading the input file before producing any output. ELF Tool Chain's strings is small and lightweight, and we always install strings regardless of WITH_/WITHOUT_TOOLCHAIN settings (as it is useful in many contexts). Return to always installing ELF Tool Chain's version of strings. This reverts commit 81fa5c4a828bec9f1ead280c59c31bd423e6eeea. This reverts commit 7ca3db1999cd967f9d6d7b259aa7af54aae14a5f. PR: 286605 Reported by: olivier Reviewed by: olivier, brooks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50084 share/man/man5/src.conf.5 | 4 +++- tools/build/options/WITHOUT_LLVM_BINUTILS | 2 ++ tools/build/options/WITH_LLVM_BINUTILS | 2 ++ usr.bin/Makefile | 8 +------- usr.bin/clang/llvm-strings/Makefile | 7 ------- 5 files changed, 8 insertions(+), 15 deletions(-)
Opened an upstream bug report at https://github.com/llvm/llvm-project/issues/138855. We've switched back to ELF Tool Chain strings now, so closing the FreeBSD-specific issue.