Instead of cStringIO, can you try using the Writer class from serialization.pyx?  Then we can hand a buffer object to zeromq.  (This saves us an extra memcpy from getvalue())