llvm / llvm/llvm-project

clang-format-20 was terminated by OOM-killer while formatting large c-header

Open
#168,317 6 comments 1 reaction 0 assignees View on GitHub
clang-format
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

system and version:
```
$ clang-format --version
Ubuntu clang-format version 20.1.8 (++20250708082409+6fb913d3e2ec-1~exp1~20250708202428.132)

$ uname -a
Linux tester 6.8.0-87-generic #88~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Oct 14 14:03:14 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
```

file size:
```
$ ls -lah ./drv_cfg.h
-rwxrwxr-x 1 tester tester 141K nov 17 12:43 ./drv_cfg.h
```

Memory usage increases every second until the system finally freezes/crashes:
```
$ while :; do ps -aux | rg clang-format ; sleep 1; clear; done
tester 6106 101 75.8 14380988 12239548 pts/0 R+ 12:46 0:20 clang-format-20 -verbose -i ./drv_cfg.h

```
The "-verbose" flag does not output errors to the console when formatting this file.

Can you make patch for 20th version of clang-format to fix this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.