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

            Bug ID: 51843
           Summary: Clang consumes 9GB of memory while parsing a TU with
                    unknown type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

Contents of a.cc:
```
#include <random>
mt19937_6
char _pool[128 << 20];
```

Running `/usr/bin/time -v clang -fsyntax-only a.cc` results in:
```
Command exited with non-zero status 1
        Command being timed: "clang -fsyntax-only a.cc"
        User time (seconds): 1.55
        System time (seconds): 2.40
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:03.95
        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): 9518328
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 13444
        Voluntary context switches: 1
        Involuntary context switches: 8
        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: 1
```

As can be seen maximum resident size is ~9GB. The same TU consumes only ~80MB
when the unknown type error is fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to