[llvm-bugs] [Bug 48363] New: clang-format using over 5GB of RAM on a C file with many arrays
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Dec 2 06:43:27 PST 2020
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: unassignedclangbugs at nondot.org
Reporter: tmatth at videolan.org
CC: djasper at google.com, klimek at google.com,
llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201202/7af856b4/attachment.html>
More information about the llvm-bugs
mailing list