[zeromq-dev] czmq and zalloc - handling OOM situations

AJ Lewis AJ.Lewis at quantum.com
Mon Sep 12 16:09:31 CEST 2011

Hi all,

I'm just starting to use zmq and czmq.  After poking a bit at the APIs
and the czmq code, I'm a bit confused about the zmalloc macro and
associated safe_malloc() wrapper.  It appears that the assumption in
czmq is that cmalloc never fails, which is generally true in Linux, but
not necessarily true on other OSes.  Is there a reason czmq doesn't
propogate a malloc error back up through the call stack, and instead
just abort()s?  I could #define _ZMALLOC_DEBUG, but then functions like
zframe_new() would just segfault in the OOM case.

Thank you,
AJ Lewis

P.S. Apologies if this ends up as a dup on the list - I originally sent
it through a smart mailer in a way which mailman appears to mark as

The information contained in this transmission may be confidential. Any disclosure, copying, or further distribution of confidential information is not permitted unless such privilege is explicitly granted in writing by Quantum. Quantum reserves the right to have electronic communications, including email and attachments, sent across its networks filtered through anti virus and spam software programs and retain such messages in order to comply with applicable data security and retention requirements. Quantum is not responsible for the proper and complete transmission of the substance of this communication or for any delay in its receipt.

More information about the zeromq-dev mailing list