[zeromq-dev] Questions about Coding Style

john skaller skaller at users.sourceforge.net
Sat Feb 11 22:26:45 CET 2012

On 12/02/2012, at 8:03 AM, niXman wrote:
>> Sort of. You don't need to actually write an allocator.
>> It is enough to trace all constructed sockets.
> And what to do with pointers to the data for zmq_recv (), for example?
> void *data = 0x3423e65;
> zmq_recv(sock, data, 32, 0);

Of course, the logging stuff only catches errors with sockets.

> Regarding to the effeciency of malloc (): It is really very effective,
> but only for memory allocation. malloc () can not prevent the
> fragmentation of memory for the same reasons as the filesystem drivers
> can not prevent the fragmentation of the filesystem.
> For systems 24/7, the fragmentation of memory is a very big problem. I
> know whereof I speak.

Yeah, I know .. many hours spent running defrag on DOS disks :)

Your problem is that 0MQ is a library, not a framework.

If you want to do a better allocator that's used language wide,
come over to the Felix project where most of the allocations
are already done through a hook and there's already a way to
replace it.

Judy uses a hookable allocator, but that's only for internal
memory. The case above, arguments to zmq_recv, wouldn't
be covered by that.

OTOH, allocations to zmq_msg_t might be covered if you changed
the protocol. Perhaps I'm missing something.

john skaller
skaller at users.sourceforge.net

More information about the zeromq-dev mailing list