[llvm-bugs] [Bug 51077] New: clang uses a lot of memory when compiling new T[big number]
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jul 13 08:23:55 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51077
Bug ID: 51077
Summary: clang uses a lot of memory when compiling new T[big
number]
Product: clang
Version: 11.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: mihail.dektyarow at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Created attachment 25020
--> https://bugs.llvm.org/attachment.cgi?id=25020&action=edit
clang stdout
Steps to reproduce:
1. Create file source.cpp with following content:
struct T {
char x;
};
T* f() {
return new T[100000000];
}
2. Run clang++ -v -c source.cpp -o source.o
Expected outcome:
clang creates object file without using too much memory
Actual outcome:
clang uses about 8GB of memory (and then on my machine is killed for OOM)
clang output attached.
This is easily reproducible on godbolt.org: clang 9 compiles this code just
fine, clang 10.0 or above reports out of memory https://godbolt.org/z/d9oej9a57
If we replace struct T with using T = char, everything works fine.
If we replace T[100000000] with T[10000000], clang uses about 1.6GB of memory
but compiles successfully.
On other machine, clang 12 compiles this file, but uses about 12GB of memory in
process.
--
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/20210713/c97af4f5/attachment.html>
More information about the llvm-bugs
mailing list