[cfe-dev] Building cpp-netlib

Dean Michael Berris mikhailberis at gmail.com
Fri Sep 3 07:48:27 PDT 2010


On Fri, Sep 3, 2010 at 10:40 PM, Douglas Gregor <dgregor at apple.com> wrote:
>
> On Sep 3, 2010, at 7:37 AM, Dean Michael Berris wrote:
>
>> On Fri, Sep 3, 2010 at 10:16 PM, Douglas Gregor <dgregor at apple.com> wrote:
>>>
>>> On Sep 3, 2010, at 4:24 AM, Dean Michael Berris wrote:
>>>
>>>>
>>>> One observation though is that clang tends to require a lot of memory
>>>> -- almost 2:1 as far as virtual memory usage compared to GCC.
>>>
>>> I've also seen this with programs that use a lot of template metaprogramming and deep template instantiations (as your mention of Boost.MPL and Boost.Spirit would imply), and we're hoping to dig into it in the near future. I suspect it's the fact that we try to keep around a ton of source-location information when instantiating.
>>>
>>
>> That's great news, at least I'm not alone in noticing this. ;)
>>
>> Would it have something to do with the GCC optimization on using hash
>> tables for template specialization resolution?
>
>
> No. Clang has implemented that optimization from the beginning. More likely, it's because we keep precise source-location information for nearly every important token inside a template definition, and we make copies of that information each time we instantiate that template. Thus, an explosion in the number of template instantiations causes us to use too much memory. We know that we can share that source-location information, but we're not there yet :)
>

Ah yes, copies can explain it. :)

> But, this needs far more investigation.
>

At least it's in the radar, which is great news to me. :)

Thanks for the insights Doug! :D

-- 
Dean Michael Berris
deanberris.com




More information about the cfe-dev mailing list