https://bugs.llvm.org/show_bug.cgi?id=48363
Bug ID: 48363
Summary: clang-format using over 5GB of RAM on a C file with
many arrays
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: unassignedclangb...@nondot.org
Reporter: tma...@videolan.org
CC: djas...@google.com, kli...@google.com,
llvm-bugs@lists.llvm.org
Created attachment 24228
--> https://bugs.llvm.org/attachment.cgi?id=24228&action=edit
Problematic source file
I noticed that clang-format was running out of memory on a system with only
3.75GB available. It turns out that for a specific file
(https://aomedia.googlesource.com/aom/+/c15883a29b9dc3c28caa03e22b7368ed8355d834/av1/common/quant_common.c)
it is using over 5GB when invoked as follows:
/usr/bin/time -v clang-format -i --style=file aom/av1/common/quant_common.c
Command being timed: "clang-format -i --style=file
aom/av1/common/quant_common.c"
User time (seconds): 17.59
System time (seconds): 1.49
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:19.14
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 5479164 <----------------
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 1375531
Voluntary context switches: 2
Involuntary context switches: 136
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
The file in question is 12875 lines, and does contain a number of arrays, but
this still seems like it shouldn't be quite so memory intensive. I've seen the
same behavior with both clang 10 and 12.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs