Issue 159783
Summary [libc] Rising memory usage when configuring libc
Labels cmake, libc
Assignees
Reporter dcandler
    Over the last couple of releases, I've noticed an upwards trend in how much memory is used when configuring the libc project.

These numbers were obtained using the 21.1.1 release package to configure a standalone full cross build as per https://libc.llvm.org/full_cross_build.html#standalone-cross-build, but running it through valgrind's heap profiler massif and looking for the peak snapshot, e.g:

```
valgrind --tool=massif cmake ../runtimes \
 -G Ninja \
   -DLLVM_ENABLE_RUNTIMES=libc  \
 -DCMAKE_C_COMPILER=/dl/LLVM-21.1.1-Linux-X64/bin/clang \
 -DCMAKE_CXX_COMPILER=/dl/LLVM-21.1.1-Linux-X64/bin/clang++ \
 -DLLVM_LIBC_FULL_BUILD=ON \
   -DLIBC_TARGET_TRIPLE=aarch64-none-elf \
 -DCMAKE_BUILD_TYPE=Release
```

When 20.x was branched, configuration used ~0.8 GB of memory.
When 21.x was branched, configuration used ~1.4 GB of memory.
On a commit from yesterday, configuration used ~4.4 GB of memory.

The large peak occurs only at the end when generating files (after the "Configuring done" message). The memory used when actually building the project after it has been configured is comparatively trivial. It was only noticed as a problem because we build multiple versions of libc for different targets in parallel, and the increase has been enough to cause the machines to run out of memory with multiple simultaneous configurations.

I tried bisecting to identify which commits have increased the usage the most, and it appears to be ones such as a43ff0ec8a68 and 8c5e9399f634 adding endpoints, which can add +100 MB to +500 MB with each commit. 1b9e9e29e2db is also an outlier at +600 MB. But I can't tell if this is just a natural consequence of the project growing, or if there's something unexpectedly inefficient happening in CMake.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to