NotNull pointers

Jonathan M Davis jmdavisProg at gmx.com
Wed Aug 31 15:58:08 PDT 2011


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.

That does remind me though that I need to get back to cleaning up 
std.datetime's unit tests soon.

- Jonathan M Davis


More information about the Digitalmars-d mailing list