[llvm-dev] Memory utilization problems in profile reader

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 11 08:47:19 PST 2015

On Fri, Dec 11, 2015 at 7:53 AM, Diego Novillo via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> On Fri, Dec 11, 2015 at 9:58 AM, Diego Novillo <dnovillo at google.com>
> wrote:
>> So, I traced it down to the DenseMaps in class FunctionSamples.  I've
>> replaced them with two std::vector, and the read operation causes the
>> compiler to grow from 70Mb to 280Mb.  With the DenseMaps, reading the
>> profile causes the compiler to grow from 70Mb to 3Gb.
>> Somehow the DenseMaps are causing a 10x growth factor.  Those keys are
>> probably an issue.  Or perhaps we just need a different representation for
>> sample records and call sites.
> Yes. In going through DenseMap's implementation I see that large values
> for keys will cause a lot of growth.  And the documentation confirms it
> (someday I'll learn to read documentation first).

I agree, it's a pretty major pitfall. It'd be nice if DenseMap used
std::unique_ptr or something under the hood for value types over a certain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151211/b86de71d/attachment.html>

More information about the llvm-dev mailing list