July 02, 2010 Re: Spikes in array capacity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Fri, 02 Jul 2010 13:01:41 -0400, Ali Çehreli <acehreli@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@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.
-Steve
|
July 02, 2010 Re: Spikes in array capacity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Fri, 02 Jul 2010 14:50:53 -0400, Steven Schveighoffer <schveiguy@yahoo.com> wrote: > On Fri, 02 Jul 2010 13:01:41 -0400, Ali Çehreli <acehreli@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@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 -Steve |
July 02, 2010 Re: Spikes in array capacity | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Fri, 02 Jul 2010 14:58:41 -0400, Steven Schveighoffer <schveiguy@yahoo.com> wrote: > On Fri, 02 Jul 2010 14:50:53 -0400, Steven Schveighoffer <schveiguy@yahoo.com> wrote: > >> On Fri, 02 Jul 2010 13:01:41 -0400, Ali Çehreli <acehreli@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@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 |
Copyright © 1999-2021 by the D Language Foundation