[zeromq-dev] ØMQ VSM data alignment

Matt Weinstein matt_weinstein at yahoo.com
Wed Aug 4 19:40:37 CEST 2010


posix_memalign --- "[...] GNU libc malloc() always returns 8-byte  
aligned memory addresses [...]"

http://linux.die.net/man/3/posix_memalign

IMO In order to be safe I think ØMQ needs to match this behavior (at  
least, and maybe provide a memalign option on a context basis ... ?)


On Aug 4, 2010, at 1:09 PM, Pieter Hintjens wrote:

> Matt,
>
> I don't think this has been covered.  It would be sensible to have
> vsm_data aligned but it's something that is IMO worth testing rather
> than doing on faith.
>
> -Pieter
>
>> Sorry if this has been covered before.
>> I've been using zmq to transport raw structures, and I've noticed  
>> that
>> zeromq apparently does not provide appropriate alignment for  
>> messages in
>> VSMs, and maybe for larger messages as well if you're using the  
>> front of the
>> content buffer (I haven't looked :-( )
>> Here are the offsets:
>>
>> 0x00    void *content;
>> 0x08    unsigned char flags;
>> 0x09    unsigned char vsm_size;
>> 0x0a    unsigned char vsm_data [ZMQ_MAX_VSM_SIZE];
>>
>> Shouldn't vsm_data be padded to 0x10 on 64 bit architectures (and  
>> maybe
>> others)?
>> RSVP,
>> Thanks,
>> Matt
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev




More information about the zeromq-dev mailing list