deprecated delete and manual memory management

Steven Schveighoffer schveiguy at yahoo.com
Mon May 2 06:33:10 PDT 2011


On Fri, 29 Apr 2011 17:02:55 -0400, Timon Gehr <timon.gehr at gmx.ch> wrote:

> Steven Schveighoffer wrote:
>
>> 2. the GC is conservative, and you are allocating swaths of 1K objects.
>> It's quite possible that you are running into false pointer issues.   
>> This
>> might be helped with a more precise GC (which there is a patch for in
>> bugzilla).  David Simcha has also checked into github improvements for
>> allocation of large objects.  This may also help with your benchmark.
>
> The data=void can be removed, but it actually slows down the benchmark a  
> little
> bit on my machine.

Yes, that's because you are using char data, whose default is 0xff :)

data = void doesn't actually make that data random, because it still has  
to initialize the other parts of the class data.  The run time doesn't  
have some way to "skip" certain parts of the initializer data.  So it  
likely just sets it to 0.

If you changed your data type to ubyte[], it would become fast again, even  
without the =void, because it's memsetting to 0 vs copying an initializer  
with some bytes set to 0xff.

-Steve


More information about the Digitalmars-d mailing list