Re: glib / CORBA integration examples ...



Sander Vesik <Sander.Vesik@Sun.COM> wrote:
> Malloc and calloc is required to return memory that is suitably aligned
> for storing any variable in it - hence you have the quarantee that no
> additional tweaking on the returned pointer is needed. I somehow imagine
> you have a lot more problems than Orbit if you use an allocator not
> matching this requirement on a machine with aligmnet restrictions.

Intel x86 machines have no alignment restrictions. Any address in memory
may be returned from the allocator, including odd (not aligned to a
two-byte boundary) addresses.

The problem is that ORBit then offsets this pointer by one byte. If the
address was odd, it becomes even. If it was even, it becomes odd. ORBit
assumes that memory chunks with odd alignments mean string allocations.
So if it allocates memory for a string and gets an odd address, it makes
it even when it does the offset. Then when you free it, ORBit thinks
it's not a string and tries to find a smart header. Nasal demons follow.
-- 
Sam "Eddie" Couter  |  mailto:sam@topic.com.au
Internet Engineer   |  jabber:sam@jabber.topic.com.au
tSA Consulting      |  http://www.topic.com.au/
OpenPGP fingerprint:  A46B 9BB5 3148 7BEA 1F05  5BD5 8530 03AE DE89 C75C

PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]