Spikes in array capacity

Steven Schveighoffer schveiguy at yahoo.com
Fri Jul 2 12:01:06 PDT 2010


On Fri, 02 Jul 2010 14:58:41 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Fri, 02 Jul 2010 14:50:53 -0400, Steven Schveighoffer  
> <schveiguy at yahoo.com> wrote:
>
>> On Fri, 02 Jul 2010 13:01:41 -0400, Ali Çehreli <acehreli at yahoo.com>  
>> wrote:
>>
>>> I've also discovered that a basic array invariant is violated at size  
>>> 509 as well:
>>>
>>> import std.string;
>>> import std.array;
>>>
>>> void main()
>>> {
>>>      int[] a;
>>>      a.length = 509;
>>>      a ~= 0;
>>>
>>>      assert(a.capacity >= a.length,
>>>             format("capacity: %s length: %s", a.capacity, a.length));
>>> }
>>>
>>> Outputs
>>>
>>> core.exception.AssertError at deneme.d(17444): capacity: 509 length: 510
>>>
>>> I will update the bug with these.
>>
>> Thanks.  I just figured this one out :)  Very interesting bug indeed.
>
> FYI: http://www.dsource.org/projects/druntime/changeset/317

Missed something, here is a better view of the change:  
http://www.dsource.org/projects/druntime/changeset?new=trunk%2Fsrc%2Frt%2Flifetime.d%40318&old=trunk%2Fsrc%2Frt%2Flifetime.d%40299

-Steve


More information about the Digitalmars-d mailing list