NotNull pointers

Timon Gehr timon.gehr at gmx.ch
Wed Aug 31 16:11:32 PDT 2011


On 09/01/2011 12:58 AM, Jonathan M Davis wrote:
> On Wednesday, August 31, 2011 14:18 Steven Schveighoffer wrote:
>> On Wed, 31 Aug 2011 16:54:50 -0400, Walter Bright
>> <newshound2 at digitalmars.com>  wrote:
>>> On 8/31/2011 1:19 PM, Steven Schveighoffer wrote:
>>>> I think bloat can't possibly be a valid concern here.
>>>
>>> You'd be surprised. I was surprised to discover that all the asserts in
>>> std.datetime caused the unittest build of phobos to exceed all available
>>> memory on my (old) FreeBSD box. (Jonathan used his own version of assert
>>> that uses more runtime memory, he's got like 7500 in there.) Minimizing
>>> the footprint of assert's reduces the resistance people have to using
>>> them.
>>
>> I think that:
>>
>> 1. this is likely a combination of code generation issues in dmd and
>> proliferation of asserts with templates/inlining as you say (I still feel
>> there is something wrong with dmd, but I have no evidence).
>> 2. Are more than 10% of those 7500 asserts of object references? I'd be
>> surprised if that were true.
>
> I don't think that there's even one assert on an object reference in there (if
> nothing else, there are very few classes in std.datetime), and none of them
> have invariants (some of the structs do but the few classes have very little
> state). The issue with std.datetime is almost certainly related to the number
> of templates (including _assertPred, which is definitely templatized). Given
> the general proliferation of templates in D (and Phobos in particular), dmd
> definitely needs to be efficient when it comes to compiling templates, and
> that doesn't generally seem to be the case with regards to memory consumption.

Probably that is because dmd leaks most memory it allocates. I seem to 
recall that is because of some bugs with interplay of the GC, which were 
resolved by just turning off the GC. What bugs were those?

I consider this an important issue, because I often cause the OS to swap 
heavily when compiling my Metaprogramming heavy code on my 2GB Ram 
machine, and I get one or two complete meltdowns each week.


More information about the Digitalmars-d mailing list