[llvm-bugs] [Bug 41625] New: Clang uses >8GB of RAM to build a PCH for a simple header

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Apr 27 05:26:40 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41625

            Bug ID: 41625
           Summary: Clang uses >8GB of RAM to build a PCH for a simple
                    header
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: poletti.marco at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Compiling a PCH for the following code:

struct Wrapper {
   struct X {};
   using Y = X(X(X(X(X(X(X(X(X(X(X(X(X(X(X(X())))))))))))))));
};

With a command like:

clang-8 -x c++-header file.h -o file.pch

Uses several GBs of RAM (>8).

If you want to reproduce, you might want to set a RAM limit in the current
shell, e.g. with "ulimit -Sv 8000000" otherwise your PC might start swapping
and/or become unresponsive.

I tested the following versions of Clang (on Ubuntu Linux):

8.0.0: affected
7.0.1: affected
6.0.1: NOT affected

So this seems to be a regression in Clang 7.x.

The above example is a minimized version of real code in
https://github.com/google/fruit, where building PCHs now fails in Travis CI
with OOM errors.

-- 
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/20190427/cc04baad/attachment.html>


More information about the llvm-bugs mailing list