A quick word about the pthreadrope7 fails.
Dhruv Matani
dhruvbird@gmx.net
Thu Oct 14 18:31:00 GMT 2004
On Thu, 2004-10-14 at 23:00, Paolo Carlini wrote:
> Dhruv Matani wrote:
>
> [snip]
>
> In the light of recent discussions and events, all of this is absolutely
> obvious.
>
> >Cheap as it may seem, it works at the moment. Does this test fail with
> >any other allocator?
> >
> Of course doesn't, since we are not deleting any memory at destruction.
>
> While we are at it, I also have something obvious to say ;)
>
> ---------------------------------------------------------------------
> | 136 | 0 | 4294967295 | Data-> Space for 32-ints |
> ---------------------------------------------------------------------
>
> since in the example the Data is 3 x 4 = 12 bytes forward wrt the address
> returned by ::operator new, of course it can only by aligned 4, bummer!
In the next block, bookkeeping-data = 4x4 and next time
4x(2+8) = 4x10
so the general formula is:
4x(2+2^n) where, n ranges from 1 to INT_MAX.
Clearly, only when n = 1, will there ever be a problem about alignment!
>
> If the header (the first 3 items) were longs on 64-bit machines you would
> have the Data aligned 8. And if you want the Data aligned 16, just add a
> long of padding between the bitmaps and the data.
>
> Paolo.
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
The price of freedom is responsibility, but it's a bargain, because
freedom is priceless. ~ Hugh Downs
More information about the Libstdc++
mailing list